1#include <xrpl/basics/Log.h>
2#include <xrpl/basics/contract.h>
3#include <xrpl/json/json_value.h>
4#include <xrpl/protocol/SField.h>
5#include <xrpl/protocol/STArray.h>
6#include <xrpl/protocol/STBase.h>
7#include <xrpl/protocol/Serializer.h>
18 :
STBase(other.getFName()), v_(
std::move(other.v_))
26 v_ = std::move(other.v_);
51 if ((type == STI_ARRAY) && (field == 1))
54 if ((type == STI_OBJECT) && (field == 1))
57 <<
"Encountered array with end of object marker";
58 Throw<std::runtime_error>(
"Illegal terminator in array");
66 <<
"Unknown field: " << type <<
"/" << field;
67 Throw<std::runtime_error>(
"Unknown field");
70 if (fn.fieldType != STI_OBJECT)
72 JLOG(
debugLog().error()) <<
"Array contains non-object";
73 Throw<std::runtime_error>(
"Non-object in array");
78 v_.
back().applyTemplateFromSField(fn);
91 return emplace(n, buf, std::move(*
this));
100 for (
auto const& obj :
v_)
105 r += obj.getFullText();
136 for (
auto const&
object :
v_)
138 if (
object.
getSType() != STI_NOTPRESENT)
141 inner[
object.getFName().getJsonName()] =
object.getJson(p);
152 object.addFieldID(s);
167 auto v =
dynamic_cast<STArray const*
>(&t);
168 return v !=
nullptr &&
v_ == v->v_;
Value & append(Value const &value)
Append value to array at the end.
static SField const & getField(int fieldCode)
void sort(bool(*compare)(STObject const &o1, STObject const &o2))
std::string getFullText() const override
STBase * move(std::size_t n, void *buf) override
STBase * copy(std::size_t n, void *buf) const override
void add(Serializer &s) const override
bool isEquivalent(STBase const &t) const override
SerializedTypeID getSType() const override
Json::Value getJson(JsonOptions index) const override
bool isDefault() const override
STArray & operator=(STArray const &)=default
std::string getText() const override
A type which can be exported to a well known binary format.
void setFName(SField const &n)
A STBase is a field.
static STBase * emplace(std::size_t n, void *buf, T &&val)
void getFieldID(int &type, int &name)
std::size_t empty() const noexcept
int addFieldID(int type, int name)
T emplace_back(T... args)
@ arrayValue
array value (ordered list)
@ objectValue
object value (collection of name/value pairs).
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
beast::Journal debugLog()
Returns a debug journal.
Note, should be treated as flags that can be | and &.