|
|
| xiiJSONReader () |
| | Copyright (c) Theophilus Eriata. All Rights Reserved.
|
| xiiResult | Parse (xiiStreamReader &ref_input, xiiUInt32 uiFirstLineOffset=0) |
|
const xiiVariantDictionary & | GetTopLevelObject () const |
| | Returns the top-level object of the JSON document.
|
|
const xiiVariantArray & | GetTopLevelArray () const |
| | Returns the top-level array of the JSON document.
|
|
ElementType | GetTopLevelElementType () const |
| | Returns whether the top level element is an array or an object.
|
| | xiiJSONParser () |
| | Constructor.
|
|
void | SetLogInterface (xiiLogInterface *pLog) |
| | Allows to specify a xiiLogInterface through which errors and warnings are reported.
|
|
| virtual bool | OnVariable (xiiStringView sVarName) override |
| | This function can be overridden to skip certain variables, however the overriding function must still call this.
|
| virtual void | OnReadValue (xiiStringView sValue) override |
| | [internal] Do not override further.
|
| virtual void | OnReadValue (double fValue) override |
| | [internal] Do not override further.
|
| virtual void | OnReadValue (bool bValue) override |
| | [internal] Do not override further.
|
| virtual void | OnReadValueNULL () override |
| | [internal] Do not override further.
|
| virtual void | OnBeginObject () override |
| | [internal] Do not override further.
|
| virtual void | OnEndObject () override |
| | [internal] Do not override further.
|
| virtual void | OnBeginArray () override |
| | [internal] Do not override further.
|
| virtual void | OnEndArray () override |
| | [internal] Do not override further.
|
| virtual void | OnParsingError (xiiStringView sMessage, bool bFatal, xiiUInt32 uiLine, xiiUInt32 uiColumn) override |
Copyright (c) Theophilus Eriata. All Rights Reserved.
This JSON reader will read an entire JSON document into a hierarchical structure of xiiVariants.
The reader will parse the entire document and create a data structure of xiiVariants, which can then be traversed easily. Note that this class is much less efficient at reading large JSON documents, as it will dynamically allocate and copy objects around quite a bit. For small to medium sized documents that might be good enough, for large files one should prefer to write a dedicated class derived from xiiJSONParser.
| void xiiJSONReader::OnParsingError |
( |
xiiStringView | sMessage, |
|
|
bool | bFatal, |
|
|
xiiUInt32 | uiLine, |
|
|
xiiUInt32 | uiColumn ) |
|
overrideprivatevirtual |
Called when something unexpected is encountered in the JSON document.
The error message describes what was expected and what was encountered. If bFatal is true, the error has left the parser in an unrecoverable state and thus it not continue parsing. In that case client code will need to clean up it's open state, as no further OnEndObject() / OnEndArray() will be called. If bFatal is false, the document does not contain valid JSON, but the parser is able to continue still.
Reimplemented from xiiJSONParser.