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) 17 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 19 #pragma warning(disable : 4251) 20 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 32 virtual std::string write(
const Value &root) = 0;
48 void enableYAMLCompatibility();
55 void dropNullPlaceholders();
58 virtual std::string write(
const Value &root);
61 void writeValue(
const Value &value);
63 std::string document_;
64 bool yamlCompatiblityEnabled_;
65 bool dropNullPlaceholders_;
101 virtual std::string write(
const Value &root);
104 void writeValue(
const Value &value);
105 void writeArrayValue(
const Value &value);
106 bool isMultineArray(
const Value &value);
107 void pushValue(
const std::string &value);
109 void writeWithIndent(
const std::string &value);
112 void writeCommentBeforeValue(
const Value &root);
113 void writeCommentAfterValueOnSameLine(
const Value &root);
114 bool hasCommentForValue(
const Value &value);
115 static std::string normalizeEOL(
const std::string &text);
117 typedef std::vector<std::string> ChildValues;
119 ChildValues childValues_;
120 std::string document_;
121 std::string indentString_;
124 bool addChildValues_;
164 void write(std::ostream &out,
const Value &root);
167 void writeValue(
const Value &value);
168 void writeArrayValue(
const Value &value);
169 bool isMultineArray(
const Value &value);
170 void pushValue(
const std::string &value);
172 void writeWithIndent(
const std::string &value);
175 void writeCommentBeforeValue(
const Value &root);
176 void writeCommentAfterValueOnSameLine(
const Value &root);
177 bool hasCommentForValue(
const Value &value);
178 static std::string normalizeEOL(
const std::string &text);
180 typedef std::vector<std::string> ChildValues;
182 ChildValues childValues_;
183 std::ostream *document_;
184 std::string indentString_;
186 std::string indentation_;
187 bool addChildValues_;
190 #if defined(JSON_HAS_INT64) 193 #endif // if defined(JSON_HAS_INT64) 206 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 208 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 210 #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.