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

Writes a Value in JSON format in a human friendly way, to a stream rather than to a string. More...

#include <json.h>

Public Member Functions

 StyledStreamWriter (std::string indentation="\t")
 
void write (std::ostream &out, const Value &root)
 Serialize a Value in JSON format. More...
 
 ~StyledStreamWriter ()
 

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_: 1
 
ChildValues childValues_
 
std::ostream * document_
 
std::string indentation_
 
bool indented_: 1
 
std::string indentString_
 
int rightMargin_
 

Detailed Description

Writes a Value in JSON format in a human friendly way, to a stream rather than to a string.

The rules for line break and indent are as follow:

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

Parameters
indentationEach level will be indented by this amount extra.
See Also
Reader, Value, Value::setComment()
Deprecated:
Use StreamWriterBuilder.

Definition at line 1880 of file json.h.

Member Typedef Documentation

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

Definition at line 1908 of file json.h.

Constructor & Destructor Documentation

Json::StyledStreamWriter::StyledStreamWriter ( std::string  indentation = "\t")

Definition at line 4517 of file jsoncpp.cpp.

Json::StyledStreamWriter::~StyledStreamWriter ( )
inline

Definition at line 1883 of file json.h.

Member Function Documentation

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

Definition at line 4724 of file jsoncpp.cpp.

void Json::StyledStreamWriter::indent ( )
private

Definition at line 4688 of file jsoncpp.cpp.

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

Definition at line 4639 of file jsoncpp.cpp.

static std::string Json::StyledStreamWriter::normalizeEOL ( const std::string &  text)
staticprivate
void Json::StyledStreamWriter::pushValue ( const std::string &  value)
private

Definition at line 4667 of file jsoncpp.cpp.

void Json::StyledStreamWriter::unindent ( )
private

Definition at line 4690 of file jsoncpp.cpp.

void Json::StyledStreamWriter::write ( std::ostream &  out,
const Value root 
)

Serialize a Value in JSON format.

Parameters
outStream to write to. (Can be ostringstream, e.g.)
rootValue to serialize.
Note
There is no point in deriving from Writer, since write() should not return a value.

Definition at line 4521 of file jsoncpp.cpp.

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

Definition at line 4594 of file jsoncpp.cpp.

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

Definition at line 4713 of file jsoncpp.cpp.

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

Definition at line 4695 of file jsoncpp.cpp.

void Json::StyledStreamWriter::writeIndent ( )
private

Definition at line 4674 of file jsoncpp.cpp.

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

Definition at line 4535 of file jsoncpp.cpp.

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

Definition at line 4682 of file jsoncpp.cpp.

Member Data Documentation

bool Json::StyledStreamWriter::addChildValues_
private

Definition at line 1915 of file json.h.

ChildValues Json::StyledStreamWriter::childValues_
private

Definition at line 1910 of file json.h.

std::ostream* Json::StyledStreamWriter::document_
private

Definition at line 1911 of file json.h.

std::string Json::StyledStreamWriter::indentation_
private

Definition at line 1914 of file json.h.

bool Json::StyledStreamWriter::indented_
private

Definition at line 1916 of file json.h.

std::string Json::StyledStreamWriter::indentString_
private

Definition at line 1912 of file json.h.

int Json::StyledStreamWriter::rightMargin_
private

Definition at line 1913 of file json.h.


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


mission_planning
Author(s): ivan
autogenerated on Thu Nov 12 2015 19:08:20