ROOTANA
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
MJsonNode Class Reference

#include <mjson.h>

Collaboration diagram for MJsonNode:
Collaboration graph
[legend]

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 More...
 
void DeleteObjectNode (const char *name)
 add node to an object. the object takes ownership of this node More...
 
int GetType () const
 delete a node from an object More...
 
const MJsonNodeVectorGetArray () const
 get node type: MJSON_xxx More...
 
const MJsonStringVectorGetObjectNames () const
 get array value, NULL if not array, empty array if value is JSON "null" More...
 
const MJsonNodeVectorGetObjectNodes () const
 get array of object names, NULL if not object, empty array if value is JSON "null" More...
 
const MJsonNodeFindObjectNode (const char *name) const
 get array of object subnodes, NULL if not object, empty array if value is JSON "null" More...
 
std::string GetString () const
 find subnode with given name, NULL if not object, NULL is name not found More...
 
int GetInt () const
 get string value, "" if not string or value is JSON "null" More...
 
double GetDouble () const
 get integer value, 0 if not an integer or value is JSON "null" More...
 
bool GetBool () const
 get number or integer value, 0 if not a number or value is JSON "null" More...
 
void GetArrayBuffer (const char **pptr, size_t *psize) const
 get boolean value, false if not a boolean or value is JSON "null" More...
 
std::string GetError () const
 
void Dump (int nest=0) const
 return node type as string More...
 
MJsonNodeCopy () const
 dump the subtree to standard output More...
 
 ~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 More...
 
void DeleteObjectNode (const char *name)
 add node to an object. the object takes ownership of this node More...
 
int GetType () const
 delete a node from an object More...
 
const MJsonNodeVectorGetArray () const
 get node type: MJSON_xxx More...
 
const MJsonStringVectorGetObjectNames () const
 get array value, NULL if not array, empty array if value is JSON "null" More...
 
const MJsonNodeVectorGetObjectNodes () const
 get array of object names, NULL if not object, empty array if value is JSON "null" More...
 
const MJsonNodeFindObjectNode (const char *name) const
 get array of object subnodes, NULL if not object, empty array if value is JSON "null" More...
 
std::string GetString () const
 find subnode with given name, NULL if not object, NULL is name not found More...
 
int GetInt () const
 get string value, "" if not string or value is JSON "null" More...
 
double GetDouble () const
 get integer value, 0 if not an integer or value is JSON "null" More...
 
bool GetBool () const
 get number or integer value, 0 if not a number or value is JSON "null" More...
 
void GetArrayBuffer (const char **pptr, size_t *psize) const
 get boolean value, false if not a boolean or value is JSON "null" More...
 
std::string GetError () const
 
void Dump (int nest=0) const
 return node type as string More...
 
MJsonNodeCopy () const
 dump the subtree to standard output More...
 

Static Public Member Functions

static MJsonNodeParse (const char *jsonstring)
 
static std::string Encode (const char *s)
 
static std::string EncodeInt (int v)
 
static std::string EncodeDouble (double v)
 
static MJsonNodeMakeArray ()
 
static MJsonNodeMakeObject ()
 
static MJsonNodeMakeString (const char *value)
 
static MJsonNodeMakeInt (int value)
 
static MJsonNodeMakeNumber (double value)
 
static MJsonNodeMakeBool (bool value)
 
static MJsonNodeMakeNull ()
 
static MJsonNodeMakeJSON (const char *json)
 
static MJsonNodeMakeArrayBuffer (char *ptr, size_t size)
 
static MJsonNodeMakeError (MJsonNode *errornode, const char *errormessage, const char *sin, const char *serror)
 the node takes ownership of the buffer More...
 
static const char * TypeToString (int type)
 get error message from MJSON_ERROR nodes More...
 
static MJsonNodeParse (const char *jsonstring)
 
static std::string Encode (const char *s)
 
static std::string EncodeInt (int v)
 
static std::string EncodeDouble (double v)
 
static MJsonNodeMakeArray ()
 
static MJsonNodeMakeObject ()
 
static MJsonNodeMakeString (const char *value)
 
static MJsonNodeMakeInt (int value)
 
static MJsonNodeMakeNumber (double value)
 
static MJsonNodeMakeBool (bool value)
 
static MJsonNodeMakeNull ()
 
static MJsonNodeMakeJSON (const char *json)
 
static MJsonNodeMakeArrayBuffer (char *ptr, size_t size)
 
static MJsonNodeMakeError (MJsonNode *errornode, const char *errormessage, const char *sin, const char *serror)
 the node takes ownership of the buffer More...
 
static const char * TypeToString (int type)
 get error message from MJSON_ERROR nodes More...
 

Protected Member Functions

 MJsonNode (int type)
 make a copy of the json tree More...
 
 MJsonNode (int type)
 make a copy of the json tree More...
 

Protected Attributes

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

Private Member Functions

MJsonNodeoperator= (const MJsonNode &)
 
MJsonNodeoperator= (const MJsonNode &)
 

Detailed Description

Definition at line 36 of file mjson.h.

Constructor & Destructor Documentation

◆ ~MJsonNode()

MJsonNode::~MJsonNode ( )

◆ MJsonNode()

MJsonNode::MJsonNode ( int  type)
protected

make a copy of the json tree

Member Function Documentation

◆ AddToArray()

void MJsonNode::AddToArray ( MJsonNode node)

◆ AddToObject()

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

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

◆ Copy()

MJsonNode* MJsonNode::Copy ( ) const

dump the subtree to standard output

◆ DeleteObjectNode()

void MJsonNode::DeleteObjectNode ( const char *  name)

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

◆ Dump()

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

return node type as string

◆ Encode()

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

◆ EncodeDouble()

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

◆ EncodeInt()

static std::string MJsonNode::EncodeInt ( int  v)
static

◆ 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"

◆ GetArray()

const MJsonNodeVector* MJsonNode::GetArray ( ) const

get node type: MJSON_xxx

◆ GetArrayBuffer()

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

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

◆ GetBool()

bool MJsonNode::GetBool ( ) const

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

◆ GetDouble()

double MJsonNode::GetDouble ( ) const

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

◆ GetError()

std::string MJsonNode::GetError ( ) const

◆ GetInt()

int MJsonNode::GetInt ( ) const

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

◆ GetObjectNames()

const MJsonStringVector* MJsonNode::GetObjectNames ( ) const

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

◆ GetObjectNodes()

const MJsonNodeVector* MJsonNode::GetObjectNodes ( ) const

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

◆ GetString()

std::string MJsonNode::GetString ( ) const

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

◆ GetType()

int MJsonNode::GetType ( ) const

delete a node from an object

◆ MakeArray()

static MJsonNode* MJsonNode::MakeArray ( )
static

◆ MakeArrayBuffer()

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

◆ MakeBool()

static MJsonNode* MJsonNode::MakeBool ( bool  value)
static

◆ MakeError()

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

the node takes ownership of the buffer

◆ MakeInt()

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

◆ MakeJSON()

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

◆ MakeNull()

static MJsonNode* MJsonNode::MakeNull ( )
static

◆ MakeNumber()

static MJsonNode* MJsonNode::MakeNumber ( double  value)
static

◆ MakeObject()

static MJsonNode* MJsonNode::MakeObject ( )
static

◆ MakeString()

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

◆ operator=()

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

◆ Parse()

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

◆ Stringify()

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

◆ TypeToString()

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

get error message from MJSON_ERROR nodes


The documentation for this class was generated from the following files: