20#ifndef RIPPLE_PROTOCOL_SFIELD_H_INCLUDED
21#define RIPPLE_PROTOCOL_SFIELD_H_INCLUDED
23#include <xrpl/basics/safe_cast.h>
24#include <xrpl/json/json_value.h>
56#pragma push_macro("XMACRO")
59#define XMACRO(STYPE) \
61 STYPE(STI_UNKNOWN, -2) \
62 STYPE(STI_NOTPRESENT, 0) \
63 STYPE(STI_UINT16, 1) \
66 STYPE(STI_UINT32, 2) \
67 STYPE(STI_UINT64, 3) \
68 STYPE(STI_UINT128, 4) \
69 STYPE(STI_UINT256, 5) \
70 STYPE(STI_AMOUNT, 6) \
72 STYPE(STI_ACCOUNT, 8) \
73 STYPE(STI_NUMBER, 9) \
76 STYPE(STI_OBJECT, 14) \
77 STYPE(STI_ARRAY, 15) \
80 STYPE(STI_UINT8, 16) \
81 STYPE(STI_UINT160, 17) \
82 STYPE(STI_PATHSET, 18) \
83 STYPE(STI_VECTOR256, 19) \
84 STYPE(STI_UINT96, 20) \
85 STYPE(STI_UINT192, 21) \
86 STYPE(STI_UINT384, 22) \
87 STYPE(STI_UINT512, 23) \
88 STYPE(STI_ISSUE, 24) \
89 STYPE(STI_XCHAIN_BRIDGE, 25) \
90 STYPE(STI_CURRENCY, 26) \
94 STYPE(STI_TRANSACTION, 10001) \
95 STYPE(STI_LEDGERENTRY, 10002) \
96 STYPE(STI_VALIDATION, 10003) \
97 STYPE(STI_METADATA, 10004)
99#pragma push_macro("TO_ENUM")
101#pragma push_macro("TO_MAP")
104#define TO_ENUM(name, value) name = value,
105#define TO_MAP(name, value) {#name, value},
114#pragma pop_macro("XMACRO")
115#pragma pop_macro("TO_ENUM")
116#pragma pop_macro("TO_MAP")
122 return (safe_cast<int>(
id) << 16) | index;
129 return (
id << 16) | index;
317 template <
class... Args>
333inline OptionaledField<T>
367#pragma push_macro("UNTYPED_SFIELD")
369#pragma push_macro("TYPED_SFIELD")
372#define UNTYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) \
373 extern SField const sfName;
374#define TYPED_SFIELD(sfName, stiSuffix, fieldValue, ...) \
375 extern SF_##stiSuffix const sfName;
380#include <xrpl/protocol/detail/sfields.macro>
383#pragma pop_macro("TYPED_SFIELD")
385#pragma pop_macro("UNTYPED_SFIELD")
Lightweight wrapper to tag static string.
Json::StaticString const & getJsonName() const
SField(SField const &)=delete
static std::map< int, SField const * > knownCodeToField
std::string const fieldName
bool operator==(SField const &f) const
static int getNumFields()
bool isDiscardable() const
std::string const & getName() const
SField & operator=(SField const &)=delete
bool shouldInclude(bool withSigningField) const
SField & operator=(SField &&)=delete
static IsSigning const notSigning
static SField const & getField(int type, int value)
static SField const & getField(SerializedTypeID type, int value)
Json::StaticString const jsonName
bool shouldMeta(int c) const
IsSigning const signingField
static SField const & getField(int fieldCode)
static std::map< int, SField const * > const & getKnownCodeToField()
SerializedTypeID const fieldType
bool operator!=(SField const &f) const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static std::map< std::string, int > const sTypeMap
OptionaledField< T > operator~(TypedField< T > const &f)
int field_code(SerializedTypeID id, int index)
Indicate std::optional field semantics.
OptionaledField(TypedField< T > const &f_)
TypedField< T > const * f
A field with a type known at compile time.