|
JSON writer. More...
#include <writer.h>
Classes | |
struct | Level |
Information for each nested level. More... | |
Public Types | |
typedef Encoding::Ch | Ch |
Public Member Functions | |
Writer (Stream &stream, int precision=20, Allocator *allocator=0, size_t levelDepth=kDefaultLevelDepth) | |
Writer & | Null_ () |
Writer & | Bool_ (bool b) |
Writer & | Int (int i) |
Writer & | Uint (unsigned u) |
Writer & | Int64 (int64_t i64) |
Writer & | Uint64 (uint64_t u64) |
Writer & | Double (double d) |
Writer & | LongDouble (long double d) |
Writer & | LongLong (long long d) |
Writer & | ULongLong (unsigned long long d) |
Writer & | String (const Ch *str, SizeType length, bool copy=false) |
Writer & | StartObject () |
Writer & | EndObject (SizeType memberCount=0) |
Writer & | StartArray () |
Writer & | EndArray (SizeType elementCount=0) |
Writer & | String (const Ch *str) |
Simpler but slower overload. More... | |
Protected Member Functions | |
void | WriteNull_ () |
void | WriteBool_ (bool b) |
void | WriteInt (int i) |
void | WriteUint (unsigned u) |
void | WriteInt64 (int64_t i64) |
void | WriteUint64 (uint64_t u64) |
template<class Ch > | |
std::enable_if< to_int(std::numeric_limits< Ch >::max())< to_int(256), bool >::type characterOk(Ch) { return true;} template< class Ch > typename std::enable_if< to_int(std::numeric_limits< Ch >::max()) >=to_int(256), bool >::type | characterOk (Ch c) |
void | WriteDouble (double d) |
void | WriteLongDouble (long double d) |
void | WriteLongLong (long long d) |
void | WriteULongLong (unsigned long long d) |
void | WriteString (const Ch *str, SizeType length) |
void | WriteStartObject () |
void | WriteEndObject () |
void | WriteStartArray () |
void | WriteEndArray () |
void | Prefix (Type type) |
Static Protected Member Functions | |
template<class T > | |
static constexpr int | to_int (T t) |
Protected Attributes | |
char | double_format [32] |
char | long_double_format [32] |
Stream & | stream_ |
internal::Stack< Allocator > | level_stack_ |
Static Protected Attributes | |
static const size_t | kDefaultLevelDepth = 32 |
Private Member Functions | |
Writer & | operator= (const Writer &w) |
JSON writer.
Writer implements the concept Handler. It generates JSON text by events to an output stream.
User may programmatically calls the functions of a writer to generate JSON text.
On the other side, a writer can also be passed to objects that generates events,
for example Reader::Parse() and Document::Accept().
Stream | Type of ouptut stream. |
Encoding | Encoding of both source strings and output. |
typedef Encoding::Ch rapidjson::Writer< Stream, Encoding, Allocator >::Ch |
|
inline |
|
inline |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
inlineprotected |
References rapidjson::Writer< Stream, Encoding, Allocator >::Level::inArray, rapidjson::kArrayType, rapidjson::kObjectType, rapidjson::kStringType, rapidjson::Writer< Stream, Encoding, Allocator >::level_stack_, RAPIDJSON_ASSERT, rapidjson::Writer< Stream, Encoding, Allocator >::stream_, and rapidjson::Writer< Stream, Encoding, Allocator >::Level::valueCount.
Referenced by rapidjson::Writer< Stream, Encoding, Allocator >::Bool_(), rapidjson::Writer< Stream, Encoding, Allocator >::Double(), rapidjson::Writer< Stream, Encoding, Allocator >::Int(), rapidjson::Writer< Stream, Encoding, Allocator >::Int64(), rapidjson::Writer< Stream, Encoding, Allocator >::LongDouble(), rapidjson::Writer< Stream, Encoding, Allocator >::LongLong(), rapidjson::Writer< Stream, Encoding, Allocator >::Null_(), rapidjson::Writer< Stream, Encoding, Allocator >::StartArray(), rapidjson::Writer< Stream, Encoding, Allocator >::StartObject(), rapidjson::Writer< Stream, Encoding, Allocator >::String(), rapidjson::Writer< Stream, Encoding, Allocator >::Uint(), rapidjson::Writer< Stream, Encoding, Allocator >::Uint64(), and rapidjson::Writer< Stream, Encoding, Allocator >::ULongLong().
|
inline |
|
inline |
|
inline |
Simpler but slower overload.
References rapidjson::Writer< Stream, Encoding, Allocator >::String(), and rapidjson::internal::StrLen().
Referenced by rapidjson::Writer< Stream, Encoding, Allocator >::String().
|
inline |
References rapidjson::kStringType, rapidjson::Writer< Stream, Encoding, Allocator >::Prefix(), and rapidjson::Writer< Stream, Encoding, Allocator >::WriteString().
|
inlinestaticconstexprprotected |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
References rapidjson::Writer< Stream, Encoding, Allocator >::double_format, constants::i, RAPIDJSON_ASSERT, and rapidjson::Writer< Stream, Encoding, Allocator >::stream_.
Referenced by rapidjson::PrettyWriter< Stream, Encoding, Allocator >::Double(), and rapidjson::Writer< Stream, Encoding, Allocator >::Double().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
References rapidjson::Writer< Stream, Encoding, Allocator >::characterOk(), rapidjson::Writer< Stream, Encoding, Allocator >::stream_, and Z16.
Referenced by rapidjson::PrettyWriter< Stream, Encoding, Allocator >::String(), and rapidjson::Writer< Stream, Encoding, Allocator >::String().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
protected |
|
staticprotected |
|
protected |
Referenced by rapidjson::Writer< Stream, Encoding, Allocator >::EndArray(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::EndArray(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::EndObject(), rapidjson::Writer< Stream, Encoding, Allocator >::EndObject(), rapidjson::Writer< Stream, Encoding, Allocator >::Prefix(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::PrettyPrefix(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::StartArray(), rapidjson::Writer< Stream, Encoding, Allocator >::StartArray(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::StartObject(), rapidjson::Writer< Stream, Encoding, Allocator >::StartObject(), and rapidjson::PrettyWriter< Stream, Encoding, Allocator >::WriteIndent().
|
protected |
|
protected |
Referenced by rapidjson::PrettyWriter< Stream, Encoding, Allocator >::EndArray(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::EndObject(), rapidjson::Writer< Stream, Encoding, Allocator >::Prefix(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::PrettyPrefix(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteBool_(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteDouble(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteEndArray(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteEndObject(), rapidjson::PrettyWriter< Stream, Encoding, Allocator >::WriteIndent(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteInt(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteInt64(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteLongDouble(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteLongLong(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteNull_(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteStartArray(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteStartObject(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteString(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteUint(), rapidjson::Writer< Stream, Encoding, Allocator >::WriteUint64(), and rapidjson::Writer< Stream, Encoding, Allocator >::WriteULongLong().