3#include <xrpl/basics/safe_cast.h>
4#include <xrpl/json/json_value.h>
5#include <xrpl/protocol/Units.h>
37#pragma push_macro("XMACRO")
40#define XMACRO(STYPE) \
42 STYPE(STI_UNKNOWN, -2) \
43 STYPE(STI_NOTPRESENT, 0) \
44 STYPE(STI_UINT16, 1) \
47 STYPE(STI_UINT32, 2) \
48 STYPE(STI_UINT64, 3) \
49 STYPE(STI_UINT128, 4) \
50 STYPE(STI_UINT256, 5) \
51 STYPE(STI_AMOUNT, 6) \
53 STYPE(STI_ACCOUNT, 8) \
54 STYPE(STI_NUMBER, 9) \
55 STYPE(STI_INT32, 10) \
56 STYPE(STI_INT64, 11) \
59 STYPE(STI_OBJECT, 14) \
60 STYPE(STI_ARRAY, 15) \
63 STYPE(STI_UINT8, 16) \
64 STYPE(STI_UINT160, 17) \
65 STYPE(STI_PATHSET, 18) \
66 STYPE(STI_VECTOR256, 19) \
67 STYPE(STI_UINT96, 20) \
68 STYPE(STI_UINT192, 21) \
69 STYPE(STI_UINT384, 22) \
70 STYPE(STI_UINT512, 23) \
71 STYPE(STI_ISSUE, 24) \
72 STYPE(STI_XCHAIN_BRIDGE, 25) \
73 STYPE(STI_CURRENCY, 26) \
77 STYPE(STI_TRANSACTION, 10001) \
78 STYPE(STI_LEDGERENTRY, 10002) \
79 STYPE(STI_VALIDATION, 10003) \
80 STYPE(STI_METADATA, 10004)
82#pragma push_macro("TO_ENUM")
84#pragma push_macro("TO_MAP")
87#define TO_ENUM(name, value) name = value,
88#define TO_MAP(name, value) {#name, value},
97#pragma pop_macro("XMACRO")
98#pragma pop_macro("TO_ENUM")
99#pragma pop_macro("TO_MAP")
105 return (safe_cast<int>(
id) << 16) | index;
112 return (
id << 16) | index;
304 template <
class... Args>
320inline OptionaledField<T>
357#pragma push_macro("UNTYPED_SFIELD")
359#pragma push_macro("TYPED_SFIELD")
362#define UNTYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) extern SField const sfName;
363#define TYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) extern SF_##stiSuffix const sfName;
368#include <xrpl/protocol/detail/sfields.macro>
371#pragma pop_macro("TYPED_SFIELD")
373#pragma pop_macro("UNTYPED_SFIELD")
Lightweight wrapper to tag static string.
static SField const & getField(int fieldCode)
SField & operator=(SField const &)=delete
bool shouldInclude(bool withSigningField) const
std::string const fieldName
static SField const & getField(SerializedTypeID type, int value)
Json::StaticString const & getJsonName() const
static std::unordered_map< std::string, SField const * > knownNameToField
bool isDiscardable() const
static std::unordered_map< int, SField const * > const & getKnownCodeToField()
bool operator!=(SField const &f) const
SerializedTypeID const fieldType
Json::StaticString const jsonName
static std::unordered_map< int, SField const * > knownCodeToField
bool shouldMeta(int c) const
static IsSigning const notSigning
std::string const & getName() const
static int getNumFields()
SField(SField const &)=delete
SField & operator=(SField &&)=delete
bool operator==(SField const &f) const
static SField const & getField(int type, int value)
IsSigning const signingField
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr ApplyFlags operator~(ApplyFlags const &flags)
int field_code(SerializedTypeID id, int index)
static std::map< std::string, int > const sTypeMap
Indicate std::optional field semantics.
TypedField< T > const * f
OptionaledField(TypedField< T > const &f_)
A field with a type known at compile time.