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) && defined(_MSC_VER) 20 #pragma warning(disable : 4251) 21 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 55 virtual int write(
Value const& root, OStream* sout) = 0;
138 Value& operator[](
const String& key);
155 virtual String write(
const Value& root) = 0;
167 #if defined(_MSC_VER) 168 #pragma warning(push) 169 #pragma warning(disable : 4996) // Deriving from deprecated class 177 void enableYAMLCompatibility();
184 void dropNullPlaceholders();
186 void omitEndingLineFeed();
189 String write(
const Value& root)
override;
192 void writeValue(
const Value& value);
195 bool yamlCompatibilityEnabled_{
false};
196 bool dropNullPlaceholders_{
false};
197 bool omitEndingLineFeed_{
false};
199 #if defined(_MSC_VER) 227 #if defined(_MSC_VER) 228 #pragma warning(push) 229 #pragma warning(disable : 4996) // Deriving from deprecated class 242 String write(
const Value& root)
override;
245 void writeValue(
const Value& value);
246 void writeArrayValue(
const Value& value);
247 bool isMultilineArray(
const Value& value);
248 void pushValue(
const String& value);
250 void writeWithIndent(
const String& value);
253 void writeCommentBeforeValue(
const Value& root);
254 void writeCommentAfterValueOnSameLine(
const Value& root);
255 static bool hasCommentForValue(
const Value& value);
256 static String normalizeEOL(
const String& text);
258 using ChildValues = std::vector<String>;
260 ChildValues childValues_;
262 String indentString_;
263 unsigned int rightMargin_{74};
264 unsigned int indentSize_{3};
265 bool addChildValues_{
false};
267 #if defined(_MSC_VER) 296 #if defined(_MSC_VER) 297 #pragma warning(push) 298 #pragma warning(disable : 4996) // Deriving from deprecated class 316 void write(OStream& out,
const Value& root);
319 void writeValue(
const Value& value);
320 void writeArrayValue(
const Value& value);
321 bool isMultilineArray(
const Value& value);
322 void pushValue(
const String& value);
324 void writeWithIndent(
const String& value);
327 void writeCommentBeforeValue(
const Value& root);
328 void writeCommentAfterValueOnSameLine(
const Value& root);
329 static bool hasCommentForValue(
const Value& value);
330 static String normalizeEOL(
const String& text);
332 using ChildValues = std::vector<String>;
334 ChildValues childValues_;
336 String indentString_;
337 unsigned int rightMargin_{74};
339 bool addChildValues_ : 1;
342 #if defined(_MSC_VER) 346 #if defined(JSON_HAS_INT64) 347 String JSON_API valueToString(Int value);
348 String JSON_API valueToString(UInt value);
349 #endif // if defined(JSON_HAS_INT64) 350 String JSON_API valueToString(LargestInt value);
351 String JSON_API valueToString(LargestUInt value);
352 String JSON_API valueToString(
354 PrecisionType precisionType = PrecisionType::significantDigits);
355 String JSON_API valueToString(
bool value);
356 String JSON_API valueToQuotedString(
const char* value);
366 #if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 368 #endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) 370 #endif // JSON_WRITER_H_INCLUDED JSON_API OStream & operator<<(OStream &, const Value &root)
Output using the StyledStreamWriter.
String JSON_API writeString(StreamWriter::Factory const &factory, Value const &root)
Write into stringstream, then return string, for convenience.
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string...
Definition: writer.h:300
Represents a JSON value.
Definition: value.h:194
Json::Value settings_
Configuration of this builder.
Definition: writer.h:122
Usage:
Definition: writer.h:42
Outputs a Value in JSON format without formatting (not human friendly).
Definition: writer.h:171
PrecisionType
Type of precision for formatting of real values.
Definition: value.h:129
Abstract class for writers.
Definition: writer.h:151
JSON (JavaScript Object Notation).
Definition: allocator.h:15
static constexpr UInt defaultRealPrecision
Default precision for real value for string representation.
Definition: value.h:247
A simple abstract factory.
Definition: writer.h:59
Build a StreamWriter implementation.
Definition: writer.h:90
Writes a Value in JSON format in a human friendly way.
Definition: writer.h:231