CMS 3D CMS Logo

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

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

#include <writer.h>

Inheritance diagram for Json::StyledWriter:
Json::Writer

Public Member Functions

 StyledWriter ()
 
std::string write (const Value &root) override
 Serialize a Value in JSON format. More...
 
 ~StyledWriter () override
 
- Public Member Functions inherited from Json::Writer
virtual ~Writer ()
 

Private Types

typedef std::vector< std::string > ChildValues
 

Private Member Functions

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

Static Private Member Functions

static std::string normalizeEOL (const std::string &text)
 

Private Attributes

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

Detailed Description

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

The rules for line break and indent are as follow:

If the Value have comments then they are outputed according to their CommentPlacement.

See also
Reader, Value, Value::setComment()

Definition at line 65 of file writer.h.

Member Typedef Documentation

typedef std::vector<std::string> Json::StyledWriter::ChildValues
private

Definition at line 92 of file writer.h.

Constructor & Destructor Documentation

Json::StyledWriter::StyledWriter ( )
Json::StyledWriter::~StyledWriter ( )
inlineoverride

Member Function Documentation

bool Json::StyledWriter::hasCommentForValue ( const Value value)
private
void Json::StyledWriter::indent ( )
private
bool Json::StyledWriter::isMultineArray ( const Value value)
private
static std::string Json::StyledWriter::normalizeEOL ( const std::string &  text)
staticprivate
void Json::StyledWriter::pushValue ( const std::string &  value)
private
void Json::StyledWriter::unindent ( )
private
std::string Json::StyledWriter::write ( const Value root)
overridevirtual
void Json::StyledWriter::writeArrayValue ( const Value value)
private
void Json::StyledWriter::writeCommentAfterValueOnSameLine ( const Value root)
private
void Json::StyledWriter::writeCommentBeforeValue ( const Value root)
private
void Json::StyledWriter::writeIndent ( )
private
void Json::StyledWriter::writeValue ( const Value value)
private
void Json::StyledWriter::writeWithIndent ( const std::string &  value)
private

Member Data Documentation

bool Json::StyledWriter::addChildValues_
private

Definition at line 99 of file writer.h.

ChildValues Json::StyledWriter::childValues_
private

Definition at line 94 of file writer.h.

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

Definition at line 95 of file writer.h.

int Json::StyledWriter::indentSize_
private

Definition at line 98 of file writer.h.

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

Definition at line 96 of file writer.h.

int Json::StyledWriter::rightMargin_
private

Definition at line 97 of file writer.h.