rapidjson::GenericReader< SourceEncoding, TargetEncoding, Allocator > Class Template Reference

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

#include <reader.h>

Collaboration diagram for rapidjson::GenericReader< SourceEncoding, TargetEncoding, Allocator >:
[legend]

Classes

class  StackStream
 

Public Types

typedef SourceEncoding::Ch Ch
 

Public Member Functions

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

Private Member Functions

template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseObject (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseArray (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseNull (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseTrue (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseFalse (InputStream &is, Handler &handler)
 
template<typename InputStream >
unsigned ParseHex4 (InputStream &is)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseString (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename SEncoding , typename TEncoding , typename InputStream , typename OutputStream >
RAPIDJSON_FORCEINLINE void ParseStringToStream (InputStream &is, OutputStream &os)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseNumber (InputStream &is, Handler &handler)
 
template<unsigned parseFlags, typename InputStream , typename Handler >
void ParseValue (InputStream &is, Handler &handler)
 

Private Attributes

internal::Stack< Allocatorstack_
 A stack for storing decoded string temporarily during non-destructive parsing.
 
jmp_buf jmpbuf_
 setjmp buffer for fast exit from nested parsing function calls.
 
const char * parseError_
 
size_t errorOffset_
 

Static Private Attributes

static const size_t kDefaultStackCapacity = 256
 Default stack capacity in bytes for storing a single decoded string.
 

Detailed Description

template<typename SourceEncoding, typename TargetEncoding, typename Allocator = MemoryPoolAllocator<>>
class rapidjson::GenericReader< SourceEncoding, TargetEncoding, 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
SourceEncodingEncoding of the input stream.
TargetEncodingEncoding of the parse output.
AllocatorAllocator type for stack.

Constructor & Destructor Documentation

template<typename SourceEncoding, typename TargetEncoding, typename Allocator = MemoryPoolAllocator<>>
rapidjson::GenericReader< SourceEncoding, TargetEncoding, Allocator >::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)

Member Function Documentation

template<typename SourceEncoding, typename TargetEncoding, typename Allocator = MemoryPoolAllocator<>>
template<unsigned parseFlags, typename InputStream , typename Handler >
bool rapidjson::GenericReader< SourceEncoding, TargetEncoding, Allocator >::Parse ( InputStream &  is,
Handler handler 
)
inline

Parse JSON text.

Template Parameters
parseFlagsCombination of ParseFlag.
InputStreamType 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:
  • /home/travis/build/urho3d/Urho3D/Source/ThirdParty/rapidjson/include/rapidjson/reader.h