cocos2d-x  2.2.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Writer< Stream, Encoding, Allocator > Class Template Reference

JSON writer. More...

#include <writer.h>

Inheritance diagram for Writer< Stream, Encoding, Allocator >:
Handler PrettyWriter< Stream, Encoding, Allocator >

Classes

struct  Level
 Information for each nested level. More...
 

Public Types

typedef Encoding::Ch Ch

Public Member Functions

 Writer (Stream &stream, Allocator *allocator=0, size_t levelDepth=kDefaultLevelDepth)
WriterString (const Ch *str)
 Simpler but slower overload. More...
 
WriterNull ()
WriterBool (bool b)
WriterInt (int i)
WriterUint (unsigned u)
WriterInt64 (int64_t i64)
WriterUint64 (uint64_t u64)
WriterDouble (double d)
WriterString (const Ch *str, SizeType length, bool copy=false)
local String ( local str, local length, local false)
WriterStartObject ()
WriterEndObject (SizeType memberCount=0)
WriterStartArray ()
WriterEndArray (SizeType elementCount=0)

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)
void WriteDouble (double d)
var WriteDouble ( var d)
local WriteDouble ( local d)
void WriteString (const Ch *str, SizeType length)
void WriteStartObject ()
void WriteEndObject ()
void WriteStartArray ()
void WriteEndArray ()
void Prefix (Type type)

Protected Attributes

Streamstream_
internal::Stack< Allocatorlevel_stack_
var level_stack_
local level_stack_

Static Protected Attributes

static const size_t kDefaultLevelDepth = 32
local kDefaultLevelDepth = 32

Detailed Description

template<typename Stream, typename Encoding = UTF8<>, typename Allocator = MemoryPoolAllocator<>>
class rapidjson::Writer< Stream, Encoding, Allocator >

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().

Template Parameters
StreamType of ouptut stream.
EncodingEncoding of both source strings and output.

Member Typedef Documentation

typedef Encoding::Ch Ch
var Ch
local Ch

Constructor & Destructor Documentation

Writer ( Stream stream,
Allocator allocator = 0,
size_t  levelDepth = kDefaultLevelDepth 
)
inline
var Writer ( var  stream,
var  allocator = 0,
var  levelDepth = kDefaultLevelDepth 
)
inline
local Writer ( local  stream,
local  allocator = 0,
local  levelDepth = kDefaultLevelDepth 
)
inline

Member Function Documentation

Writer& Bool ( bool  b)
inline
var Bool ( var  b)
inline
local Bool ( local  b)
inline
Writer& Double ( double  d)
inline
var Double ( var  d)
inline
local Double ( local  d)
inline
Writer& EndArray ( SizeType  elementCount = 0)
inline
var EndArray ( var  elementCount = 0)
inline
local EndArray ( local  elementCount = 0)
inline
Writer& EndObject ( SizeType  memberCount = 0)
inline
var EndObject ( var  memberCount = 0)
inline
local EndObject ( local  memberCount = 0)
inline
Writer& Int ( int  i)
inline
var Int ( var  i)
inline
local Int ( local  i)
inline
Writer& Int64 ( int64_t  i64)
inline
var Int64 ( var  i64)
inline
local Int64 ( local  i64)
inline
Writer& Null ( )
inline
var Null ( )
inline
local Null ( )
inline
void Prefix ( Type  type)
inlineprotected
var Prefix ( var  type)
inlineprotected
local Prefix ( local  type)
inlineprotected
Writer& StartArray ( )
inline
var StartArray ( )
inline
local StartArray ( )
inline
Writer& StartObject ( )
inline
var StartObject ( )
inline
local StartObject ( )
inline
Writer& String ( const Ch str,
SizeType  length,
bool  copy = false 
)
inline
var String ( var  str,
var  length,
var  copy = false 
)
inline
local String ( local  str,
local  length,
local  copy = false 
)
inline
Writer& String ( const Ch str)
inline

Simpler but slower overload.

var String ( var  str)
inline

Simpler but slower overload.

local String ( local  str)
inline

Simpler but slower overload.

Writer& Uint ( unsigned  u)
inline
var Uint ( var  u)
inline
local Uint ( local  u)
inline
Writer& Uint64 ( uint64_t  u64)
inline
var Uint64 ( var  u64)
inline
local Uint64 ( local  u64)
inline
void WriteBool ( bool  b)
inlineprotected
var WriteBool ( var  b)
inlineprotected
local WriteBool ( local  b)
inlineprotected
void WriteDouble ( double  d)
inlineprotected
Todo:
Optimization with custom double-to-string converter.
var WriteDouble ( var  d)
inlineprotected
Todo:
Optimization with custom double-to-string converter.
local WriteDouble ( local  d)
inlineprotected
Todo:
Optimization with custom double-to-string converter.
void WriteEndArray ( )
inlineprotected
var WriteEndArray ( )
inlineprotected
local WriteEndArray ( )
inlineprotected
void WriteEndObject ( )
inlineprotected
var WriteEndObject ( )
inlineprotected
local WriteEndObject ( )
inlineprotected
void WriteInt ( int  i)
inlineprotected
var WriteInt ( var  i)
inlineprotected
local WriteInt ( local  i)
inlineprotected
void WriteInt64 ( int64_t  i64)
inlineprotected
var WriteInt64 ( var  i64)
inlineprotected
local WriteInt64 ( local  i64)
inlineprotected
void WriteNull ( )
inlineprotected
var WriteNull ( )
inlineprotected
local WriteNull ( )
inlineprotected
void WriteStartArray ( )
inlineprotected
var WriteStartArray ( )
inlineprotected
local WriteStartArray ( )
inlineprotected
void WriteStartObject ( )
inlineprotected
var WriteStartObject ( )
inlineprotected
local WriteStartObject ( )
inlineprotected
void WriteString ( const Ch str,
SizeType  length 
)
inlineprotected
var WriteString ( var  str,
var  length 
)
inlineprotected
local WriteString ( local  str,
local  length 
)
inlineprotected
void WriteUint ( unsigned  u)
inlineprotected
var WriteUint ( var  u)
inlineprotected
local WriteUint ( local  u)
inlineprotected
void WriteUint64 ( uint64_t  u64)
inlineprotected
var WriteUint64 ( var  u64)
inlineprotected
local WriteUint64 ( local  u64)
inlineprotected

Member Data Documentation

const size_t kDefaultLevelDepth = 32
staticprotected
var kDefaultLevelDepth = 32
staticprotected
local kDefaultLevelDepth = 32
staticprotected
internal::Stack<Allocator>
level_stack_
protected
var level_stack_
protected
local level_stack_
protected
Stream& stream_
protected
var stream_
protected
local stream_
protected

The documentation for this class was generated from the following file: