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>
25 v_ = std::move(other.v_);
50 if ((type == STI_ARRAY) && (field == 1))
53 if ((type == STI_OBJECT) && (field == 1))
55 JLOG(
debugLog().error()) <<
"Encountered array with end of object marker";
56 Throw<std::runtime_error>(
"Illegal terminator in array");
63 JLOG(
debugLog().error()) <<
"Unknown field: " << type <<
"/" << field;
64 Throw<std::runtime_error>(
"Unknown field");
67 if (fn.fieldType != STI_OBJECT)
69 JLOG(
debugLog().error()) <<
"Array contains non-object";
70 Throw<std::runtime_error>(
"Non-object in array");
75 v_.
back().applyTemplateFromSField(fn);
88 return emplace(n, buf, std::move(*
this));
97 for (
auto const& obj :
v_)
102 r += obj.getFullText();
133 for (
auto const&
object :
v_)
135 if (
object.
getSType() != STI_NOTPRESENT)
138 inner[
object.getFName().getJsonName()] =
object.getJson(p);
149 object.addFieldID(s);
164 auto v =
dynamic_cast<STArray const*
>(&t);
165 return v !=
nullptr &&
v_ == v->v_;
Value & append(Value const &value)
Append value to array at the end.
static SField const & getField(int fieldCode)
STArray & operator=(STArray const &)=default
std::string getFullText() const override
bool isEquivalent(STBase const &t) const override
STBase * copy(std::size_t n, void *buf) const override
std::string getText() const override
SerializedTypeID getSType() const override
void add(Serializer &s) const override
bool isDefault() const override
STBase * move(std::size_t n, void *buf) override
void sort(bool(*compare)(STObject const &o1, STObject const &o2))
Json::Value getJson(JsonOptions index) const override
A type which can be exported to a well known binary format.
static STBase * emplace(std::size_t n, void *buf, T &&val)
void setFName(SField const &n)
A STBase is a field.
std::size_t empty() const noexcept
void getFieldID(int &type, int &name)
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 &.