rippled
Loading...
Searching...
No Matches
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...

#include <json_writer.h>

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 (Value const &root) override
 Serialize a Value in JSON format.
 

Private Types

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

Private Member Functions

void writeValue (Value const &value)
 
void writeArrayValue (Value const &value)
 
bool isMultineArray (Value const &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 90 of file json_writer.h.

Member Typedef Documentation

◆ ChildValues

Definition at line 124 of file json_writer.h.

Constructor & Destructor Documentation

◆ StyledWriter()

Json::StyledWriter::StyledWriter ( )

Definition at line 279 of file json_writer.cpp.

◆ ~StyledWriter()

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

Definition at line 94 of file json_writer.h.

Member Function Documentation

◆ write()

std::string Json::StyledWriter::write ( Value const &  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 284 of file json_writer.cpp.

◆ writeValue()

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

Definition at line 295 of file json_writer.cpp.

◆ writeArrayValue()

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

Definition at line 361 of file json_writer.cpp.

◆ isMultineArray()

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

Definition at line 420 of file json_writer.cpp.

◆ pushValue()

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

Definition at line 454 of file json_writer.cpp.

◆ writeIndent()

void Json::StyledWriter::writeIndent ( )
private

Definition at line 463 of file json_writer.cpp.

◆ writeWithIndent()

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

Definition at line 480 of file json_writer.cpp.

◆ indent()

void Json::StyledWriter::indent ( )
private

Definition at line 487 of file json_writer.cpp.

◆ unindent()

void Json::StyledWriter::unindent ( )
private

Definition at line 493 of file json_writer.cpp.

Member Data Documentation

◆ childValues_

ChildValues Json::StyledWriter::childValues_
private

Definition at line 126 of file json_writer.h.

◆ document_

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

Definition at line 127 of file json_writer.h.

◆ indentString_

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

Definition at line 128 of file json_writer.h.

◆ rightMargin_

int Json::StyledWriter::rightMargin_
private

Definition at line 129 of file json_writer.h.

◆ indentSize_

int Json::StyledWriter::indentSize_
private

Definition at line 130 of file json_writer.h.

◆ addChildValues_

bool Json::StyledWriter::addChildValues_
private

Definition at line 131 of file json_writer.h.