bes  Updated for version 3.20.6
GenericReader< SourceEncoding, TargetEncoding, StackAllocator > Class Template Reference

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

#include <reader.h>

Collaboration diagram for GenericReader< SourceEncoding, TargetEncoding, StackAllocator >:
Collaboration graph

Public Types

typedef SourceEncoding::Ch Ch
 SourceEncoding character type. More...
 
typedef SourceEncoding::Ch Ch
 SourceEncoding character type. More...
 

Public Member Functions

 GenericReader (StackAllocator *stackAllocator=0, size_t stackCapacity=kDefaultStackCapacity)
 Constructor. More...
 
 GenericReader (StackAllocator *stackAllocator=0, size_t stackCapacity=kDefaultStackCapacity)
 Constructor. More...
 
size_t GetErrorOffset () const
 Get the position of last parsing error in input, 0 otherwise. More...
 
size_t GetErrorOffset () const
 Get the position of last parsing error in input, 0 otherwise. More...
 
ParseErrorCode GetParseErrorCode () const
 Get the ParseErrorCode of last parsing. More...
 
ParseErrorCode GetParseErrorCode () const
 Get the ParseErrorCode of last parsing. More...
 
bool HasParseError () const
 Whether a parse error has occured in the last parsing. More...
 
bool HasParseError () const
 Whether a parse error has occured in the last parsing. More...
 
template<unsigned parseFlags, typename InputStream , typename Handler >
ParseResult Parse (InputStream &is, Handler &handler)
 Parse JSON text. More...
 
template<unsigned parseFlags, typename InputStream , typename Handler >
ParseResult Parse (InputStream &is, Handler &handler)
 Parse JSON text. More...
 
template<typename InputStream , typename Handler >
ParseResult Parse (InputStream &is, Handler &handler)
 Parse JSON text (with kParseDefaultFlags) More...
 
template<typename InputStream , typename Handler >
ParseResult Parse (InputStream &is, Handler &handler)
 Parse JSON text (with kParseDefaultFlags) More...
 

Protected Member Functions

void SetParseError (ParseErrorCode code, size_t offset)
 
void SetParseError (ParseErrorCode code, size_t offset)
 

Detailed Description

template<typename SourceEncoding, typename TargetEncoding, typename StackAllocator = CrtAllocator>
class GenericReader< SourceEncoding, TargetEncoding, StackAllocator >

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.
StackAllocatorAllocator type for stack.

Definition at line 88 of file cmr_module/rapidjson/fwd.h.

Member Typedef Documentation

◆ Ch [1/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
typedef SourceEncoding::Ch GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Ch

SourceEncoding character type.

Definition at line 468 of file cmr_module/rapidjson/reader.h.

◆ Ch [2/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
typedef SourceEncoding::Ch GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Ch

SourceEncoding character type.

Definition at line 468 of file dmrpp_module/xml2json/include/rapidjson/reader.h.

Constructor & Destructor Documentation

◆ GenericReader() [1/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GenericReader ( StackAllocator *  stackAllocator = 0,
size_t  stackCapacity = kDefaultStackCapacity 
)
inline

Constructor.

Parameters
stackAllocatorOptional 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)

Definition at line 474 of file cmr_module/rapidjson/reader.h.

◆ GenericReader() [2/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GenericReader ( StackAllocator *  stackAllocator = 0,
size_t  stackCapacity = kDefaultStackCapacity 
)
inline

Constructor.

Parameters
stackAllocatorOptional 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)

Definition at line 474 of file dmrpp_module/xml2json/include/rapidjson/reader.h.

Member Function Documentation

◆ GetErrorOffset() [1/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
size_t GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GetErrorOffset ( ) const
inline

Get the position of last parsing error in input, 0 otherwise.

Definition at line 537 of file cmr_module/rapidjson/reader.h.

◆ GetErrorOffset() [2/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
size_t GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GetErrorOffset ( ) const
inline

Get the position of last parsing error in input, 0 otherwise.

Definition at line 537 of file dmrpp_module/xml2json/include/rapidjson/reader.h.

◆ GetParseErrorCode() [1/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
ParseErrorCode GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GetParseErrorCode ( ) const
inline

Get the ParseErrorCode of last parsing.

Definition at line 534 of file cmr_module/rapidjson/reader.h.

◆ GetParseErrorCode() [2/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
ParseErrorCode GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::GetParseErrorCode ( ) const
inline

Get the ParseErrorCode of last parsing.

Definition at line 534 of file dmrpp_module/xml2json/include/rapidjson/reader.h.

◆ HasParseError() [1/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
bool GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::HasParseError ( ) const
inline

Whether a parse error has occured in the last parsing.

Definition at line 531 of file dmrpp_module/xml2json/include/rapidjson/reader.h.

◆ HasParseError() [2/2]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
bool GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::HasParseError ( ) const
inline

Whether a parse error has occured in the last parsing.

Definition at line 531 of file cmr_module/rapidjson/reader.h.

◆ Parse() [1/4]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
ParseResult GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Parse ( InputStream &  is,
Handler handler 
)
inline

Parse JSON text.

Template Parameters
parseFlagsCombination of ParseFlag.
InputStreamType of input stream, implementing Stream concept.
HandlerType of handler, implementing Handler concept.
Parameters
isInput stream to be parsed.
handlerThe handler to receive events.
Returns
Whether the parsing is successful.

Definition at line 485 of file dmrpp_module/xml2json/include/rapidjson/reader.h.

◆ Parse() [2/4]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<unsigned parseFlags, typename InputStream , typename Handler >
ParseResult GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Parse ( InputStream &  is,
Handler handler 
)
inline

Parse JSON text.

Template Parameters
parseFlagsCombination of ParseFlag.
InputStreamType of input stream, implementing Stream concept.
HandlerType of handler, implementing Handler concept.
Parameters
isInput stream to be parsed.
handlerThe handler to receive events.
Returns
Whether the parsing is successful.

Definition at line 485 of file cmr_module/rapidjson/reader.h.

◆ Parse() [3/4]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<typename InputStream , typename Handler >
ParseResult GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Parse ( InputStream &  is,
Handler handler 
)
inline

Parse JSON text (with kParseDefaultFlags)

Template Parameters
InputStreamType of input stream, implementing Stream concept
HandlerType of handler, implementing Handler concept.
Parameters
isInput stream to be parsed.
handlerThe handler to receive events.
Returns
Whether the parsing is successful.

Definition at line 526 of file cmr_module/rapidjson/reader.h.

◆ Parse() [4/4]

template<typename SourceEncoding , typename TargetEncoding , typename StackAllocator = CrtAllocator>
template<typename InputStream , typename Handler >
ParseResult GenericReader< SourceEncoding, TargetEncoding, StackAllocator >::Parse ( InputStream &  is,
Handler handler 
)
inline

Parse JSON text (with kParseDefaultFlags)

Template Parameters
InputStreamType of input stream, implementing Stream concept
HandlerType of handler, implementing Handler concept.
Parameters
isInput stream to be parsed.
handlerThe handler to receive events.
Returns
Whether the parsing is successful.

Definition at line 526 of file dmrpp_module/xml2json/include/rapidjson/reader.h.


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