HDK
|
UT_JSONHandle processes events from a UT_JSONParser parser. More...
#include <UT_JSONHandle.h>
Public Member Functions | |
UT_JSONHandle () | |
virtual | ~UT_JSONHandle () |
UT_JSONHandle (const UT_JSONHandle &)=delete | |
UT_JSONHandle & | operator= (const UT_JSONHandle &)=delete |
bool | parseObject (UT_JSONParser &p, UT_IStream *is=0) |
Convenience method to parse a single object. More... | |
virtual bool | jsonNull (UT_JSONParser &p)=0 |
Event method to process a null token. More... | |
virtual bool | jsonBool (UT_JSONParser &p, bool value)=0 |
Event method to process a bool (true or false tokens) More... | |
virtual bool | jsonInt (UT_JSONParser &p, int64 value)=0 |
Event method to process an integer. More... | |
virtual bool | jsonReal (UT_JSONParser &p, fpreal64 value)=0 |
Event method to process a real/float. More... | |
virtual bool | jsonString (UT_JSONParser &p, const char *value, int64 len)=0 |
Event method to process a string value. More... | |
virtual bool | jsonStringHolder (UT_JSONParser &p, const UT_StringHolder &s) |
virtual bool | jsonKey (UT_JSONParser &p, const char *v, int64 len)=0 |
Event method to process the key of a map/object is read. More... | |
virtual bool | jsonKeyHolder (UT_JSONParser &p, const UT_StringHolder &s) |
virtual bool | jsonBeginMap (UT_JSONParser &p)=0 |
Event method invoked at the start of a map/object. More... | |
virtual bool | jsonEndMap (UT_JSONParser &p)=0 |
Event method invoked at the end of a map/object. More... | |
virtual bool | jsonBeginArray (UT_JSONParser &p)=0 |
Event method invoked at the beginning of an array object. More... | |
virtual bool | jsonEndArray (UT_JSONParser &p)=0 |
Event method invoked at the end of an array object. More... | |
virtual bool | uaBool (UT_JSONParser &p, int64 length) |
virtual bool | uaInt8 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of int8 data. More... | |
virtual bool | uaInt16 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of int16 data. More... | |
virtual bool | uaInt32 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of int32 data. More... | |
virtual bool | uaInt64 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of int64 data. More... | |
virtual bool | uaReal16 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of real16 data. More... | |
virtual bool | uaReal32 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of real32 data. More... | |
virtual bool | uaReal64 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of real64 data. More... | |
virtual bool | uaUInt8 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of unsigned uint8 data. More... | |
virtual bool | uaUInt16 (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of unsigned uint16 data. More... | |
virtual bool | uaString (UT_JSONParser &p, int64 length) |
Event method to handle uniform array of string data (use uaReadString) More... | |
virtual bool | uaStringToken (UT_JSONParser &p, int64 length) |
virtual void | errorPrefix (UT_JSONParser &p, UT_WorkBuffer &msg) |
Static Public Member Functions | |
static UT_JSONHandle * | getNullHandle () |
static void | releaseNullHandle (UT_JSONHandle *h) |
Instead of deleting the null handle, please call releaseNullHandle() More... | |
Protected Member Functions | |
bool | isKey (const char *s1, const char *s2) const |
Convenience method to test key values. More... | |
void | skipBadKey (UT_JSONParser &p, const char *key) |
void | fatalBadKey (UT_JSONParser &p, const char *key) |
UT_JSONHandle processes events from a UT_JSONParser parser.
The UT_JSONParser is passed a UT_JSONHandle to interpret the JSON tokens. As each entity is encountered, an event callback is invoked on the handle to process the token.
It's possible to recurse into the parser from within a callback with a different handler and possibly even a different input stream by calling UT_JSONParser::parseObject().
Definition at line 36 of file UT_JSONHandle.h.
|
inline |
Definition at line 38 of file UT_JSONHandle.h.
|
inlinevirtual |
Definition at line 39 of file UT_JSONHandle.h.
|
delete |
|
virtual |
This method is called by addError to create the prefix for error messages. By default, the method looks something like:
|
protected |
Convenience method to add a fatal error about a bad key name addError("Unexpected key token '%s'" % key);
|
static |
The Null Handle acts as a pass through when parsing a JSON file. It can be used for simple syntax checking:
|
inlineprotected |
Convenience method to test key values.
Definition at line 127 of file UT_JSONHandle.h.
|
pure virtual |
Event method invoked at the beginning of an array object.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
pure virtual |
Event method invoked at the start of a map/object.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
pure virtual |
Event method to process a bool (true or false tokens)
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
pure virtual |
Event method invoked at the end of an array object.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
pure virtual |
Event method invoked at the end of a map/object.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
pure virtual |
Event method to process an integer.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
pure virtual |
Event method to process the key of a map/object is read.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
virtual |
|
pure virtual |
Event method to process a null token.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
pure virtual |
Event method to process a real/float.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
pure virtual |
Event method to process a string value.
Implemented in UT_JSONHandleNull, UT_JSONHandleError, and UT_PerfMonJSONHandle.
|
virtual |
The string event taking a UT_StringHolder calls the jsonString() method by default. However, if you can process a UT_StringHolder instead, you can get a direct reference to the UT_StringHolder.
|
delete |
bool UT_JSONHandle::parseObject | ( | UT_JSONParser & | p, |
UT_IStream * | is = 0 |
||
) |
Convenience method to parse a single object.
|
static |
Instead of deleting the null handle, please call releaseNullHandle()
|
protected |
Convenience method to add an error about a bad key name addError("Unexpected key token '%s'" % key); This also skips the next object.
|
virtual |
Event method to handle for uniform array of bool (encoded as bit fields)
|
virtual |
Event method to handle uniform array of int16 data.
|
virtual |
Event method to handle uniform array of int32 data.
|
virtual |
Event method to handle uniform array of int64 data.
|
virtual |
Event method to handle uniform array of int8 data.
|
virtual |
Event method to handle uniform array of real16 data.
|
virtual |
Event method to handle uniform array of real32 data.
|
virtual |
Event method to handle uniform array of real64 data.
|
virtual |
Event method to handle uniform array of string data (use uaReadString)
|
virtual |
Event method to handle uniform array of string token data (use uaReadStringToken)
|
virtual |
Event method to handle uniform array of unsigned uint16 data.
|
virtual |
Event method to handle uniform array of unsigned uint8 data.