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)
166#pragma warning(disable : 4996)
172 ~FastWriter()
override =
default;
174 void enableYAMLCompatibility();
181 void dropNullPlaceholders();
183 void omitEndingLineFeed();
186 String write(
const Value& root)
override;
189 void writeValue(
const Value& value);
192 bool yamlCompatibilityEnabled_{
false};
193 bool dropNullPlaceholders_{
false};
194 bool omitEndingLineFeed_{
false};
226#pragma warning(disable : 4996)
229 StyledWriter :
public Writer {
232 ~StyledWriter()
override =
default;
239 String write(
const Value& root)
override;
242 void writeValue(
const Value& value);
243 void writeArrayValue(
const Value& value);
244 bool isMultilineArray(
const Value& value);
245 void pushValue(
const String& value);
247 void writeWithIndent(
const String& value);
250 void writeCommentBeforeValue(
const Value& root);
251 void writeCommentAfterValueOnSameLine(
const Value& root);
252 static bool hasCommentForValue(
const Value& value);
255 using ChildValues = std::vector<String>;
257 ChildValues childValues_;
260 unsigned int rightMargin_{74};
261 unsigned int indentSize_{3};
262 bool addChildValues_{
false};
295#pragma warning(disable : 4996)
303 StyledStreamWriter(
String indentation =
"\t");
304 ~StyledStreamWriter() =
default;
313 void write(
OStream& out,
const Value& root);
316 void writeValue(
const Value& value);
317 void writeArrayValue(
const Value& value);
318 bool isMultilineArray(
const Value& value);
319 void pushValue(
const String& value);
321 void writeWithIndent(
const String& value);
324 void writeCommentBeforeValue(
const Value& root);
325 void writeCommentAfterValueOnSameLine(
const Value& root);
326 static bool hasCommentForValue(
const Value& value);
329 using ChildValues = std::vector<String>;
331 ChildValues childValues_;
334 unsigned int rightMargin_{74};
336 bool addChildValues_ : 1;
343#if defined(JSON_HAS_INT64)
363#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING)
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.
static constexpr UInt defaultRealPrecision
Default precision for real value for string representation.
#define JSON_API
If defined, indicates that the source file is amalgamated to prevent private header inclusion.
#define JSONCPP_DEPRECATED(message)
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