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

A document for parsing JSON text as DOM. More...

#include <document.h>

Inheritance diagram for GenericDocument< Encoding, Allocator >:
Handler GenericValue< Encoding, Allocator >

Public Types

typedef Encoding::Ch Ch
 Character type derived from Encoding. More...
 
typedef GenericValue< Encoding,
Allocator
ValueType
 Value type of the document. More...
 
typedef Allocator AllocatorType
 Allocator type from template parameter. More...
 
- Public Types inherited from GenericValue< Encoding, Allocator >
typedef Encoding EncodingType
 Encoding type from template parameter. More...
 
typedef Allocator AllocatorType
 Allocator type from template parameter. More...
 
typedef Encoding::Ch Ch
 Character type derived from Encoding. More...
 
typedef MemberMemberIterator
 Member iterator for iterating in object. More...
 
typedef const MemberConstMemberIterator
 Constant member iterator for iterating in object. More...
 
typedef GenericValueValueIterator
 Value iterator for iterating in array. More...
 
typedef const GenericValueConstValueIterator
 Constant value iterator for iterating in array. More...
 

Public Member Functions

 GenericDocument (Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity)
 Constructor. More...
 
template<unsigned parseFlags, typename Stream >
GenericDocumentParseStream (Stream &stream)
 Parse JSON text from an input stream. More...
 
template<unsigned parseFlags, typename Stream >
var ParseStream ( var stream)
 Parse JSON text from an input stream. More...
 
template<unsigned parseFlags>
GenericDocumentParseInsitu (Ch *str)
 Parse JSON text from a mutable string. More...
 
template<unsigned parseFlags>
GenericDocumentParse (const Ch *str)
 Parse JSON text from a read-only string. More...
 
template<unsigned parseFlags>
local Parse ( local str)
 Parse JSON text from a read-only string. More...
 
bool HasParseError () const
 Whether a parse error was occured in the last parsing. More...
 
const char * GetParseError () const
 Get the message of parsing error. More...
 
size_t GetErrorOffset () const
 Get the offset in character of the parsing error. More...
 
AllocatorGetAllocator ()
 Get the allocator of this document. More...
 
size_t GetStackCapacity () const
 Get the capacity of stack in bytes. More...
 
- Public Member Functions inherited from GenericValue< Encoding, Allocator >
template<typename Handler >
const GenericValueAccept (Handler &handler) const
 Generate events of this value to a Handler. More...
 
GenericValueoperator= (GenericValue &rhs)
 Assignment with move semantics. More...
 
local operator= ( local rhs)
 Assignment with move semantics. More...
 
template<typename T >
GenericValueoperator= (T value)
 Assignment with primitive types. More...
 
template<typename T >
local operator= ( local value)
 Assignment with primitive types. More...
 
Type GetType () const
bool IsNull () const
bool IsFalse () const
bool IsTrue () const
bool IsBool () const
bool IsObject () const
bool IsArray () const
bool IsNumber () const
bool IsInt () const
bool IsUint () const
bool IsInt64 () const
bool IsUint64 () const
bool IsDouble () const
bool IsString () const
GenericValueSetNull ()
bool GetBool () const
GenericValueSetBool (bool b)
var SetBool ( var b)
local SetBool ( local b)
GenericValueSetObject ()
 Set this value as an empty object. More...
 
GenericValueoperator[] (const Ch *name)
 Get the value associated with the object's name. More...
 
var operator[] ( var name)
 Get the value associated with the object's name. More...
 
local operator[] ( local name)
 Get the value associated with the object's name. More...
 
const GenericValueoperator[] (const Ch *name) const
ConstMemberIterator MemberonBegin () const
 Member iterators. More...
 
ConstMemberIterator MemberonEnd () const
MemberIterator MemberonBegin ()
MemberIterator MemberonEnd ()
bool HasMember (const Ch *name) const
 Check whether a member exists in the object. More...
 
local HasMember ( local name)
 Check whether a member exists in the object. More...
 
GenericValueAddMember (GenericValue &name, GenericValue &value, Allocator &allocator)
 Add a member (name-value pair) to the object. More...
 
local AddMember ( local name, local value, local allocator)
 Add a member (name-value pair) to the object. More...
 
GenericValueAddMember (const Ch *name, Allocator &nameAllocator, GenericValue &value, Allocator &allocator)
var AddMember ( var name, var nameAllocator, var value, var allocator)
local AddMember ( local name, local nameAllocator, local value, local allocator)
GenericValueAddMember (const Ch *name, GenericValue &value, Allocator &allocator)
template<typename T >
GenericValueAddMember (const Ch *name, T value, Allocator &allocator)
template<typename T >
local AddMember ( local name, local value, local allocator)
bool RemoveMember (const Ch *name)
 Remove a member in object by its name. More...
 
GenericValueSetArray ()
 Set this value as an empty array. More...
 
SizeType Size () const
 Get the number of elements in array. More...
 
SizeType Capacity () const
 Get the capacity of array. More...
 
bool Empty () const
 Check whether the array is empty. More...
 
void Clear ()
 Remove all elements in the array. More...
 
GenericValueoperator[] (SizeType index)
 Get an element from array by index. More...
 
local operator[] ( local index)
 Get an element from array by index. More...
 
const GenericValueoperator[] (SizeType index) const
ValueIterator onBegin ()
 Element iterator. More...
 
ValueIterator onEnd ()
var onEnd ()
local onEnd ()
ConstValueIterator onBegin () const
ConstValueIterator onEnd () const
GenericValueReserve (SizeType newCapacity, Allocator &allocator)
 Request the array to have enough capacity to store elements. More...
 
GenericValuePushBack (GenericValue &value, Allocator &allocator)
 Append a value at the end of the array. More...
 
local PushBack ( local value, local allocator)
 Append a value at the end of the array. More...
 
template<typename T >
GenericValuePushBack (T value, Allocator &allocator)
template<typename T >
var PushBack ( var value, var allocator)
template<typename T >
local PushBack ( local value, local allocator)
GenericValuePopBack ()
 Remove the last element in the array. More...
 
int GetInt () const
unsigned GetUint () const
int64_t GetInt64 () const
uint64_t GetUint64 () const
double GetDouble () const
GenericValueSetInt (int i)
var SetInt ( var i)
local SetInt ( local i)
GenericValueSetUint (unsigned u)
var SetUint ( var u)
local SetUint ( local u)
GenericValueSetInt64 (int64_t i64)
var SetInt64 ( var i64)
local SetInt64 ( local i64)
GenericValueSetUint64 (uint64_t u64)
GenericValueSetDouble (double d)
const ChGetString () const
SizeType GetStringLength () const
 Get the length of string. More...
 
local GetStringLength ()
 Get the length of string. More...
 
GenericValueSetString (const Ch *s, SizeType length)
 Set this value as a string without copying source string. More...
 
local SetString ( local s, local length)
 Set this value as a string without copying source string. More...
 
GenericValueSetString (const Ch *s)
 Set this value as a string without copying source string. More...
 
GenericValueSetString (const Ch *s, SizeType length, Allocator &allocator)
 Set this value as a string by copying from source string. More...
 
local SetString ( local s, local length, local allocator)
 Set this value as a string by copying from source string. More...
 
GenericValueSetString (const Ch *s, Allocator &allocator)
 Set this value as a string by copying from source string. More...
 
 GenericValue ()
 Default constructor creates a null value. More...
 
 GenericValue (Type type)
 Constructor with JSON value type. More...
 
 GenericValue (bool b)
 Constructor for boolean value. More...
 
 GenericValue (int i)
 Constructor for int value. More...
 
 GenericValue (unsigned u)
 Constructor for unsigned value. More...
 
 GenericValue (int64_t i64)
 Constructor for int64_t value. More...
 
 GenericValue (uint64_t u64)
 Constructor for uint64_t value. More...
 
 GenericValue (double d)
 Constructor for double value. More...
 
 GenericValue (const Ch *s, SizeType length)
 Constructor for constant string (i.e. do not make a copy of string) More...
 
 GenericValue (const Ch *s)
 Constructor for constant string (i.e. do not make a copy of string) More...
 
 GenericValue (const Ch *s, SizeType length, Allocator &allocator)
 Constructor for copy-string (i.e. do make a copy of string) More...
 
 GenericValue (const Ch *s, Allocator &allocator)
 Constructor for copy-string (i.e. do make a copy of string) More...
 
 ~GenericValue ()
 Destructor. More...
 

Friends

class GenericReader< Encoding, Allocator >

Detailed Description

template<typename Encoding, typename Allocator = MemoryPoolAllocator<>>
class rapidjson::GenericDocument< Encoding, Allocator >

A document for parsing JSON text as DOM.

Template Parameters
Encodingencoding for both parsing and string storage.
Alloactorallocator for allocating memory for the DOM, and the stack during parsing.

Member Typedef Documentation

Allocator type from template parameter.

Allocator type from template parameter.

Allocator type from template parameter.

typedef Encoding::Ch Ch

Character type derived from Encoding.

var Ch

Character type derived from Encoding.

local Ch

Character type derived from Encoding.

Value type of the document.

var ValueType

Value type of the document.

local ValueType

Value type of the document.

Constructor & Destructor Documentation

GenericDocument ( Allocator allocator = 0,
size_t  stackCapacity = kDefaultStackCapacity 
)
inline

Constructor.

Parameters
allocatorOptional allocator for allocating stack memory.
stackCapacityInitial capacity of stack in bytes.
var GenericDocument ( var  allocator = 0,
var  stackCapacity = kDefaultStackCapacity 
)
inline

Constructor.

Parameters
allocatorOptional allocator for allocating stack memory.
stackCapacityInitial capacity of stack in bytes.
local GenericDocument ( local  allocator = 0,
local  stackCapacity = kDefaultStackCapacity 
)
inline

Constructor.

Parameters
allocatorOptional allocator for allocating stack memory.
stackCapacityInitial capacity of stack in bytes.

Member Function Documentation

Allocator& GetAllocator ( )
inline

Get the allocator of this document.

var GetAllocator ( )
inline

Get the allocator of this document.

local GetAllocator ( )
inline

Get the allocator of this document.

size_t GetErrorOffset ( ) const
inline

Get the offset in character of the parsing error.

var GetErrorOffset ( )
inline

Get the offset in character of the parsing error.

local GetErrorOffset ( )
inline

Get the offset in character of the parsing error.

const char* GetParseError ( ) const
inline

Get the message of parsing error.

var GetParseError ( )
inline

Get the message of parsing error.

local GetParseError ( )
inline

Get the message of parsing error.

size_t GetStackCapacity ( ) const
inline

Get the capacity of stack in bytes.

var GetStackCapacity ( )
inline

Get the capacity of stack in bytes.

local GetStackCapacity ( )
inline

Get the capacity of stack in bytes.

bool HasParseError ( ) const
inline

Whether a parse error was occured in the last parsing.

var HasParseError ( )
inline

Whether a parse error was occured in the last parsing.

local HasParseError ( )
inline

Whether a parse error was occured in the last parsing.

GenericDocument& Parse ( const Ch str)
inline

Parse JSON text from a read-only string.

Template Parameters
parseFlagsCombination of ParseFlag (must not contain kParseInsituFlag).
Parameters
strRead-only zero-terminated string to be parsed.
var Parse ( var  str)
inline

Parse JSON text from a read-only string.

Template Parameters
parseFlagsCombination of ParseFlag (must not contain kParseInsituFlag).
Parameters
strRead-only zero-terminated string to be parsed.
local Parse ( local  str)
inline

Parse JSON text from a read-only string.

Template Parameters
parseFlagsCombination of ParseFlag (must not contain kParseInsituFlag).
Parameters
strRead-only zero-terminated string to be parsed.
GenericDocument& ParseInsitu ( Ch str)
inline

Parse JSON text from a mutable string.

Template Parameters
parseFlagsCombination of ParseFlag.
Parameters
strMutable zero-terminated string to be parsed.
Returns
The document itself for fluent API.
var ParseInsitu ( var  str)
inline

Parse JSON text from a mutable string.

Template Parameters
parseFlagsCombination of ParseFlag.
Parameters
strMutable zero-terminated string to be parsed.
Returns
The document itself for fluent API.
local ParseInsitu ( local  str)
inline

Parse JSON text from a mutable string.

Template Parameters
parseFlagsCombination of ParseFlag.
Parameters
strMutable zero-terminated string to be parsed.
Returns
The document itself for fluent API.
GenericDocument& ParseStream ( Stream stream)
inline

Parse JSON text from an input stream.

Template Parameters
parseFlagsCombination of ParseFlag.
Parameters
streamInput stream to be parsed.
Returns
The document itself for fluent API.
var ParseStream ( var  stream)
inline

Parse JSON text from an input stream.

Template Parameters
parseFlagsCombination of ParseFlag.
Parameters
streamInput stream to be parsed.
Returns
The document itself for fluent API.
local ParseStream ( local  stream)
inline

Parse JSON text from an input stream.

Template Parameters
parseFlagsCombination of ParseFlag.
Parameters
streamInput stream to be parsed.
Returns
The document itself for fluent API.

Friends And Related Function Documentation

friend class GenericReader
< Encoding, Allocator >
friend
friend class GenericReader
< Encoding, Allocator >
friend
friend class GenericReader
< Encoding, Allocator >
friend

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