NGL
6.5
The NCCA Graphics Library
|
Writer with indentation and spacing. More...
#include <prettywriter.h>
Public Types | |
typedef Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator > | Base |
typedef Base::Ch | Ch |
Public Types inherited from Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator > | |
typedef SourceEncoding::Ch | Ch |
Public Member Functions | |
PrettyWriter (OutputStream &os, StackAllocator *allocator=0, size_t levelDepth=Base::kDefaultLevelDepth) | |
Constructor. More... | |
PrettyWriter & | SetIndent (Ch indentChar, unsigned indentCharCount) |
Set custom indentation. More... | |
Implementation of Handler | |
| |
bool | Null () |
bool | Bool (bool b) |
bool | Int (int i) |
bool | Uint (unsigned u) |
bool | Int64 (int64_t i64) |
bool | Uint64 (uint64_t u64) |
bool | Double (double d) |
bool | String (const Ch *str, SizeType length, bool copy=false) |
bool | StartObject () |
bool | Key (const Ch *str, SizeType length, bool copy=false) |
bool | EndObject (SizeType memberCount=0) |
bool | StartArray () |
bool | EndArray (SizeType memberCount=0) |
Convenience extensions | |
bool | String (const Ch *str) |
Simpler but slower overload. More... | |
bool | Key (const Ch *str) |
Public Member Functions inherited from Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator > | |
Writer (OutputStream &os, StackAllocator *stackAllocator=0, size_t levelDepth=kDefaultLevelDepth) | |
Constructor. More... | |
Writer (StackAllocator *allocator=0, size_t levelDepth=kDefaultLevelDepth) | |
void | Reset (OutputStream &os) |
Reset the writer with a new stream. More... | |
bool | IsComplete () const |
Checks whether the output is a complete JSON. More... | |
bool | Null () |
bool | Bool (bool b) |
bool | Int (int i) |
bool | Uint (unsigned u) |
bool | Int64 (int64_t i64) |
bool | Uint64 (uint64_t u64) |
bool | Double (double d) |
Writes the given double value to the stream. More... | |
bool | String (const Ch *str, SizeType length, bool copy=false) |
bool | StartObject () |
bool | Key (const Ch *str, SizeType length, bool copy=false) |
bool | EndObject (SizeType memberCount=0) |
bool | StartArray () |
bool | EndArray (SizeType elementCount=0) |
bool | String (const Ch *str) |
Simpler but slower overload. More... | |
bool | Key (const Ch *str) |
Protected Member Functions | |
void | PrettyPrefix (Type type) |
void | WriteIndent () |
Protected Member Functions inherited from Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator > | |
bool | WriteNull () |
bool | WriteBool (bool b) |
bool | WriteInt (int i) |
bool | WriteUint (unsigned u) |
bool | WriteInt64 (int64_t i64) |
bool | WriteUint64 (uint64_t u64) |
bool | WriteDouble (double d) |
bool | WriteString (const Ch *str, SizeType length) |
bool | WriteStartObject () |
bool | WriteEndObject () |
bool | WriteStartArray () |
bool | WriteEndArray () |
void | Prefix (Type type) |
template<> | |
bool | WriteInt (int i) |
template<> | |
bool | WriteUint (unsigned u) |
template<> | |
bool | WriteInt64 (int64_t i64) |
template<> | |
bool | WriteUint64 (uint64_t u) |
template<> | |
bool | WriteDouble (double d) |
Protected Attributes | |
Ch | indentChar_ |
unsigned | indentCharCount_ |
Protected Attributes inherited from Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator > | |
OutputStream * | os_ |
internal::Stack< StackAllocator > | level_stack_ |
bool | hasRoot_ |
Private Member Functions | |
PrettyWriter (const PrettyWriter &) | |
PrettyWriter & | operator= (const PrettyWriter &) |
Additional Inherited Members | |
Static Protected Attributes inherited from Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator > | |
static const size_t | kDefaultLevelDepth = 32 |
Writer with indentation and spacing.
OutputStream | Type of ouptut os. |
SourceEncoding | Encoding of source string. |
TargetEncoding | Encoding of output stream. |
StackAllocator | Type of allocator for allocating memory of stack. |
Definition at line 35 of file prettywriter.h.
typedef Writer<OutputStream, SourceEncoding, TargetEncoding, StackAllocator> PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::Base |
Definition at line 37 of file prettywriter.h.
typedef Base::Ch PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::Ch |
Definition at line 38 of file prettywriter.h.
|
inline |
Constructor.
os | Output stream. |
allocator | User supplied allocator. If it is null, it will create a private one. |
levelDepth | Initial capacity of stack. |
Definition at line 45 of file prettywriter.h.
|
private |
|
inline |
Definition at line 66 of file prettywriter.h.
References kFalseType, kTrueType, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteBool().
|
inline |
Definition at line 71 of file prettywriter.h.
References kNumberType, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteDouble().
|
inline |
Definition at line 117 of file prettywriter.h.
References Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::level_stack_, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::os_, RAPIDJSON_ASSERT, void(), Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteEndArray(), and PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteIndent().
|
inline |
Definition at line 93 of file prettywriter.h.
References Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::level_stack_, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::os_, RAPIDJSON_ASSERT, void(), Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteEndObject(), and PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteIndent().
|
inline |
Definition at line 67 of file prettywriter.h.
References kNumberType, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteInt().
|
inline |
Definition at line 69 of file prettywriter.h.
References kNumberType, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteInt64().
|
inline |
Definition at line 91 of file prettywriter.h.
References PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::String().
|
inline |
Definition at line 142 of file prettywriter.h.
References PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::Key(), and internal::StrLen().
|
inline |
Definition at line 65 of file prettywriter.h.
References kNullType, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteNull().
|
private |
|
inlineprotected |
Definition at line 146 of file prettywriter.h.
References Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::hasRoot_, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::Level::inArray, kStringType, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::level_stack_, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::os_, RAPIDJSON_ASSERT, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::Level::valueCount, void(), and PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteIndent().
|
inline |
Set custom indentation.
indentChar | Character for indentation. Must be whitespace character (' ', '\t', '\n', '\r'). |
indentCharCount | Number of indent characters for each indentation level. |
Definition at line 53 of file prettywriter.h.
References PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::indentChar_, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::indentCharCount_, and RAPIDJSON_ASSERT.
|
inline |
Definition at line 111 of file prettywriter.h.
References kArrayType, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::level_stack_, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteStartArray().
|
inline |
Definition at line 85 of file prettywriter.h.
References kObjectType, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::level_stack_, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteStartObject().
|
inline |
Definition at line 73 of file prettywriter.h.
References kStringType, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), SizeType, void(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteString().
|
inline |
Simpler but slower overload.
Definition at line 141 of file prettywriter.h.
References PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::String(), and internal::StrLen().
|
inline |
Definition at line 68 of file prettywriter.h.
References kNumberType, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteUint().
|
inline |
Definition at line 70 of file prettywriter.h.
References kNumberType, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::PrettyPrefix(), and Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::WriteUint64().
|
inlineprotected |
Definition at line 187 of file prettywriter.h.
References internal::Stack< Allocator >::GetSize(), PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::indentChar_, PrettyWriter< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::indentCharCount_, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::level_stack_, Writer< OutputStream, SourceEncoding, TargetEncoding, StackAllocator >::os_, and PutN().
|
protected |
Definition at line 192 of file prettywriter.h.
|
protected |
Definition at line 193 of file prettywriter.h.