20 #include <ripple/basics/contract.h>
21 #include <ripple/json/Object.h>
27 : parent_(parent), writer_(writer), enabled_(true)
50 enabled_ = that.enabled_;
52 that.parent_ =
nullptr;
53 that.writer_ =
nullptr;
54 that.enabled_ =
false;
61 *
this = std::move(that);
68 ripple::Throw<std::logic_error>(label +
": not enabled");
70 ripple::Throw<std::logic_error>(label +
": not writable");
121 : object_(object), key_(key)
128 return Proxy(*
this, key);
146 return append(
nullptr);
148 return append(v.
asInt());
150 return append(v.
asUInt());
156 return append(v.
asBool());
181 return set(k,
nullptr);
213 template <
class Object>
219 for (
auto& m : members)
231 doCopyFrom(to, from);
237 doCopyFrom(to, from);
Json::Value & appendObject(Json::Value &)
Append a new subobject to a Json object.
Array setArray(std::string const &key)
Make a new Array at a key and return it.
An Object that contains its own Writer.
@ arrayValue
array value (ordered list)
Array appendArray()
Append a new Array and return it.
void finish()
Finish the collection most recently started.
Root(Writer &)
Each Object::Root must be constructed with its own unique Writer.
Object(Collection *parent, Writer *w)
void check(bool condition, std::string const &message)
void startAppend(CollectionType)
Start a new collection inside an array.
void startRoot(CollectionType)
Start a new collection at the root level.
void copyFrom(Json::Value &to, Json::Value const &from)
Copy all the keys and values from one object into another.
WriterObject stringWriterObject(std::string &s)
@ uintValue
unsigned integer value
JSON (JavaScript Object Notation).
void checkWritable(std::string const &label)
void set(std::string const &key, Scalar const &)
Set a scalar value in the Object for a key.
@ objectValue
object value (collection of name/value pairs).
Proxy operator[](std::string const &key)
Represents a JSON array being written to a Writer.
Object setObject(std::string const &key)
Make a new Object at a key and return it.
Proxy(Object &object, std::string const &key)
@ stringValue
UTF-8 string value.
Collection & operator=(Collection &&c) noexcept
Object appendObject()
Append a new Object and return it.
void startSet(CollectionType, std::string const &key)
Start a new collection inside an object.
void append(Scalar const &)
Append a scalar to the Arrary.
Represents a JSON object being written to a Writer.
Members getMemberNames() const
Return a list of the member names.
Lightweight wrapper to tag static string.
@ intValue
signed integer value
Output stringOutput(std::string &s)
Writer implements an O(1)-space, O(1)-granular output JSON writer.
bool isObjectOrNull() const
Json::Value & appendArray(Json::Value &)
Append a new subarray to a Json array.
std::string asString() const
Returns the unquoted string value.