6#ifndef JSON_WRITER_H_INCLUDED
7#define JSON_WRITER_H_INCLUDED
9#if !defined(JSON_IS_AMALGAMATION)
18#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) && defined(_MSC_VER)
20#pragma warning(disable : 4251)
169#pragma warning(disable : 4996)
177 void enableYAMLCompatibility();
184 void dropNullPlaceholders();
186 void omitEndingLineFeed();
192 void writeValue(
const Value& value);
195 bool yamlCompatibilityEnabled_{
false};
196 bool dropNullPlaceholders_{
false};
197 bool omitEndingLineFeed_{
false};
229#pragma warning(disable : 4996)
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);
258 using ChildValues = std::vector<String>;
260 ChildValues childValues_;
263 unsigned int rightMargin_{74};
264 unsigned int indentSize_{3};
265 bool addChildValues_{
false};
298#pragma warning(disable : 4996)
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);
332 using ChildValues = std::vector<String>;
334 ChildValues childValues_;
337 unsigned int rightMargin_{74};
339 bool addChildValues_ : 1;
346#if defined(JSON_HAS_INT64)
366#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
Outputs a Value in JSON format without formatting (not human friendly).
~FastWriter() override=default
A simple abstract factory.
virtual StreamWriter * newStreamWriter() const =0
Allocate a CharReader via operator new().
Build a StreamWriter implementation.
Json::Value settings_
Configuration of this builder.
~StreamWriterBuilder() override
virtual int write(Value const &root, OStream *sout)=0
Write Value into document as configured in sub-class.
Writes a Value in JSON format in a human friendly way, to a stream rather than to a string.
~StyledStreamWriter()=default
Writes a Value in JSON format in a human friendly way.
~StyledWriter() override=default
static constexpr UInt defaultRealPrecision
Default precision for real value for string representation.
Abstract class for writers.
virtual String write(const Value &root)=0
#define JSON_API
If defined, indicates that the source file is amalgamated to prevent private header inclusion.
JSON (JavaScript Object Notation).
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
String writeString(StreamWriter::Factory const &factory, Value const &root)
Write into stringstream, then return string, for convenience.
String valueToQuotedString(const char *value)
String valueToString(Int value)
OStream & operator<<(OStream &, const Value &root)
Output using the StyledStreamWriter.
PrecisionType
Type of precision for formatting of real values.
@ significantDigits
we set max number of significant digits in string