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) 18 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 20 #pragma warning(disable : 4251) 21 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 52 virtual int write(
Value const& root, std::ostream* sout) = 0;
124 Value& operator[](std::string key);
141 virtual std::string write(
const Value& root) = 0;
159 void enableYAMLCompatibility();
162 virtual std::string write(
const Value& root);
165 void writeValue(
const Value& value);
167 std::string document_;
168 bool yamlCompatiblityEnabled_;
205 virtual std::string write(
const Value& root);
208 void writeValue(
const Value& value);
209 void writeArrayValue(
const Value& value);
210 bool isMultineArray(
const Value& value);
211 void pushValue(
const std::string& value);
213 void writeWithIndent(
const std::string& value);
216 void writeCommentBeforeValue(
const Value& root);
217 void writeCommentAfterValueOnSameLine(
const Value& root);
218 bool hasCommentForValue(
const Value& value);
219 static std::string
normalizeEOL(
const std::string& text);
221 typedef std::vector<std::string> ChildValues;
223 ChildValues childValues_;
224 std::string document_;
225 std::string indentString_;
228 bool addChildValues_;
269 void write(std::ostream& out,
const Value& root);
272 void writeValue(
const Value& value);
273 void writeArrayValue(
const Value& value);
274 bool isMultineArray(
const Value& value);
275 void pushValue(
const std::string& value);
277 void writeWithIndent(
const std::string& value);
280 void writeCommentBeforeValue(
const Value& root);
281 void writeCommentAfterValueOnSameLine(
const Value& root);
282 bool hasCommentForValue(
const Value& value);
283 static std::string
normalizeEOL(
const std::string& text);
285 typedef std::vector<std::string> ChildValues;
287 ChildValues childValues_;
288 std::ostream* document_;
289 std::string indentString_;
291 std::string indentation_;
292 bool addChildValues_ : 1;
296 #if defined(JSON_HAS_INT64) 299 #endif // if defined(JSON_HAS_INT64) 312 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 314 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 316 #endif // JSON_WRITER_H_INCLUDED Outputs a Value in JSON format without formatting (not human friendly).
A simple abstract factory.
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::ostream & operator<<(std::ostream &, const Value &root)
Output using the StyledStreamWriter.
std::string valueToQuotedString(const char *value)
std::string valueToString(Int value)
JSON (JavaScript Object Notation).
Json::Value settings_
Configuration of this builder.
Abstract class for writers.
static std::string normalizeEOL(Reader::Location begin, Reader::Location end)
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string...
std::string writeString(StreamWriter::Factory const &factory, Value const &root)
Write into stringstream, then return string, for convenience.
Build a StreamWriter implementation.