Writes a Value in JSON format in a human friendly way, to a stream rather than to a string. More...
#include <writer.h>
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_ |
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.
indentation | Each level will be indented by this amount extra. |
typedef std::vector<std::string> Json::StyledStreamWriter::ChildValues [private] |
Json::StyledStreamWriter::StyledStreamWriter | ( | std::string | indentation = "\t" | ) |
Definition at line 544 of file json_writer.cpp.
Json::StyledStreamWriter::~StyledStreamWriter | ( | ) | [inline] |
bool Json::StyledStreamWriter::hasCommentForValue | ( | const Value & | value | ) | [private] |
Definition at line 789 of file json_writer.cpp.
void Json::StyledStreamWriter::indent | ( | ) | [private] |
Definition at line 749 of file json_writer.cpp.
bool Json::StyledStreamWriter::isMultineArray | ( | const Value & | value | ) | [private] |
Definition at line 681 of file json_writer.cpp.
std::string Json::StyledStreamWriter::normalizeEOL | ( | const std::string & | text | ) | [static, private] |
Definition at line 798 of file json_writer.cpp.
void Json::StyledStreamWriter::pushValue | ( | const std::string & | value | ) | [private] |
Definition at line 712 of file json_writer.cpp.
void Json::StyledStreamWriter::unindent | ( | ) | [private] |
Definition at line 756 of file json_writer.cpp.
void Json::StyledStreamWriter::write | ( | std::ostream & | out, |
const Value & | root | ||
) |
void Json::StyledStreamWriter::writeArrayValue | ( | const Value & | value | ) | [private] |
Definition at line 628 of file json_writer.cpp.
void Json::StyledStreamWriter::writeCommentAfterValueOnSameLine | ( | const Value & | root | ) | [private] |
Definition at line 774 of file json_writer.cpp.
void Json::StyledStreamWriter::writeCommentBeforeValue | ( | const Value & | root | ) | [private] |
Definition at line 764 of file json_writer.cpp.
void Json::StyledStreamWriter::writeIndent | ( | ) | [private] |
Definition at line 722 of file json_writer.cpp.
void Json::StyledStreamWriter::writeValue | ( | const Value & | value | ) | [private] |
Definition at line 567 of file json_writer.cpp.
void Json::StyledStreamWriter::writeWithIndent | ( | const std::string & | value | ) | [private] |
Definition at line 741 of file json_writer.cpp.
bool Json::StyledStreamWriter::addChildValues_ [private] |
std::ostream* Json::StyledStreamWriter::document_ [private] |
std::string Json::StyledStreamWriter::indentation_ [private] |
std::string Json::StyledStreamWriter::indentString_ [private] |
int Json::StyledStreamWriter::rightMargin_ [private] |