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)
168#pragma warning(disable : 4996)
176 void enableYAMLCompatibility();
183 void dropNullPlaceholders();
185 void omitEndingLineFeed();
191 void writeValue(
const Value& value);
194 bool yamlCompatibilityEnabled_{
false};
195 bool dropNullPlaceholders_{
false};
196 bool omitEndingLineFeed_{
false};
228#pragma warning(disable : 4996)
244 void writeValue(
const Value& value);
245 void writeArrayValue(
const Value& value);
246 bool isMultilineArray(
const Value& value);
247 void pushValue(
const String& value);
249 void writeWithIndent(
const String& value);
252 void writeCommentBeforeValue(
const Value& root);
253 void writeCommentAfterValueOnSameLine(
const Value& root);
254 static bool hasCommentForValue(
const Value& value);
257 using ChildValues = std::vector<String>;
259 ChildValues childValues_;
262 unsigned int rightMargin_{74};
263 unsigned int indentSize_{3};
264 bool addChildValues_{
false};
297#pragma warning(disable : 4996)
318 void writeValue(
const Value& value);
319 void writeArrayValue(
const Value& value);
320 bool isMultilineArray(
const Value& value);
321 void pushValue(
const String& value);
323 void writeWithIndent(
const String& value);
326 void writeCommentBeforeValue(
const Value& root);
327 void writeCommentAfterValueOnSameLine(
const Value& root);
328 static bool hasCommentForValue(
const Value& value);
331 using ChildValues = std::vector<String>;
333 ChildValues childValues_;
336 unsigned int rightMargin_{74};
338 bool addChildValues_ : 1;
345#if defined(JSON_HAS_INT64)
365#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