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

SAX-style JSON parser. Use Reader for UTF8 encoding and default allocator. More...

#include <reader.h>

Public Types

typedef Encoding::Ch Ch

Public Member Functions

 GenericReader (Allocator *allocator=0, size_t stackCapacity=kDefaultStackCapacity)
 Constructor. More...
 
template<unsigned parseFlags, typename Stream , typename Handler >
bool Parse (Stream &stream, Handler &handler)
 Parse JSON text. More...
 
bool HasParseError () const
const char * GetParseError () const
size_t GetErrorOffset () const
local GetErrorOffset ()

Detailed Description

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

SAX-style JSON parser. Use Reader for UTF8 encoding and default allocator.

GenericReader parses JSON text from a stream, and send events synchronously to an object implementing Handler concept.

It needs to allocate a stack for storing a single decoded string during non-destructive parsing.

For in-situ parsing, the decoded string is directly written to the source text string, no temporary buffer is required.

A GenericReader object can be reused for parsing multiple JSON text.

Template Parameters
EncodingEncoding of both the stream and the parse output.
AllocatorAllocator type for stack.

Member Typedef Documentation

typedef Encoding::Ch Ch
var Ch
local Ch

Constructor & Destructor Documentation

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

Constructor.

Parameters
allocatorOptional allocator for allocating stack memory. (Only use for non-destructive parsing)
stackCapacitystack capacity in bytes for storing a single decoded string. (Only use for non-destructive parsing)
var GenericReader ( var  allocator = 0,
var  stackCapacity = kDefaultStackCapacity 
)
inline

Constructor.

Parameters
allocatorOptional allocator for allocating stack memory. (Only use for non-destructive parsing)
stackCapacitystack capacity in bytes for storing a single decoded string. (Only use for non-destructive parsing)
local GenericReader ( local  allocator = 0,
local  stackCapacity = kDefaultStackCapacity 
)
inline

Constructor.

Parameters
allocatorOptional allocator for allocating stack memory. (Only use for non-destructive parsing)
stackCapacitystack capacity in bytes for storing a single decoded string. (Only use for non-destructive parsing)

Member Function Documentation

size_t GetErrorOffset ( ) const
inline
var GetErrorOffset ( )
inline
local GetErrorOffset ( )
inline
const char* GetParseError ( ) const
inline
var GetParseError ( )
inline
local GetParseError ( )
inline
bool HasParseError ( ) const
inline
var HasParseError ( )
inline
local HasParseError ( )
inline
bool Parse ( Stream stream,
Handler handler 
)
inline

Parse JSON text.

Template Parameters
parseFlagsCombination of ParseFlag.
StreamType of input stream.
HandlerType of handler which must implement Handler concept.
Parameters
streamInput stream to be parsed.
handlerThe handler to receive events.
Returns
Whether the parsing is successful.
var Parse ( var  stream,
var  handler 
)
inline

Parse JSON text.

Template Parameters
parseFlagsCombination of ParseFlag.
StreamType of input stream.
HandlerType of handler which must implement Handler concept.
Parameters
streamInput stream to be parsed.
handlerThe handler to receive events.
Returns
Whether the parsing is successful.
local Parse ( local  stream,
local  handler 
)
inline

Parse JSON text.

Template Parameters
parseFlagsCombination of ParseFlag.
StreamType of input stream.
HandlerType of handler which must implement Handler concept.
Parameters
streamInput stream to be parsed.
handlerThe handler to receive events.
Returns
Whether the parsing is successful.

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