ROOTANA
Loading...
Searching...
No Matches
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
 
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 MJsonNodeVectorGetArray () const
 get node type: MJSON_xxx
 
const MJsonStringVectorGetObjectNames () const
 get array value, NULL if not array, empty array if value is JSON "null"
 
const MJsonNodeVectorGetObjectNodes () const
 get array of object names, NULL if not object, empty array if value is JSON "null"
 
const MJsonNodeFindObjectNode (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
 
MJsonNodeCopy () 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 MJsonNodeVectorGetArray () const
 get node type: MJSON_xxx
 
const MJsonStringVectorGetObjectNames () const
 get array value, NULL if not array, empty array if value is JSON "null"
 
const MJsonNodeVectorGetObjectNodes () const
 get array of object names, NULL if not object, empty array if value is JSON "null"
 
const MJsonNodeFindObjectNode (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
 
MJsonNodeCopy () const
 dump the subtree to standard output
 

Static Public Member Functions

static MJsonNodeParse (const char *jsonstring)
 
static std::string Encode (const char *s)
 
static std::string EncodeLL (long long v)
 
static std::string EncodeDouble (double v)
 
static MJsonNodeMakeArray ()
 
static MJsonNodeMakeObject ()
 
static MJsonNodeMakeString (const char *value)
 
static MJsonNodeMakeInt (long long 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
 
static const char * TypeToString (int type)
 get error message from MJSON_ERROR nodes
 
static MJsonNodeParse (const char *jsonstring)
 
static std::string Encode (const char *s)
 
static std::string EncodeLL (long long v)
 
static std::string EncodeDouble (double v)
 
static MJsonNodeMakeArray ()
 
static MJsonNodeMakeObject ()
 
static MJsonNodeMakeString (const char *value)
 
static MJsonNodeMakeInt (long long 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
 
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

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

◆ EncodeLL()

static std::string MJsonNode::EncodeLL ( long long  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 64-bit long long value, 0 if not an integer or value is JSON "null"

◆ GetError()

std::string MJsonNode::GetError ( ) const

◆ GetInt()

long long MJsonNode::GetInt ( ) const

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

◆ GetLL()

long long MJsonNode::GetLL ( ) const

get integer value, 0 if not an integer 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 ( long long  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: