ROOTANA
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions | Variables
JSON Functions

Data Structures

class  MJsonNode
 

Macros

#define MJSON_ERROR   -1
 
#define MJSON_NONE   0
 
#define MJSON_ARRAY   1
 
#define MJSON_OBJECT   2
 
#define MJSON_STRING   3
 
#define MJSON_INT   4
 
#define MJSON_NUMBER   5
 
#define MJSON_BOOL   6
 
#define MJSON_NULL   7
 
#define MJSON_JSON   8
 
#define MJSON_ARRAYBUFFER   9
 
#define MJSON_ERROR   -1
 
#define MJSON_NONE   0
 
#define MJSON_ARRAY   1
 
#define MJSON_OBJECT   2
 
#define MJSON_STRING   3
 
#define MJSON_INT   4
 
#define MJSON_NUMBER   5
 
#define MJSON_BOOL   6
 
#define MJSON_NULL   7
 
#define MJSON_JSON   8
 
#define MJSON_ARRAYBUFFER   9
 

Typedefs

typedef std::vector< std::string > MJsonStringVector
 
typedef std::vector< MJsonNode * > MJsonNodeVector
 
typedef std::vector< std::string > MJsonStringVector
 
typedef std::vector< MJsonNode * > MJsonNodeVector
 

Functions

 MJsonNode::~MJsonNode ()
 
static MJsonNodeMJsonNode::Parse (const char *jsonstring)
 
std::string MJsonNode::Stringify (int flags=0) const
 
static std::string MJsonNode::Encode (const char *s)
 
static std::string MJsonNode::EncodeLL (long long v)
 
static std::string MJsonNode::EncodeDouble (double v)
 
static MJsonNodeMJsonNode::MakeArray ()
 
static MJsonNodeMJsonNode::MakeObject ()
 
static MJsonNodeMJsonNode::MakeString (const char *value)
 
static MJsonNodeMJsonNode::MakeInt (long long value)
 
static MJsonNodeMJsonNode::MakeNumber (double value)
 
static MJsonNodeMJsonNode::MakeBool (bool value)
 
static MJsonNodeMJsonNode::MakeNull ()
 
static MJsonNodeMJsonNode::MakeJSON (const char *json)
 
static MJsonNodeMJsonNode::MakeArrayBuffer (char *ptr, size_t size)
 
static MJsonNodeMJsonNode::MakeError (MJsonNode *errornode, const char *errormessage, const char *sin, const char *serror)
 the node takes ownership of the buffer
 
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
 
void MJsonNode::DeleteObjectNode (const char *name)
 add node to an object. the object takes ownership of this node
 
int MJsonNode::GetType () const
 delete a node from an object
 
const MJsonNodeVectorMJsonNode::GetArray () const
 get node type: MJSON_xxx
 
const MJsonStringVectorMJsonNode::GetObjectNames () const
 get array value, NULL if not array, empty array if value is JSON "null"
 
const MJsonNodeVectorMJsonNode::GetObjectNodes () const
 get array of object names, NULL if not object, empty array if value is JSON "null"
 
const MJsonNodeMJsonNode::FindObjectNode (const char *name) const
 get array of object subnodes, 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
 
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"
 
double MJsonNode::GetDouble () const
 get 64-bit long long value, 0 if not an integer or value is JSON "null"
 
bool MJsonNode::GetBool () const
 get number or integer value, 0 if not a number or value is JSON "null"
 
void MJsonNode::GetArrayBuffer (const char **pptr, size_t *psize) const
 get boolean value, false if not a boolean or value is JSON "null"
 
std::string MJsonNode::GetError () const
 
static const char * MJsonNode::TypeToString (int type)
 get error message from MJSON_ERROR nodes
 
void MJsonNode::Dump (int nest=0) const
 return node type as string
 
MJsonNodeMJsonNode::Copy () const
 dump the subtree to standard output
 
 MJsonNode::MJsonNode (int type)
 make a copy of the json tree
 
MJsonNodeMJsonNode::operator= (const MJsonNode &)
 

Variables

int MJsonNode::type
 
MJsonNodeVector MJsonNode::subnodes
 
MJsonStringVector MJsonNode::object_names
 
std::string MJsonNode::string_value
 
long long MJsonNode::ll_value = 0
 
double MJsonNode::double_value = 0
 
size_t MJsonNode::arraybuffer_size = 0
 
char * MJsonNode::arraybuffer_ptr = NULL
 

Detailed Description


Macro Definition Documentation

◆ MJSON_ARRAY [1/2]

#define MJSON_ARRAY   1

Definition at line 21 of file mjson.h.

◆ MJSON_ARRAY [2/2]

#define MJSON_ARRAY   1

Definition at line 21 of file mjson.h.

◆ MJSON_ARRAYBUFFER [1/2]

#define MJSON_ARRAYBUFFER   9

Definition at line 29 of file mjson.h.

◆ MJSON_ARRAYBUFFER [2/2]

#define MJSON_ARRAYBUFFER   9

Definition at line 29 of file mjson.h.

◆ MJSON_BOOL [1/2]

#define MJSON_BOOL   6

Definition at line 26 of file mjson.h.

◆ MJSON_BOOL [2/2]

#define MJSON_BOOL   6

Definition at line 26 of file mjson.h.

◆ MJSON_ERROR [1/2]

#define MJSON_ERROR   -1

Definition at line 19 of file mjson.h.

◆ MJSON_ERROR [2/2]

#define MJSON_ERROR   -1

Definition at line 19 of file mjson.h.

◆ MJSON_INT [1/2]

#define MJSON_INT   4

Definition at line 24 of file mjson.h.

◆ MJSON_INT [2/2]

#define MJSON_INT   4

Definition at line 24 of file mjson.h.

◆ MJSON_JSON [1/2]

#define MJSON_JSON   8

Definition at line 28 of file mjson.h.

◆ MJSON_JSON [2/2]

#define MJSON_JSON   8

Definition at line 28 of file mjson.h.

◆ MJSON_NONE [1/2]

#define MJSON_NONE   0

Definition at line 20 of file mjson.h.

◆ MJSON_NONE [2/2]

#define MJSON_NONE   0

Definition at line 20 of file mjson.h.

◆ MJSON_NULL [1/2]

#define MJSON_NULL   7

Definition at line 27 of file mjson.h.

◆ MJSON_NULL [2/2]

#define MJSON_NULL   7

Definition at line 27 of file mjson.h.

◆ MJSON_NUMBER [1/2]

#define MJSON_NUMBER   5

Definition at line 25 of file mjson.h.

◆ MJSON_NUMBER [2/2]

#define MJSON_NUMBER   5

Definition at line 25 of file mjson.h.

◆ MJSON_OBJECT [1/2]

#define MJSON_OBJECT   2

Definition at line 22 of file mjson.h.

◆ MJSON_OBJECT [2/2]

#define MJSON_OBJECT   2

Definition at line 22 of file mjson.h.

◆ MJSON_STRING [1/2]

#define MJSON_STRING   3

Definition at line 23 of file mjson.h.

◆ MJSON_STRING [2/2]

#define MJSON_STRING   3

Definition at line 23 of file mjson.h.

Typedef Documentation

◆ MJsonNodeVector [1/2]

typedef std::vector<MJsonNode*> MJsonNodeVector

Definition at line 34 of file mjson.h.

◆ MJsonNodeVector [2/2]

typedef std::vector<MJsonNode*> MJsonNodeVector

Definition at line 34 of file mjson.h.

◆ MJsonStringVector [1/2]

typedef std::vector<std::string> MJsonStringVector

Definition at line 33 of file mjson.h.

◆ MJsonStringVector [2/2]

typedef std::vector<std::string> MJsonStringVector

Definition at line 33 of file mjson.h.

Function Documentation

◆ AddToArray()

void MJsonNode::AddToArray ( MJsonNode node)

Definition at line 882 of file mjson.cxx.

Here is the caller graph for this function:

◆ AddToObject()

void MJsonNode::AddToObject ( const char *  name,
MJsonNode node 
)

add node to an array. the array takes ownership of this node

add node to an object

Definition at line 892 of file mjson.cxx.

Here is the caller graph for this function:

◆ Copy()

MJsonNode * MJsonNode::Copy ( ) const

dump the subtree to standard output

Definition at line 1110 of file mjson.cxx.

◆ DeleteObjectNode()

void MJsonNode::DeleteObjectNode ( const char *  name)

add node to an object. the object takes ownership of this node

Definition at line 944 of file mjson.cxx.

◆ Dump()

void MJsonNode::Dump ( int  nest = 0) const

return node type as string

Definition at line 1071 of file mjson.cxx.

Here is the call graph for this function:

◆ Encode()

std::string MJsonNode::Encode ( const char *  s)
static

Definition at line 678 of file mjson.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EncodeDouble()

std::string MJsonNode::EncodeDouble ( double  v)
static

Definition at line 717 of file mjson.cxx.

Here is the caller graph for this function:

◆ EncodeLL()

std::string MJsonNode::EncodeLL ( long long  v)
static

Definition at line 710 of file mjson.cxx.

Here is the caller graph for this function:

◆ FindObjectNode()

const MJsonNode * MJsonNode::FindObjectNode ( const char *  name) const

get array of object subnodes, NULL if not object, empty array if value is JSON "null"

Definition at line 933 of file mjson.cxx.

◆ GetArray()

const MJsonNodeVector * MJsonNode::GetArray ( ) const

get node type: MJSON_xxx

Definition at line 909 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetArrayBuffer()

void MJsonNode::GetArrayBuffer ( const char **  pptr,
size_t *  psize 
) const

get boolean value, false if not a boolean or value is JSON "null"

Definition at line 1019 of file mjson.cxx.

◆ GetBool()

bool MJsonNode::GetBool ( ) const

get number or integer value, 0 if not a number or value is JSON "null"

get boolean value, false if not a boolean or value is JSON "null"

Definition at line 1011 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetDouble()

double MJsonNode::GetDouble ( ) const

get 64-bit long long value, 0 if not an integer or value is JSON "null"

Definition at line 985 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetError()

std::string MJsonNode::GetError ( ) const

Definition at line 1034 of file mjson.cxx.

◆ GetInt()

long long MJsonNode::GetInt ( ) const

get string value, "" if not string or value is JSON "null"

Definition at line 969 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetLL()

long long MJsonNode::GetLL ( ) const

get integer value, 0 if not an integer or value is JSON "null"

Definition at line 977 of file mjson.cxx.

◆ GetObjectNames()

const MJsonStringVector * MJsonNode::GetObjectNames ( ) const

get array value, NULL if not array, empty array if value is JSON "null"

Definition at line 917 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetObjectNodes()

const MJsonNodeVector * MJsonNode::GetObjectNodes ( ) const

get array of object names, NULL if not object, empty array if value is JSON "null"

Definition at line 925 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetString()

std::string MJsonNode::GetString ( ) const

find subnode with given name, NULL if not object, NULL is name not found

Definition at line 961 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetType()

int MJsonNode::GetType ( ) const

delete a node from an object

get node type: MJSON_xxx

Definition at line 904 of file mjson.cxx.

Here is the caller graph for this function:

◆ MakeArray()

MJsonNode * MJsonNode::MakeArray ( )
static

Definition at line 821 of file mjson.cxx.

Here is the caller graph for this function:

◆ MakeArrayBuffer()

MJsonNode * MJsonNode::MakeArrayBuffer ( char *  ptr,
size_t  size 
)
static

Definition at line 874 of file mjson.cxx.

◆ MakeBool()

MJsonNode * MJsonNode::MakeBool ( bool  value)
static

Definition at line 852 of file mjson.cxx.

Here is the caller graph for this function:

◆ MakeError()

MJsonNode * MJsonNode::MakeError ( MJsonNode errornode,
const char *  errormessage,
const char *  sin,
const char *  serror 
)
static

the node takes ownership of the buffer

Definition at line 791 of file mjson.cxx.

Here is the caller graph for this function:

◆ MakeInt()

MJsonNode * MJsonNode::MakeInt ( long long  value)
static

Definition at line 838 of file mjson.cxx.

Here is the caller graph for this function:

◆ MakeJSON()

MJsonNode * MJsonNode::MakeJSON ( const char *  json)
static

Definition at line 867 of file mjson.cxx.

◆ MakeNull()

MJsonNode * MJsonNode::MakeNull ( )
static

Definition at line 862 of file mjson.cxx.

Here is the caller graph for this function:

◆ MakeNumber()

MJsonNode * MJsonNode::MakeNumber ( double  value)
static

Definition at line 845 of file mjson.cxx.

Here is the caller graph for this function:

◆ MakeObject()

MJsonNode * MJsonNode::MakeObject ( )
static

Definition at line 826 of file mjson.cxx.

Here is the caller graph for this function:

◆ MakeString()

MJsonNode * MJsonNode::MakeString ( const char *  value)
static

Definition at line 831 of file mjson.cxx.

Here is the caller graph for this function:

◆ MJsonNode()

MJsonNode::MJsonNode ( int  type)
protected

make a copy of the json tree

Definition at line 1042 of file mjson.cxx.

◆ operator=()

MJsonNode & MJsonNode::operator= ( const MJsonNode )
private

◆ Parse()

MJsonNode * MJsonNode::Parse ( const char *  jsonstring)
static

Definition at line 645 of file mjson.cxx.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Stringify()

std::string MJsonNode::Stringify ( int  flags = 0) const

Definition at line 736 of file mjson.cxx.

Here is the call graph for this function:

◆ TypeToString()

const char * MJsonNode::TypeToString ( int  type)
static

get error message from MJSON_ERROR nodes

Definition at line 1047 of file mjson.cxx.

Here is the caller graph for this function:

◆ ~MJsonNode()

MJsonNode::~MJsonNode ( )

Definition at line 651 of file mjson.cxx.

Variable Documentation

◆ arraybuffer_ptr

char * MJsonNode::arraybuffer_ptr = NULL
protected

Definition at line 45 of file mjson.h.

◆ arraybuffer_size

size_t MJsonNode::arraybuffer_size = 0
protected

Definition at line 44 of file mjson.h.

◆ double_value

double MJsonNode::double_value = 0
protected

Definition at line 43 of file mjson.h.

◆ ll_value

long long MJsonNode::ll_value = 0
protected

Definition at line 42 of file mjson.h.

◆ object_names

MJsonStringVector MJsonNode::object_names
protected

Definition at line 40 of file mjson.h.

◆ string_value

std::string MJsonNode::string_value
protected

Definition at line 41 of file mjson.h.

◆ subnodes

MJsonNodeVector MJsonNode::subnodes
protected

Definition at line 39 of file mjson.h.

◆ type

int MJsonNode::type
protected

Definition at line 38 of file mjson.h.