#if !defined(JSON_IS_AMALGAMATION)
#include "json_tool.h"
#include <json/writer.h>
#endif
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <memory>
#include <set>
#include <sstream>
#include <utility>
#if __cplusplus >= 201103L
#include <cmath>
#include <cstdio>
#if !defined(isnan)
#define isnan …
#endif
#if !defined(isfinite)
#define isfinite …
#endif
#else
#include <cmath>
#include <cstdio>
#if defined(_MSC_VER)
#if !defined(isnan)
#include <float.h>
#define isnan …
#endif
#if !defined(isfinite)
#include <float.h>
#define isfinite …
#endif
#if !defined(_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES …
#endif
#endif
#if defined(__sun) && defined(__SVR4)
#if !defined(isfinite)
#include <ieeefp.h>
#define isfinite …
#endif
#endif
#if defined(__hpux)
#if !defined(isfinite)
#if defined(__ia64) && !defined(finite)
#define isfinite …
#endif
#endif
#endif
#if !defined(isnan)
#define isnan …
#endif
#if !defined(__APPLE__)
#if !defined(isfinite)
#define isfinite …
#endif
#endif
#endif
#if defined(_MSC_VER)
#pragma warning(disable : 4996)
#endif
namespace Json {
#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520)
StreamWriterPtr;
#else
using StreamWriterPtr = std::auto_ptr<StreamWriter>;
#endif
String valueToString(LargestInt value) { … }
String valueToString(LargestUInt value) { … }
#if defined(JSON_HAS_INT64)
String valueToString(Int value) { … }
String valueToString(UInt value) { … }
#endif
namespace {
String valueToString(double value, bool useSpecialFloats,
unsigned int precision, PrecisionType precisionType) { … }
}
String valueToString(double value, unsigned int precision,
PrecisionType precisionType) { … }
String valueToString(bool value) { … }
static bool doesAnyCharRequireEscaping(char const* s, size_t n) { … }
static unsigned int utf8ToCodepoint(const char*& s, const char* e) { … }
static const char hex2[] = …;
static String toHex16Bit(unsigned int x) { … }
static void appendRaw(String& result, unsigned ch) { … }
static void appendHex(String& result, unsigned ch) { … }
static String valueToQuotedStringN(const char* value, size_t length,
bool emitUTF8 = false) { … }
String valueToQuotedString(const char* value) { … }
Writer::~Writer() = default;
FastWriter::FastWriter()
= default;
void FastWriter::enableYAMLCompatibility() { … }
void FastWriter::dropNullPlaceholders() { … }
void FastWriter::omitEndingLineFeed() { … }
String FastWriter::write(const Value& root) { … }
void FastWriter::writeValue(const Value& value) { … }
StyledWriter::StyledWriter() = default;
String StyledWriter::write(const Value& root) { … }
void StyledWriter::writeValue(const Value& value) { … }
void StyledWriter::writeArrayValue(const Value& value) { … }
bool StyledWriter::isMultilineArray(const Value& value) { … }
void StyledWriter::pushValue(const String& value) { … }
void StyledWriter::writeIndent() { … }
void StyledWriter::writeWithIndent(const String& value) { … }
void StyledWriter::indent() { … }
void StyledWriter::unindent() { … }
void StyledWriter::writeCommentBeforeValue(const Value& root) { … }
void StyledWriter::writeCommentAfterValueOnSameLine(const Value& root) { … }
bool StyledWriter::hasCommentForValue(const Value& value) { … }
StyledStreamWriter::StyledStreamWriter(String indentation)
: … { … }
void StyledStreamWriter::write(OStream& out, const Value& root) { … }
void StyledStreamWriter::writeValue(const Value& value) { … }
void StyledStreamWriter::writeArrayValue(const Value& value) { … }
bool StyledStreamWriter::isMultilineArray(const Value& value) { … }
void StyledStreamWriter::pushValue(const String& value) { … }
void StyledStreamWriter::writeIndent() { … }
void StyledStreamWriter::writeWithIndent(const String& value) { … }
void StyledStreamWriter::indent() { … }
void StyledStreamWriter::unindent() { … }
void StyledStreamWriter::writeCommentBeforeValue(const Value& root) { … }
void StyledStreamWriter::writeCommentAfterValueOnSameLine(const Value& root) { … }
bool StyledStreamWriter::hasCommentForValue(const Value& value) { … }
struct CommentStyle { … };
struct BuiltStyledStreamWriter : public StreamWriter { … };
BuiltStyledStreamWriter::BuiltStyledStreamWriter(
String indentation, CommentStyle::Enum cs, String colonSymbol,
String nullSymbol, String endingLineFeedSymbol, bool useSpecialFloats,
bool emitUTF8, unsigned int precision, PrecisionType precisionType)
: … { … }
int BuiltStyledStreamWriter::write(Value const& root, OStream* sout) { … }
void BuiltStyledStreamWriter::writeValue(Value const& value) { … }
void BuiltStyledStreamWriter::writeArrayValue(Value const& value) { … }
bool BuiltStyledStreamWriter::isMultilineArray(Value const& value) { … }
void BuiltStyledStreamWriter::pushValue(String const& value) { … }
void BuiltStyledStreamWriter::writeIndent() { … }
void BuiltStyledStreamWriter::writeWithIndent(String const& value) { … }
void BuiltStyledStreamWriter::indent() { … }
void BuiltStyledStreamWriter::unindent() { … }
void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) { … }
void BuiltStyledStreamWriter::writeCommentAfterValueOnSameLine(
Value const& root) { … }
bool BuiltStyledStreamWriter::hasCommentForValue(const Value& value) { … }
StreamWriter::StreamWriter() : … { … }
StreamWriter::~StreamWriter() = default;
StreamWriter::Factory::~Factory() = default;
StreamWriterBuilder::StreamWriterBuilder() { … }
StreamWriterBuilder::~StreamWriterBuilder() = default;
StreamWriter* StreamWriterBuilder::newStreamWriter() const { … }
bool StreamWriterBuilder::validate(Json::Value* invalid) const { … }
Value& StreamWriterBuilder::operator[](const String& key) { … }
void StreamWriterBuilder::setDefaults(Json::Value* settings) { … }
String writeString(StreamWriter::Factory const& factory, Value const& root) { … }
OStream& operator<<(OStream& sout, Value const& root) { … }
}