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)
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)
String write(const Value &root) override
void dropNullPlaceholders()
Drop the "null" string from the writer's output for nullValues.
void enableYAMLCompatibility()
~FastWriter() override=default
void omitEndingLineFeed()
A simple abstract factory.
virtual StreamWriter * newStreamWriter() const =0
Allocate a CharReader via operator new().
StreamWriter * newStreamWriter() const override
bool validate(Json::Value *invalid) const
static void setDefaults(Json::Value *settings)
Called by ctor, but you can use this to reset settings_.
Json::Value settings_
Configuration of this builder.
~StreamWriterBuilder() override
Value & operator[](const String &key)
A simple way to update a specific setting.
virtual int write(Value const &root, OStream *sout)=0
Write Value into document as configured in sub-class.
void write(OStream &out, const Value &root)
Serialize a Value in JSON format.
StyledStreamWriter(String indentation="\t")
~StyledStreamWriter()=default
~StyledWriter() override=default
String write(const Value &root) override
Serialize a Value in JSON format.
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).
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.
std::basic_string< char, std::char_traits< char >, Allocator< char > > String
@ significantDigits
we set max number of significant digits in string