rippled
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes | List of all members
xrpl::SField Class Reference

Identifies fields. More...

#include <SField.h>

Inheritance diagram for xrpl::SField:
Inheritance graph
[legend]
Collaboration diagram for xrpl::SField:
Collaboration graph
[legend]

Classes

struct  private_access_tag_t
 

Public Types

enum  {
  sMD_Never = 0x00 , sMD_ChangeOrig = 0x01 , sMD_ChangeNew = 0x02 , sMD_DeleteFinal = 0x04 ,
  sMD_Create = 0x08 , sMD_Always = 0x10 , sMD_BaseTen = 0x20 , sMD_PseudoAccount = 0x40 ,
  sMD_NeedsAsset = 0x80 , sMD_Default = sMD_ChangeOrig | sMD_ChangeNew | sMD_DeleteFinal | sMD_Create
}
 
enum class  IsSigning : unsigned char { no , yes }
 

Public Member Functions

 SField (SField const &)=delete
 
SFieldoperator= (SField const &)=delete
 
 SField (SField &&)=delete
 
SFieldoperator= (SField &&)=delete
 
 SField (private_access_tag_t, SerializedTypeID tid, int fv, char const *fn, int meta=sMD_Default, IsSigning signing=IsSigning::yes)
 
 SField (private_access_tag_t, int fc, char const *fn)
 
std::string const & getName () const
 
bool hasName () const
 
Json::StaticString const & getJsonName () const
 
 operator Json::StaticString const & () const
 
bool isInvalid () const
 
bool isUseful () const
 
bool isBinary () const
 
bool isDiscardable () const
 
int getCode () const
 
int getNum () const
 
bool shouldMeta (int c) const
 
bool shouldInclude (bool withSigningField) const
 
bool operator== (SField const &f) const
 
bool operator!= (SField const &f) const
 

Static Public Member Functions

static SField const & getField (int fieldCode)
 
static SField const & getField (std::string const &fieldName)
 
static SField const & getField (int type, int value)
 
static SField const & getField (SerializedTypeID type, int value)
 
static int getNumFields ()
 
static int compare (SField const &f1, SField const &f2)
 
static std::unordered_map< int, SField const * > const & getKnownCodeToField ()
 

Public Attributes

int const fieldCode
 
SerializedTypeID const fieldType
 
int const fieldValue
 
std::string const fieldName
 
int const fieldMeta
 
int const fieldNum
 
IsSigning const signingField
 
Json::StaticString const jsonName
 

Static Public Attributes

static IsSigning const notSigning = IsSigning::no
 

Static Private Attributes

static int num = 0
 
static std::unordered_map< int, SField const * > knownCodeToField
 
static std::unordered_map< std::string, SField const * > knownNameToField
 

Detailed Description

Identifies fields.

Fields are necessary to tag data in signed transactions so that the binary format of the transaction can be canonicalized. All SFields are created at compile time.

Each SField, once constructed, lives until program termination, and there is only one instance per fieldType/fieldValue pair which serves the entire application.

Definition at line 125 of file SField.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
sMD_Never 
sMD_ChangeOrig 
sMD_ChangeNew 
sMD_DeleteFinal 
sMD_Create 
sMD_Always 
sMD_BaseTen 
sMD_PseudoAccount 
sMD_NeedsAsset 
sMD_Default 

Definition at line 128 of file SField.h.

◆ IsSigning

enum class xrpl::SField::IsSigning : unsigned char
strong
Enumerator
no 
yes 

Definition at line 144 of file SField.h.

Constructor & Destructor Documentation

◆ SField() [1/4]

xrpl::SField::SField ( SField const &  )
delete

◆ SField() [2/4]

xrpl::SField::SField ( SField &&  )
delete

◆ SField() [3/4]

xrpl::SField::SField ( private_access_tag_t  ,
SerializedTypeID  tid,
int  fv,
char const *  fn,
int  meta = sMD_Default,
IsSigning  signing = IsSigning::yes 
)

Definition at line 59 of file SField.cpp.

◆ SField() [4/4]

xrpl::SField::SField ( private_access_tag_t  ,
int  fc,
char const *  fn 
)
explicit

Definition at line 77 of file SField.cpp.

Member Function Documentation

◆ operator=() [1/2]

SField & xrpl::SField::operator= ( SField const &  )
delete

◆ operator=() [2/2]

SField & xrpl::SField::operator= ( SField &&  )
delete

◆ getField() [1/4]

SField const & xrpl::SField::getField ( int  fieldCode)
static

Definition at line 94 of file SField.cpp.

◆ getField() [2/4]

SField const & xrpl::SField::getField ( std::string const &  fieldName)
static

Definition at line 122 of file SField.cpp.

◆ getField() [3/4]

static SField const & xrpl::SField::getField ( int  type,
int  value 
)
static

Definition at line 181 of file SField.h.

◆ getField() [4/4]

static SField const & xrpl::SField::getField ( SerializedTypeID  type,
int  value 
)
static

Definition at line 187 of file SField.h.

◆ getName()

std::string const & xrpl::SField::getName ( ) const

Definition at line 193 of file SField.h.

◆ hasName()

bool xrpl::SField::hasName ( ) const

Definition at line 199 of file SField.h.

◆ getJsonName()

Json::StaticString const & xrpl::SField::getJsonName ( ) const

Definition at line 205 of file SField.h.

◆ operator Json::StaticString const &()

xrpl::SField::operator Json::StaticString const & ( ) const

Definition at line 210 of file SField.h.

◆ isInvalid()

bool xrpl::SField::isInvalid ( ) const

Definition at line 216 of file SField.h.

◆ isUseful()

bool xrpl::SField::isUseful ( ) const

Definition at line 222 of file SField.h.

◆ isBinary()

bool xrpl::SField::isBinary ( ) const

Definition at line 228 of file SField.h.

◆ isDiscardable()

bool xrpl::SField::isDiscardable ( ) const

Definition at line 238 of file SField.h.

◆ getCode()

int xrpl::SField::getCode ( ) const

Definition at line 244 of file SField.h.

◆ getNum()

int xrpl::SField::getNum ( ) const

Definition at line 249 of file SField.h.

◆ getNumFields()

static int xrpl::SField::getNumFields ( )
static

Definition at line 254 of file SField.h.

◆ shouldMeta()

bool xrpl::SField::shouldMeta ( int  c) const

Definition at line 260 of file SField.h.

◆ shouldInclude()

bool xrpl::SField::shouldInclude ( bool  withSigningField) const

Definition at line 266 of file SField.h.

◆ operator==()

bool xrpl::SField::operator== ( SField const &  f) const

Definition at line 272 of file SField.h.

◆ operator!=()

bool xrpl::SField::operator!= ( SField const &  f) const

Definition at line 278 of file SField.h.

◆ compare()

int xrpl::SField::compare ( SField const &  f1,
SField const &  f2 
)
static

Definition at line 106 of file SField.cpp.

◆ getKnownCodeToField()

static std::unordered_map< int, SField const * > const & xrpl::SField::getKnownCodeToField ( )
static

Definition at line 287 of file SField.h.

Member Data Documentation

◆ notSigning

SField::IsSigning const xrpl::SField::notSigning = IsSigning::no
static

Definition at line 145 of file SField.h.

◆ fieldCode

int const xrpl::SField::fieldCode

Definition at line 147 of file SField.h.

◆ fieldType

SerializedTypeID const xrpl::SField::fieldType

Definition at line 148 of file SField.h.

◆ fieldValue

int const xrpl::SField::fieldValue

Definition at line 149 of file SField.h.

◆ fieldName

std::string const xrpl::SField::fieldName

Definition at line 150 of file SField.h.

◆ fieldMeta

int const xrpl::SField::fieldMeta

Definition at line 151 of file SField.h.

◆ fieldNum

int const xrpl::SField::fieldNum

Definition at line 152 of file SField.h.

◆ signingField

IsSigning const xrpl::SField::signingField

Definition at line 153 of file SField.h.

◆ jsonName

Json::StaticString const xrpl::SField::jsonName

Definition at line 154 of file SField.h.

◆ num

int xrpl::SField::num = 0
staticprivate

Definition at line 293 of file SField.h.

◆ knownCodeToField

std::unordered_map< int, SField const * > xrpl::SField::knownCodeToField
staticprivate

Definition at line 294 of file SField.h.

◆ knownNameToField

std::unordered_map< std::string, SField const * > xrpl::SField::knownNameToField
staticprivate

Definition at line 295 of file SField.h.