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

List of all members.

Public Member Functions

 StyledStreamWriter (std::string indentation="\t")
void write (std::ostream &out, const Value &root)
 Serialize a Value in JSON format.
 ~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_
ChildValues childValues_
std::ostream * document_
std::string indentation_
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()

Definition at line 1789 of file json.h.


Member Typedef Documentation

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

Definition at line 1817 of file json.h.


Constructor & Destructor Documentation

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

Definition at line 3936 of file jsoncpp.cpp.

Definition at line 1793 of file json.h.


Member Function Documentation

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

Definition at line 4181 of file jsoncpp.cpp.

Definition at line 4141 of file jsoncpp.cpp.

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

Definition at line 4073 of file jsoncpp.cpp.

std::string Json::StyledStreamWriter::normalizeEOL ( const std::string &  text) [static, private]

Definition at line 4190 of file jsoncpp.cpp.

void Json::StyledStreamWriter::pushValue ( const std::string &  value) [private]

Definition at line 4104 of file jsoncpp.cpp.

Definition at line 4148 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 3945 of file jsoncpp.cpp.

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

Definition at line 4020 of file jsoncpp.cpp.

Definition at line 4166 of file jsoncpp.cpp.

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

Definition at line 4156 of file jsoncpp.cpp.

Definition at line 4114 of file jsoncpp.cpp.

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

Definition at line 3959 of file jsoncpp.cpp.

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

Definition at line 4133 of file jsoncpp.cpp.


Member Data Documentation

Definition at line 1824 of file json.h.

Definition at line 1819 of file json.h.

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

Definition at line 1820 of file json.h.

Definition at line 1823 of file json.h.

Definition at line 1821 of file json.h.

Definition at line 1822 of file json.h.


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


find_object_2d
Author(s): Mathieu Labbe
autogenerated on Thu Aug 27 2015 13:00:34