Base JSON data reader interface. Implementations provide support for reading JSON data from various sources. Event notifications will be sent to the callback handler set for the reader. Handler instances may be updated during the course of data parsing.
More...
#include <Reader.h>
|
void | parseNumber (const std::string &value) |
|
bool | isWhiteSpace (char current) |
| Check to see if the specified character is white space. More...
|
|
bool | isNumeric (char current) |
| Check to see if current character represents a numeric value. More...
|
|
|
static const std::string | null |
| A constant representing a JSON null value. More...
|
|
static const std::string | True |
| A constant representing a JSON true value. More...
|
|
static const std::string | False |
| A constant representing a JSON false value. More...
|
|
Base JSON data reader interface. Implementations provide support for reading JSON data from various sources. Event notifications will be sent to the callback handler set for the reader. Handler instances may be updated during the course of data parsing.
- Date
- Created 2013/05/02 20:41
- Copyright
- Copyright © 2013, Sans Pareil Technologies, Inc.
- Author
- Rakesh
- Version
- Id
- Reader.h 5677 2014-10-26 12:36:27Z rakesh
Create a new parser instance using the specified call-back handler to send JSON data event notifications to.
Note: It is possible to specify an empty
handler, in which case the parser will consume the JSON data without producing any output.
- Parameters
-
callback | The call-back handler that will receive data events. |
virtual spt::json::io::Reader::~Reader |
( |
| ) |
|
|
inlinevirtual |
Virtual DTOR for subclasses.
Return the call-back handler set for the parser. This may be nullptr
- Returns
- The call-back handler currently configured for the parser.
bool spt::json::io::Reader::isNumeric |
( |
char |
current | ) |
|
|
protected |
Check to see if current character represents a numeric value.
bool spt::json::io::Reader::isWhiteSpace |
( |
char |
current | ) |
|
|
protected |
Check to see if the specified character is white space.
void spt::json::io::Reader::parseNumber |
( |
const std::string & |
value | ) |
|
|
protected |
Parses the specified string value into a number. The implementation invokes the appropriate callback methods on the handler based on whether the value is integral or floating point.
void spt::json::io::Reader::setHandler |
( |
Handler::Ptr |
callback | ) |
|
|
inline |
Update/set the call-back handler to which JSON data event notifications are sent when parsing the JSON data stream.
Note: Callers may change the handler at any time during the parsing phase. This is most useful if one handler delegates the event handling to another handler, which in turn may delegate to another handler depending upon the events being received. This way implementations may use dedicated handlers for parsing specific JSON data structures from the full JSON data.
Note: No locks/mutexes are in use, hence this is not meant to be invoked for other threads. The design goal is to allow handlers to delegate to other handlers, and thus not get into any concurrent modification issues.
- Parameters
-
callback | The call-back handler to use. |
const std::string spt::json::io::Reader::False |
|
staticprotected |
A constant representing a JSON false
value.
The call-back handler to send data event notifications to.
const std::string spt::json::io::Reader::null |
|
staticprotected |
A constant representing a JSON null
value.
const std::string spt::json::io::Reader::True |
|
staticprotected |
A constant representing a JSON true
value.
The documentation for this struct was generated from the following file:
- /Users/rakesh/svn/cpp/json/src/api/spt/json/io/Reader.h