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();
57 void omitEndingLineFeed();
60 virtual std::string write(
const Value& root);
63 void writeValue(
const Value& value);
65 std::string document_;
66 bool yamlCompatiblityEnabled_;
67 bool dropNullPlaceholders_;
68 bool omitEndingLineFeed_;
104 virtual std::string write(
const Value& root);
107 void writeValue(
const Value& value);
108 void writeArrayValue(
const Value& value);
109 bool isMultineArray(
const Value& value);
110 void pushValue(
const std::string& value);
112 void writeWithIndent(
const std::string& value);
115 void writeCommentBeforeValue(
const Value& root);
116 void writeCommentAfterValueOnSameLine(
const Value& root);
117 bool hasCommentForValue(
const Value& value);
118 static std::string normalizeEOL(
const std::string& text);
120 typedef std::vector<std::string> ChildValues;
122 ChildValues childValues_;
123 std::string document_;
124 std::string indentString_;
127 bool addChildValues_;
167 void write(std::ostream& out,
const Value& root);
170 void writeValue(
const Value& value);
171 void writeArrayValue(
const Value& value);
172 bool isMultineArray(
const Value& value);
173 void pushValue(
const std::string& value);
175 void writeWithIndent(
const std::string& value);
178 void writeCommentBeforeValue(
const Value& root);
179 void writeCommentAfterValueOnSameLine(
const Value& root);
180 bool hasCommentForValue(
const Value& value);
181 static std::string normalizeEOL(
const std::string& text);
183 typedef std::vector<std::string> ChildValues;
185 ChildValues childValues_;
186 std::ostream* document_;
187 std::string indentString_;
189 std::string indentation_;
190 bool addChildValues_;
193 #if defined(JSON_HAS_INT64)
196 #endif // if defined(JSON_HAS_INT64)
209 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
211 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
213 #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)
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.