IToolkitJSON
IToolkitJSON
IToolkitJSONValue
bool IsNull()
bool IsObject()
bool IsArray()
bool IsString()
bool IsNumber()
bool IsBool()
bool Has(pszKey)
@brief Whether this object has the key. False for anything but an object.
- pszKey const char*
const IToolkitJSONValue* Get(pszKey)
@brief The value at a key, or null when absent or not an object.
- pszKey const char*
int Count()
@brief Elements in an array, or members in an object. Zero otherwise.
const IToolkitJSONValue* At(nIndex)
@brief The element at an index, or null when out of range or not an array.
- nIndex int
const char* KeyAt(nIndex)
@brief The key of the member at an index, for walking an object. Null when out of range or not an object.
- nIndex int
const char* AsString(pszDefault)
This node's value, or pszDefault when it is not a string.
- pszDefault const char*
int64_t AsInt64(nDefault)
- nDefault int64_t
int AsInt(nDefault)
- nDefault int
double AsDouble(flDefault)
- flDefault double
float AsFloat(flDefault)
- flDefault float
bool AsBool(bDefault)
- bDefault bool
const char* GetString(pszKey, pszDefault)
@brief Shorthand for Get(key) then the matching As*, with the default when the key is missing or the wrong type.
- pszKey const char*
- pszDefault const char*
int64_t GetInt64(pszKey, nDefault)
- pszKey const char*
- nDefault int64_t
int GetInt(pszKey, nDefault)
- pszKey const char*
- nDefault int
double GetDouble(pszKey, flDefault)
- pszKey const char*
- flDefault double
float GetFloat(pszKey, flDefault)
- pszKey const char*
- flDefault float
bool GetBool(pszKey, bDefault)
- pszKey const char*
- bDefault bool
const char* Dump(nIndent)
This node serialised back to text.
- nIndent int — Spaces per level, or -1 for the compact form.
IToolkitJSONDocument
bool IsValid()
@brief Whether the text parsed. A failed parse still returns a document, whose root reads as null, so a caller can skip the check.
const char* GetError()
@brief The parser's complaint, or an empty string when IsValid().
const IToolkitJSONValue* Root()
Release()
@brief Frees the document and everything reached through it.
IToolkitJSON
IToolkitJSONDocument* Parse(pszText, nLength)
Parses text into a document the caller then owns.
- pszText const char* — JSON text.
- nLength int — Length, or -1 to read up to the terminator.