1#ifndef XRPL_JSON_JSON_WRITER_H_INCLUDED
2#define XRPL_JSON_JSON_WRITER_H_INCLUDED
4#include <xrpl/json/json_forwards.h>
5#include <xrpl/json/json_value.h>
203template <
class Write>
210template <
class Write>
214 switch (value.
type())
242 int const size = value.
size();
243 for (
int index = 0; index < size; ++index)
256 for (
auto it = members.
begin(); it != members.
end(); ++it)
259 if (it != members.
begin())
280template <
class Write>
320 o.
write(
static_cast<char const*
>(data), n);
Decorator for streaming out compact json.
Compact(Json::Value &&jv)
Wrap a Json::Value for compact streaming.
friend std::ostream & operator<<(std::ostream &o, Compact const &cJv)
Outputs a Value in JSON format without formatting (not human friendly).
std::string write(Value const &root) override
void writeValue(Value const &value)
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string.
void write(std::ostream &out, Value const &root)
Serialize a Value in JSON format.
void writeWithIndent(std::string const &value)
bool isMultineArray(Value const &value)
void writeValue(Value const &value)
void writeArrayValue(Value const &value)
void pushValue(std::string const &value)
std::string indentString_
Writes a Value in JSON format in a human friendly way.
std::string write(Value const &root) override
Serialize a Value in JSON format.
std::string indentString_
void pushValue(std::string const &value)
void writeValue(Value const &value)
void writeArrayValue(Value const &value)
void writeWithIndent(std::string const &value)
bool isMultineArray(Value const &value)
UInt size() const
Number of values in array or object.
char const * asCString() const
Members getMemberNames() const
Return a list of the member names.
Abstract class for writers.
virtual std::string write(Value const &root)=0
void write_string(Write const &write, std::string const &s)
void write_value(Write const &write, Value const &value)
JSON (JavaScript Object Notation).
void stream(Json::Value const &jv, Write const &write)
Stream compact JSON to the specified function.
std::string valueToString(Int value)
std::string valueToQuotedString(char const *value)
@ stringValue
UTF-8 string value.
@ arrayValue
array value (ordered list)
@ intValue
signed integer value
@ objectValue
object value (collection of name/value pairs).
@ uintValue
unsigned integer value
std::ostream & operator<<(std::ostream &, Value const &root)
Output using the StyledStreamWriter.