ROOTANA
|
#include <mjson.h>
Public Member Functions | |
~MJsonNode () | |
std::string | Stringify (int flags=0) const |
void | AddToArray (MJsonNode *node) |
void | AddToObject (const char *name, MJsonNode *node) |
add node to an array. the array takes ownership of this node | |
void | DeleteObjectNode (const char *name) |
add node to an object. the object takes ownership of this node | |
int | GetType () const |
delete a node from an object | |
const MJsonNodeVector * | GetArray () const |
get node type: MJSON_xxx | |
const MJsonStringVector * | GetObjectNames () const |
get array value, NULL if not array, empty array if value is JSON "null" | |
const MJsonNodeVector * | GetObjectNodes () const |
get array of object names, NULL if not object, empty array if value is JSON "null" | |
const MJsonNode * | FindObjectNode (const char *name) const |
get array of object subnodes, NULL if not object, empty array if value is JSON "null" | |
std::string | GetString () const |
find subnode with given name, NULL if not object, NULL is name not found | |
long long | GetInt () const |
get string value, "" if not string or value is JSON "null" | |
long long | GetLL () const |
get integer value, 0 if not an integer or value is JSON "null" | |
double | GetDouble () const |
get 64-bit long long value, 0 if not an integer or value is JSON "null" | |
bool | GetBool () const |
get number or integer value, 0 if not a number or value is JSON "null" | |
void | GetArrayBuffer (const char **pptr, size_t *psize) const |
get boolean value, false if not a boolean or value is JSON "null" | |
std::string | GetError () const |
void | Dump (int nest=0) const |
return node type as string | |
MJsonNode * | Copy () const |
dump the subtree to standard output | |
~MJsonNode () | |
std::string | Stringify (int flags=0) const |
void | AddToArray (MJsonNode *node) |
void | AddToObject (const char *name, MJsonNode *node) |
add node to an array. the array takes ownership of this node | |
void | DeleteObjectNode (const char *name) |
add node to an object. the object takes ownership of this node | |
int | GetType () const |
delete a node from an object | |
const MJsonNodeVector * | GetArray () const |
get node type: MJSON_xxx | |
const MJsonStringVector * | GetObjectNames () const |
get array value, NULL if not array, empty array if value is JSON "null" | |
const MJsonNodeVector * | GetObjectNodes () const |
get array of object names, NULL if not object, empty array if value is JSON "null" | |
const MJsonNode * | FindObjectNode (const char *name) const |
get array of object subnodes, NULL if not object, empty array if value is JSON "null" | |
std::string | GetString () const |
find subnode with given name, NULL if not object, NULL is name not found | |
long long | GetInt () const |
get string value, "" if not string or value is JSON "null" | |
long long | GetLL () const |
get integer value, 0 if not an integer or value is JSON "null" | |
double | GetDouble () const |
get 64-bit long long value, 0 if not an integer or value is JSON "null" | |
bool | GetBool () const |
get number or integer value, 0 if not a number or value is JSON "null" | |
void | GetArrayBuffer (const char **pptr, size_t *psize) const |
get boolean value, false if not a boolean or value is JSON "null" | |
std::string | GetError () const |
void | Dump (int nest=0) const |
return node type as string | |
MJsonNode * | Copy () const |
dump the subtree to standard output | |
Static Public Member Functions | |
static MJsonNode * | Parse (const char *jsonstring) |
static std::string | Encode (const char *s) |
static std::string | EncodeLL (long long v) |
static std::string | EncodeDouble (double v) |
static MJsonNode * | MakeArray () |
static MJsonNode * | MakeObject () |
static MJsonNode * | MakeString (const char *value) |
static MJsonNode * | MakeInt (long long value) |
static MJsonNode * | MakeNumber (double value) |
static MJsonNode * | MakeBool (bool value) |
static MJsonNode * | MakeNull () |
static MJsonNode * | MakeJSON (const char *json) |
static MJsonNode * | MakeArrayBuffer (char *ptr, size_t size) |
static MJsonNode * | MakeError (MJsonNode *errornode, const char *errormessage, const char *sin, const char *serror) |
the node takes ownership of the buffer | |
static const char * | TypeToString (int type) |
get error message from MJSON_ERROR nodes | |
static MJsonNode * | Parse (const char *jsonstring) |
static std::string | Encode (const char *s) |
static std::string | EncodeLL (long long v) |
static std::string | EncodeDouble (double v) |
static MJsonNode * | MakeArray () |
static MJsonNode * | MakeObject () |
static MJsonNode * | MakeString (const char *value) |
static MJsonNode * | MakeInt (long long value) |
static MJsonNode * | MakeNumber (double value) |
static MJsonNode * | MakeBool (bool value) |
static MJsonNode * | MakeNull () |
static MJsonNode * | MakeJSON (const char *json) |
static MJsonNode * | MakeArrayBuffer (char *ptr, size_t size) |
static MJsonNode * | MakeError (MJsonNode *errornode, const char *errormessage, const char *sin, const char *serror) |
the node takes ownership of the buffer | |
static const char * | TypeToString (int type) |
get error message from MJSON_ERROR nodes | |
Protected Member Functions | |
MJsonNode (int type) | |
make a copy of the json tree | |
MJsonNode (int type) | |
make a copy of the json tree | |
Protected Attributes | |
int | type |
MJsonNodeVector | subnodes |
MJsonStringVector | object_names |
std::string | string_value |
long long | ll_value = 0 |
double | double_value = 0 |
size_t | arraybuffer_size = 0 |
char * | arraybuffer_ptr = NULL |
Private Member Functions | |
MJsonNode & | operator= (const MJsonNode &) |
MJsonNode & | operator= (const MJsonNode &) |
MJsonNode::~MJsonNode | ( | ) |
|
protected |
make a copy of the json tree
void MJsonNode::AddToArray | ( | MJsonNode * | node | ) |
void MJsonNode::AddToObject | ( | const char * | name, |
MJsonNode * | node | ||
) |
add node to an array. the array takes ownership of this node
MJsonNode * MJsonNode::Copy | ( | ) | const |
dump the subtree to standard output
void MJsonNode::DeleteObjectNode | ( | const char * | name | ) |
add node to an object. the object takes ownership of this node
void MJsonNode::Dump | ( | int | nest = 0 | ) | const |
return node type as string
|
static |
|
static |
|
static |
const MJsonNode * MJsonNode::FindObjectNode | ( | const char * | name | ) | const |
get array of object subnodes, NULL if not object, empty array if value is JSON "null"
const MJsonNodeVector * MJsonNode::GetArray | ( | ) | const |
get node type: MJSON_xxx
void MJsonNode::GetArrayBuffer | ( | const char ** | pptr, |
size_t * | psize | ||
) | const |
get boolean value, false if not a boolean or value is JSON "null"
bool MJsonNode::GetBool | ( | ) | const |
get number or integer value, 0 if not a number or value is JSON "null"
double MJsonNode::GetDouble | ( | ) | const |
get 64-bit long long value, 0 if not an integer or value is JSON "null"
std::string MJsonNode::GetError | ( | ) | const |
long long MJsonNode::GetInt | ( | ) | const |
get string value, "" if not string or value is JSON "null"
long long MJsonNode::GetLL | ( | ) | const |
get integer value, 0 if not an integer or value is JSON "null"
const MJsonStringVector * MJsonNode::GetObjectNames | ( | ) | const |
get array value, NULL if not array, empty array if value is JSON "null"
const MJsonNodeVector * MJsonNode::GetObjectNodes | ( | ) | const |
get array of object names, NULL if not object, empty array if value is JSON "null"
std::string MJsonNode::GetString | ( | ) | const |
find subnode with given name, NULL if not object, NULL is name not found
int MJsonNode::GetType | ( | ) | const |
delete a node from an object
|
static |
|
static |
|
static |
|
static |
the node takes ownership of the buffer
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
std::string MJsonNode::Stringify | ( | int | flags = 0 | ) | const |
|
static |
get error message from MJSON_ERROR nodes