6 #ifndef JSON_WRITER_H_INCLUDED
7 # define JSON_WRITER_H_INCLUDED
9 #if !defined(JSON_IS_AMALGAMATION)
11 #endif // if !defined(JSON_IS_AMALGAMATION)
27 virtual std::string write(
const Value &root ) = 0;
42 void enableYAMLCompatibility();
45 virtual std::string write(
const Value &root );
48 void writeValue(
const Value &value );
50 std::string document_;
51 bool yamlCompatiblityEnabled_;
83 virtual std::string write(
const Value &root );
86 void writeValue(
const Value &value );
87 void writeArrayValue(
const Value &value );
88 bool isMultineArray(
const Value &value );
89 void pushValue(
const std::string &value );
91 void writeWithIndent(
const std::string &value );
94 void writeCommentBeforeValue(
const Value &root );
95 void writeCommentAfterValueOnSameLine(
const Value &root );
96 bool hasCommentForValue(
const Value &value );
97 static std::string normalizeEOL(
const std::string &text );
99 typedef std::vector<std::string> ChildValues;
101 ChildValues childValues_;
102 std::string document_;
103 std::string indentString_;
106 bool addChildValues_;
141 void write( std::ostream &out,
const Value &root );
144 void writeValue(
const Value &value );
145 void writeArrayValue(
const Value &value );
146 bool isMultineArray(
const Value &value );
147 void pushValue(
const std::string &value );
149 void writeWithIndent(
const std::string &value );
152 void writeCommentBeforeValue(
const Value &root );
153 void writeCommentAfterValueOnSameLine(
const Value &root );
154 bool hasCommentForValue(
const Value &value );
155 static std::string normalizeEOL(
const std::string &text );
157 typedef std::vector<std::string> ChildValues;
159 ChildValues childValues_;
160 std::ostream* document_;
161 std::string indentString_;
163 std::string indentation_;
164 bool addChildValues_;
167 # if defined(JSON_HAS_INT64)
170 # endif // if defined(JSON_HAS_INT64)
179 std::ostream&
operator<<( std::ostream&,
const Value &root );
185 #endif // JSON_WRITER_H_INCLUDED
Outputs a Value in JSON format without formatting (not human friendly).
Writes a Value in JSON format in a human friendly way.
#define JSON_API
If defined, indicates that the source file is amalgated to prevent private header inclusion...
std::string valueToQuotedString(const char *value)
std::string valueToString(Int value)
JSON (JavaScript Object Notation).
Abstract class for writers.
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string...
std::ostream & operator<<(std::ostream &, const Value &root)
Output using the StyledStreamWriter.