Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | List of all members
GenericReader< SourceEncoding, TargetEncoding, Allocator > Class Template Reference

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

`#include <reader.h>`

## 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

## 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

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

## Member Typedef Documentation

typedef SourceEncoding::Ch Ch

## Constructor & Destructor Documentation

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

Constructor.

Parameters

  allocator | 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)

## Member Function Documentation

size_t GetErrorOffset | ( |  | ) | const
| inline

const char* GetParseError | ( |  | ) | const
| inline

bool HasParseError | ( |  | ) | const
| inline

bool Parse | ( | InputStream & | is,
|  | Handler & | handler
| ) |  |
| inline

Parse JSON text.

Template Parameters

  parseFlags | Combination of ParseFlag.
  InputStream | Type of input stream.
  Handler | Type of handler which must implement Handler concept.

Parameters

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

Returns
  Whether the parsing is successful.

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

- persistence/rapidjson/include/rapidjson/reader.h