Public Member Functions | Private Types | Private Member Functions | Static 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.h>

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

Public Member Functions

 StyledWriter ()
 
virtual std::string write (const Value &root)
 Serialize a Value in JSON format. More...
 
virtual ~StyledWriter ()
 
- 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 1732 of file json.h.

Member Typedef Documentation

◆ ChildValues

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

Definition at line 1759 of file json.h.

Constructor & Destructor Documentation

◆ StyledWriter()

Json::StyledWriter::StyledWriter ( )

Definition at line 3661 of file jsoncpp.cpp.

◆ ~StyledWriter()

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

Definition at line 1736 of file json.h.

Member Function Documentation

◆ hasCommentForValue()

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

Definition at line 3901 of file jsoncpp.cpp.

◆ indent()

void Json::StyledWriter::indent ( )
private

Definition at line 3861 of file jsoncpp.cpp.

◆ isMultineArray()

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

Definition at line 3797 of file jsoncpp.cpp.

◆ normalizeEOL()

std::string Json::StyledWriter::normalizeEOL ( const std::string &  text)
staticprivate

Definition at line 3910 of file jsoncpp.cpp.

◆ pushValue()

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

Definition at line 3828 of file jsoncpp.cpp.

◆ unindent()

void Json::StyledWriter::unindent ( )
private

Definition at line 3868 of file jsoncpp.cpp.

◆ write()

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

Serialize a Value in JSON format.

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

Implements Json::Writer.

Definition at line 3669 of file jsoncpp.cpp.

◆ writeArrayValue()

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

Definition at line 3744 of file jsoncpp.cpp.

◆ writeCommentAfterValueOnSameLine()

void Json::StyledWriter::writeCommentAfterValueOnSameLine ( const Value root)
private

Definition at line 3886 of file jsoncpp.cpp.

◆ writeCommentBeforeValue()

void Json::StyledWriter::writeCommentBeforeValue ( const Value root)
private

Definition at line 3876 of file jsoncpp.cpp.

◆ writeIndent()

void Json::StyledWriter::writeIndent ( )
private

Definition at line 3838 of file jsoncpp.cpp.

◆ writeValue()

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

Definition at line 3683 of file jsoncpp.cpp.

◆ writeWithIndent()

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

Definition at line 3853 of file jsoncpp.cpp.

Member Data Documentation

◆ addChildValues_

bool Json::StyledWriter::addChildValues_
private

Definition at line 1766 of file json.h.

◆ childValues_

ChildValues Json::StyledWriter::childValues_
private

Definition at line 1761 of file json.h.

◆ document_

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

Definition at line 1762 of file json.h.

◆ indentSize_

int Json::StyledWriter::indentSize_
private

Definition at line 1765 of file json.h.

◆ indentString_

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

Definition at line 1763 of file json.h.

◆ rightMargin_

int Json::StyledWriter::rightMargin_
private

Definition at line 1764 of file json.h.


The documentation for this class was generated from the following files:


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Mon Dec 12 2022 03:20:10