mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-29 16:28:08 +00:00
Co-authored-by: tequ <git@tequ.dev> Co-authored-by: yinyiqian1 <yqian@ripple.com> Co-authored-by: Mayukha Vadari <mvadari@ripple.com> Co-authored-by: Mayukha Vadari <mvadari@gmail.com> Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com> Co-authored-by: Peter Chen <34582813+PeterChen13579@users.noreply.github.com> Co-authored-by: Zhiyuan Wang <96991820+Kassaking7@users.noreply.github.com> Co-authored-by: Ayaz Salikhov <asalikhov@ripple.com> Co-authored-by: Ayaz Salikhov <mathbunnyru@users.noreply.github.com> Co-authored-by: Zhiyuan Wang <1830604455@qq.com>
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#include <xrpl/protocol/LedgerFormats.h>
|
|
|
|
#include <xrpl/protocol/SField.h>
|
|
#include <xrpl/protocol/SOTemplate.h>
|
|
#include <xrpl/protocol/jss.h> // IWYU pragma: keep
|
|
|
|
#include <vector>
|
|
|
|
namespace xrpl {
|
|
|
|
std::vector<SOElement> const&
|
|
LedgerFormats::getCommonFields()
|
|
{
|
|
static auto const kCommonFields = std::vector<SOElement>{
|
|
{sfLedgerIndex, SoeOptional},
|
|
{sfLedgerEntryType, SoeRequired},
|
|
{sfFlags, SoeRequired},
|
|
{sfSponsor, SoeOptional},
|
|
};
|
|
return kCommonFields;
|
|
}
|
|
|
|
LedgerFormats::LedgerFormats()
|
|
{
|
|
#pragma push_macro("UNWRAP")
|
|
#undef UNWRAP
|
|
#pragma push_macro("LEDGER_ENTRY")
|
|
#undef LEDGER_ENTRY
|
|
|
|
#define UNWRAP(...) __VA_ARGS__
|
|
#define LEDGER_ENTRY(tag, value, name, rpcName, fields) \
|
|
add(jss::name, tag, UNWRAP fields, getCommonFields());
|
|
|
|
#include <xrpl/protocol/detail/ledger_entries.macro>
|
|
|
|
#undef LEDGER_ENTRY
|
|
#pragma pop_macro("LEDGER_ENTRY")
|
|
#undef UNWRAP
|
|
#pragma pop_macro("UNWRAP")
|
|
}
|
|
|
|
LedgerFormats const&
|
|
LedgerFormats::getInstance()
|
|
{
|
|
static LedgerFormats const kInstance;
|
|
return kInstance;
|
|
}
|
|
|
|
} // namespace xrpl
|