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

class GenericReader

Defined at line 539 of file ../../third_party/rapidjson/include/rapidjson/reader.h

SAX-style JSON parser. Use

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

SourceEncoding Encoding of the input stream.
TargetEncoding Encoding of the parse output.
StackAllocator Allocator type for stack.

Public Methods

void GenericReader<SourceEncoding, TargetEncoding, StackAllocator> (StackAllocator * stackAllocator, size_t stackCapacity)

Constructor.

Parameters

stackAllocator Optional allocator for allocating stack memory. (Only use for non-destructive parsing)
stackCapacity stack capacity in bytes for storing a single decoded string. (Only use for non-destructive parsing)

Defined at line 547 of file ../../third_party/rapidjson/include/rapidjson/reader.h

template <unsigned parseFlags, typename InputStream, typename Handler>
ParseResult Parse (InputStream & is, Handler & handler)

Parse JSON text.

Parameters

is Input stream to be parsed.
handler The handler to receive events.

Template Parameters

parseFlags Combination of
InputStream Type of input stream, implementing Stream concept.
Handler Type of handler, implementing Handler concept.

Returns

Whether the parsing is successful.

Defined at line 559 of file ../../third_party/rapidjson/include/rapidjson/reader.h

template <typename InputStream, typename Handler>
ParseResult Parse (InputStream & is, Handler & handler)

Parse JSON text (with

Parameters

is Input stream to be parsed.
handler The handler to receive events.

Template Parameters

InputStream Type of input stream, implementing Stream concept
Handler Type of handler, implementing Handler concept.

Returns

Whether the parsing is successful.

Defined at line 600 of file ../../third_party/rapidjson/include/rapidjson/reader.h

void IterativeParseInit ()

Initialize JSON text token-by-token parsing

Defined at line 607 of file ../../third_party/rapidjson/include/rapidjson/reader.h

template <unsigned parseFlags, typename InputStream, typename Handler>
bool IterativeParseNext (InputStream & is, Handler & handler)

Parse one token from JSON text

Parameters

is Input stream to be parsed.
handler The handler to receive events.

Template Parameters

InputStream Type of input stream, implementing Stream concept
Handler Type of handler, implementing Handler concept.

Returns

Whether the parsing is successful.

Defined at line 620 of file ../../third_party/rapidjson/include/rapidjson/reader.h

bool IterativeParseComplete ()

Check if token-by-token parsing JSON text is complete

Returns

Whether the JSON has been fully decoded.

Defined at line 677 of file ../../third_party/rapidjson/include/rapidjson/reader.h

bool HasParseError ()

Whether a parse error has occurred in the last parsing.

Defined at line 682 of file ../../third_party/rapidjson/include/rapidjson/reader.h

ParseErrorCode GetParseErrorCode ()

Get the

of last parsing.

Defined at line 685 of file ../../third_party/rapidjson/include/rapidjson/reader.h

size_t GetErrorOffset ()

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

Defined at line 688 of file ../../third_party/rapidjson/include/rapidjson/reader.h

Protected Methods

void SetParseError (ParseErrorCode code, size_t offset)

Defined at line 691 of file ../../third_party/rapidjson/include/rapidjson/reader.h

Records