Writes a Value in JSON format in a human friendly way. More...
#include <writer.h>
Public Member Functions | |
StyledWriter () | |
virtual std::string | write (const Value &root) |
Serialize a Value in JSON format. | |
virtual | ~StyledWriter () |
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_ |
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.
typedef std::vector<std::string> Json::StyledWriter::ChildValues [private] |
Definition at line 269 of file json_writer.cpp.
virtual Json::StyledWriter::~StyledWriter | ( | ) | [inline, virtual] |
bool Json::StyledWriter::hasCommentForValue | ( | const Value & | value | ) | [private] |
Definition at line 509 of file json_writer.cpp.
void Json::StyledWriter::indent | ( | ) | [private] |
Definition at line 469 of file json_writer.cpp.
bool Json::StyledWriter::isMultineArray | ( | const Value & | value | ) | [private] |
Definition at line 405 of file json_writer.cpp.
std::string Json::StyledWriter::normalizeEOL | ( | const std::string & | text | ) | [static, private] |
Definition at line 518 of file json_writer.cpp.
void Json::StyledWriter::pushValue | ( | const std::string & | value | ) | [private] |
Definition at line 436 of file json_writer.cpp.
void Json::StyledWriter::unindent | ( | ) | [private] |
Definition at line 476 of file json_writer.cpp.
std::string Json::StyledWriter::write | ( | const Value & | root | ) | [virtual] |
Serialize a Value in JSON format.
root | Value to serialize. |
Implements Json::Writer.
Definition at line 277 of file json_writer.cpp.
void Json::StyledWriter::writeArrayValue | ( | const Value & | value | ) | [private] |
Definition at line 352 of file json_writer.cpp.
void Json::StyledWriter::writeCommentAfterValueOnSameLine | ( | const Value & | root | ) | [private] |
Definition at line 494 of file json_writer.cpp.
void Json::StyledWriter::writeCommentBeforeValue | ( | const Value & | root | ) | [private] |
Definition at line 484 of file json_writer.cpp.
void Json::StyledWriter::writeIndent | ( | ) | [private] |
Definition at line 446 of file json_writer.cpp.
void Json::StyledWriter::writeValue | ( | const Value & | value | ) | [private] |
Definition at line 291 of file json_writer.cpp.
void Json::StyledWriter::writeWithIndent | ( | const std::string & | value | ) | [private] |
Definition at line 461 of file json_writer.cpp.
bool Json::StyledWriter::addChildValues_ [private] |
ChildValues Json::StyledWriter::childValues_ [private] |
std::string Json::StyledWriter::document_ [private] |
int Json::StyledWriter::indentSize_ [private] |
std::string Json::StyledWriter::indentString_ [private] |
int Json::StyledWriter::rightMargin_ [private] |