ROOTANA
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::EncodeInt (int v)
 
static std::string MJsonNode::EncodeDouble (double v)
 
static MJsonNodeMJsonNode::MakeArray ()
 
static MJsonNodeMJsonNode::MakeObject ()
 
static MJsonNodeMJsonNode::MakeString (const char *value)
 
static MJsonNodeMJsonNode::MakeInt (int 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 More...
 
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 More...
 
void MJsonNode::DeleteObjectNode (const char *name)
 add node to an object. the object takes ownership of this node More...
 
int MJsonNode::GetType () const
 delete a node from an object More...
 
const MJsonNodeVectorMJsonNode::GetArray () const
 get node type: MJSON_xxx More...
 
const MJsonStringVectorMJsonNode::GetObjectNames () const
 get array value, NULL if not array, empty array if value is JSON "null" More...
 
const MJsonNodeVectorMJsonNode::GetObjectNodes () const
 get array of object names, NULL if not object, empty array if value is JSON "null" More...
 
const MJsonNodeMJsonNode::FindObjectNode (const char *name) const
 get array of object subnodes, NULL if not object, empty array if value is JSON "null" More...
 
std::string MJsonNode::GetString () const
 find subnode with given name, NULL if not object, NULL is name not found More...
 
int MJsonNode::GetInt () const
 get string value, "" if not string or value is JSON "null" More...
 
double MJsonNode::GetDouble () const
 get integer value, 0 if not an integer or value is JSON "null" More...
 
bool MJsonNode::GetBool () const
 get number or integer value, 0 if not a number or value is JSON "null" More...
 
void MJsonNode::GetArrayBuffer (const char **pptr, size_t *psize) const
 get boolean value, false if not a boolean or value is JSON "null" More...
 
std::string MJsonNode::GetError () const
 
static const char * MJsonNode::TypeToString (int type)
 get error message from MJSON_ERROR nodes More...
 
void MJsonNode::Dump (int nest=0) const
 return node type as string More...
 
MJsonNodeMJsonNode::Copy () const
 dump the subtree to standard output More...
 
 MJsonNode::MJsonNode (int type)
 make a copy of the json tree More...
 
MJsonNodeMJsonNode::operator= (const MJsonNode &)
 

Variables

int MJsonNode::type
 
MJsonNodeVector MJsonNode::subnodes
 
MJsonStringVector MJsonNode::objectnames
 
std::string MJsonNode::stringvalue
 
int MJsonNode::intvalue
 
double MJsonNode::numbervalue
 
size_t MJsonNode::arraybuffer_size
 
char * MJsonNode::arraybuffer_ptr
 

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 883 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 893 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 1105 of file mjson.cxx.

Here is the call graph for this function:

◆ 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 1066 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:

◆ EncodeInt()

std::string MJsonNode::EncodeInt ( int  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 934 of file mjson.cxx.

◆ GetArray()

const MJsonNodeVector * MJsonNode::GetArray ( ) const

get node type: MJSON_xxx

Definition at line 910 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 1009 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 1001 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetDouble()

double MJsonNode::GetDouble ( ) const

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

Definition at line 976 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetError()

std::string MJsonNode::GetError ( ) const

Definition at line 1024 of file mjson.cxx.

◆ GetInt()

int MJsonNode::GetInt ( ) const

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

Definition at line 968 of file mjson.cxx.

Here is the caller graph for this function:

◆ GetObjectNames()

const MJsonStringVector * MJsonNode::GetObjectNames ( ) const

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

Definition at line 918 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 926 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 960 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 905 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 call graph for this function:
Here is the caller graph for this function:

◆ MakeArrayBuffer()

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

Definition at line 875 of file mjson.cxx.

Here is the call graph for this function:

◆ MakeBool()

MJsonNode * MJsonNode::MakeBool ( bool  value)
static

Definition at line 853 of file mjson.cxx.

Here is the call graph for this function:
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 call graph for this function:
Here is the caller graph for this function:

◆ MakeInt()

MJsonNode * MJsonNode::MakeInt ( int  value)
static

Definition at line 838 of file mjson.cxx.

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

◆ MakeJSON()

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

Definition at line 868 of file mjson.cxx.

Here is the call graph for this function:

◆ MakeNull()

MJsonNode * MJsonNode::MakeNull ( )
static

Definition at line 863 of file mjson.cxx.

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

◆ MakeNumber()

MJsonNode * MJsonNode::MakeNumber ( double  value)
static

Definition at line 846 of file mjson.cxx.

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

◆ MakeObject()

MJsonNode * MJsonNode::MakeObject ( )
static

Definition at line 826 of file mjson.cxx.

Here is the call graph for this function:
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 call graph for this function:
Here is the caller graph for this function:

◆ MJsonNode()

MJsonNode::MJsonNode ( int  type)
protected

make a copy of the json tree

Definition at line 1032 of file mjson.cxx.

Here is the caller graph for this function:

◆ 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 1042 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
protected

Definition at line 45 of file mjson.h.

◆ arraybuffer_size

size_t MJsonNode::arraybuffer_size
protected

Definition at line 44 of file mjson.h.

◆ intvalue

int MJsonNode::intvalue
protected

Definition at line 42 of file mjson.h.

◆ numbervalue

double MJsonNode::numbervalue
protected

Definition at line 43 of file mjson.h.

◆ objectnames

MJsonStringVector MJsonNode::objectnames
protected

Definition at line 40 of file mjson.h.

◆ stringvalue

std::string MJsonNode::stringvalue
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.