19 #define MJSON_ERROR -1
22 #define MJSON_OBJECT 2
23 #define MJSON_STRING 3
25 #define MJSON_NUMBER 5
29 #define MJSON_ARRAYBUFFER 9
54 std::string
Stringify(
int flags = 0)
const;
57 static std::string
Encode(
const char* s);
58 static std::string
EncodeLL(
long long v);
88 long long GetLL()
const;
96 void Dump(
int nest = 0)
const;
std::string GetString() const
find subnode with given name, NULL if not object, NULL is name not found
static MJsonNode * MakeJSON(const char *json)
void Dump(int nest=0) const
return node type as string
static MJsonNode * MakeArray()
MJsonNode * Copy() const
dump the subtree to standard output
const MJsonNodeVector * GetArray() const
get node type: MJSON_xxx
long long GetLL() const
get integer value, 0 if not an integer or value is JSON "null"
MJsonStringVector object_names
int GetType() const
delete a node from an object
void AddToArray(MJsonNode *node)
static MJsonNode * MakeNumber(double value)
static std::string Encode(const char *s)
std::vector< MJsonNode * > MJsonNodeVector
std::vector< std::string > MJsonStringVector
long long GetInt() const
get string value, "" if not string or value is JSON "null"
MJsonNode(int type)
make a copy of the json tree
static MJsonNode * MakeObject()
void AddToObject(const char *name, MJsonNode *node)
add node to an array. the array takes ownership of this node
double GetDouble() const
get 64-bit long long value, 0 if not an integer or value is JSON "null"
const MJsonNodeVector * GetObjectNodes() const
get array of object names, NULL if not object, empty array if value is JSON "null"
static MJsonNode * MakeBool(bool value)
std::string Stringify(int flags=0) const
static MJsonNode * MakeString(const char *value)
void DeleteObjectNode(const char *name)
add node to an object. the object takes ownership of this node
bool GetBool() const
get number or integer value, 0 if not a number or value is JSON "null"
static MJsonNode * MakeInt(long long value)
static std::string EncodeDouble(double v)
void GetArrayBuffer(const char **pptr, size_t *psize) const
get boolean value, false if not a boolean or value is JSON "null"
const MJsonStringVector * GetObjectNames() const
get array value, NULL if not array, empty array if value is JSON "null"
static MJsonNode * MakeError(MJsonNode *errornode, const char *errormessage, const char *sin, const char *serror)
the node takes ownership of the buffer
const MJsonNode * FindObjectNode(const char *name) const
get array of object subnodes, NULL if not object, empty array if value is JSON "null"
static MJsonNode * MakeArrayBuffer(char *ptr, size_t size)
MJsonNode & operator=(const MJsonNode &)
static std::string EncodeLL(long long v)
static MJsonNode * MakeNull()
std::string GetError() const
static MJsonNode * Parse(const char *jsonstring)
static const char * TypeToString(int type)
get error message from MJSON_ERROR nodes