rippled
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Json::StyledWriter Class Reference

Writes a Value in JSON format in a human friendly way. More...

Inheritance diagram for Json::StyledWriter:
Inheritance graph
[legend]
Collaboration diagram for Json::StyledWriter:
Collaboration graph
[legend]

Public Member Functions

 StyledWriter ()
 
virtual ~StyledWriter ()
 
std::string write (const Value &root) override
 Serialize a Value in JSON format. More...
 

Private Types

using ChildValues = std::vector< std::string >
 

Private Member Functions

void writeValue (const Value &value)
 
void writeArrayValue (const Value &value)
 
bool isMultineArray (const Value &value)
 
void pushValue (std::string const &value)
 
void writeIndent ()
 
void writeWithIndent (std::string const &value)
 
void indent ()
 
void unindent ()
 

Private Attributes

ChildValues childValues_
 
std::string document_
 
std::string indentString_
 
int rightMargin_
 
int indentSize_
 
bool addChildValues_
 

Detailed Description

Writes a Value in JSON format in a human friendly way.

The rules for line break and indent are as follow:

See also
Reader, Value

Definition at line 89 of file json_writer.h.

Member Typedef Documentation

◆ ChildValues

Definition at line 123 of file json_writer.h.

Constructor & Destructor Documentation

◆ StyledWriter()

Json::StyledWriter::StyledWriter ( )

Definition at line 272 of file json_writer.cpp.

◆ ~StyledWriter()

virtual Json::StyledWriter::~StyledWriter ( )
virtual

Definition at line 93 of file json_writer.h.

Member Function Documentation

◆ write()

std::string Json::StyledWriter::write ( const Value root)
overridevirtual

Serialize a Value in JSON format.

Parameters
rootValue to serialize.
Returns
String containing the JSON document that represents the root value.

Implements Json::WriterBase.

Definition at line 277 of file json_writer.cpp.

◆ writeValue()

void Json::StyledWriter::writeValue ( const Value value)
private

Definition at line 288 of file json_writer.cpp.

◆ writeArrayValue()

void Json::StyledWriter::writeArrayValue ( const Value value)
private

Definition at line 354 of file json_writer.cpp.

◆ isMultineArray()

bool Json::StyledWriter::isMultineArray ( const Value value)
private

Definition at line 411 of file json_writer.cpp.

◆ pushValue()

void Json::StyledWriter::pushValue ( std::string const &  value)
private

Definition at line 445 of file json_writer.cpp.

◆ writeIndent()

void Json::StyledWriter::writeIndent ( )
private

Definition at line 454 of file json_writer.cpp.

◆ writeWithIndent()

void Json::StyledWriter::writeWithIndent ( std::string const &  value)
private

Definition at line 471 of file json_writer.cpp.

◆ indent()

void Json::StyledWriter::indent ( )
private

Definition at line 478 of file json_writer.cpp.

◆ unindent()

void Json::StyledWriter::unindent ( )
private

Definition at line 484 of file json_writer.cpp.

Member Data Documentation

◆ childValues_

ChildValues Json::StyledWriter::childValues_
private

Definition at line 125 of file json_writer.h.

◆ document_

std::string Json::StyledWriter::document_
private

Definition at line 126 of file json_writer.h.

◆ indentString_

std::string Json::StyledWriter::indentString_
private

Definition at line 127 of file json_writer.h.

◆ rightMargin_

int Json::StyledWriter::rightMargin_
private

Definition at line 128 of file json_writer.h.

◆ indentSize_

int Json::StyledWriter::indentSize_
private

Definition at line 129 of file json_writer.h.

◆ addChildValues_

bool Json::StyledWriter::addChildValues_
private

Definition at line 130 of file json_writer.h.