Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
JVal.h File Reference
#include <JParser.h>
#include <stdarg.h>
Include dependency graph for JVal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  JVal
 JVal represents a value in a JSON tree. More...
 
struct  JParserValFact
 JParserValFact is the JVal JSON parser factory class. More...
 
struct  JValFact
 The JValFact enables one to manually create a JVal syntax tree or add nodes to an existing syntax tree. More...
 

Macros

#define JVal_getType(o)   (o)->type
 
#define JVal_getStringLen(o)   (o)->stringLen
 
#define JVal_getNameLen(o)   (o)->memberNameLen
 
#define JVal_getNextElem(o)   (o)->next
 
#define JVal_isObjectMember(o)   ((o)->memberName != 0)
 
#define JVal_setInt(o, e, v)   JVal_setX(o, e, JVType_Int, &v)
 Replace a scalar value and set its type. More...
 
#define JVal_setLong(o, e, v)   JVal_setX(o, e, JVType_Long, &v)
 Replace a scalar value and set its type. More...
 
#define JVal_setDouble(o, e, v)   JVal_setX(o, e, JVType_Double, &v)
 Replace a scalar value and set its type. More...
 
#define JVal_setBoolean(o, e, v)   JVal_setX(o, e, JVType_Boolean, &v)
 Replace a scalar value and set its type. More...
 
#define JVal_setNull(o, e)   JVal_setX(o, e, JVType_Null, 0)
 Replace a scalar value with JSON null. More...
 
#define JVal_setString(o, e, v)   JVal_setX(o, e, JVType_String, v)
 Store a string pointer without copying it and set the node's type. More...
 
#define JParserValFact_getFirstVal(o)    ((o)->vStack && *(o)->vStack ? *(o)->vStack : 0)
 
#define JValFact_mkString(o, v)   JValFact_mkVal(o, JVType_String, v)
 Create a detached string node. More...
 
#define JValFact_mkDouble(o, v)   JValFact_mkVal(o, JVType_Double, &v)
 Create a detached double node. More...
 
#define JValFact_mkInt(o, v)   JValFact_mkVal(o, JVType_Int, &v)
 Create a detached int node. More...
 
#define JValFact_mkLong(o, v)   JValFact_mkVal(o, JVType_Long, &v)
 Create a detached long node. More...
 
#define JValFact_mkBoolean(o, v)   JValFact_mkVal(o, JVType_Boolean, &v)
 Create a detached boolean node. More...
 
#define JValFact_mkNull(o)   JValFact_mkVal(o, JVType_Null, 0)
 Create a detached null node. More...
 
#define JValFact_mkObject(o)   JValFact_mkVal(o, JVType_Object, 0)
 Create a detached object node. More...
 
#define JValFact_mkArray(o)   JValFact_mkVal(o, JVType_Array, 0)
 Create a detached array node. More...
 

Typedefs

typedef JParserValFact JParserValFact
 JParserValFact is the JVal JSON parser factory class. More...
 
typedef struct JValFact JValFact
 The JValFact enables one to manually create a JVal syntax tree or add nodes to an existing syntax tree. More...
 

Functions

BA_API JValJVal_vget (JVal *o, JErr *err, const char **fmt, va_list *argList)
 Extract values as for get(), using mutable format and argument cursors. More...
 
BA_API JValJVal_get (JVal *o, JErr *err, const char *fmt,...)
 Get any type of value(s) from a JVal node or JVal tree. More...
 
BA_API S32 JVal_getInt (JVal *o, JErr *e)
 Convert a numeric, boolean, or null node to S32. More...
 
BA_API S64 JVal_getLong (JVal *o, JErr *e)
 Convert a numeric, boolean, or null node to S64. More...
 
BA_API double JVal_getDouble (JVal *o, JErr *e)
 Convert a numeric, boolean, or null node to double. More...
 
BA_API BaBool JVal_getBoolean (JVal *o, JErr *e)
 Read a boolean or null node. More...
 
BA_API const char * JVal_getString (JVal *o, JErr *e)
 Access a string without transferring ownership. More...
 
BA_API char * JVal_manageString (JVal *o, JErr *e)
 Detach a string's storage, leaving a String node with NULL data and zero length. More...
 
BA_API const char * JVal_getName (JVal *o)
 
BA_API char * JVal_manageName (JVal *o)
 Detach the member name and clear its pointer/length in the node. More...
 
BA_API JValJVal_getObject (JVal *o, JErr *e)
 Access the first child of an object node. More...
 
BA_API JValJVal_getArray (JVal *o, JErr *e)
 Access the first child of an array node. More...
 
BA_API JValJVal_getJ (JVal *o, JErr *e)
 Access the first child of an object or array node. More...
 
BA_API JValJVal_manageJ (JVal *o, JErr *e)
 Detach all children from an object/array, leaving the container empty. More...
 
BA_API S32 JVal_getLength (struct JVal *o, JErr *e)
 Count immediate children of this object/array. More...
 
BA_API int JVal_unlink (JVal *o, JVal *child)
 Remove one immediate child without destroying it. More...
 
BA_API int JVal_addMember (JVal *o, JErr *e, const char *memberName, JVal *child, AllocatorIntf *dAlloc)
 Prepend a child to an object. More...
 
BA_API int JVal_add (JVal *o, JErr *e, JVal *child)
 Prepend a child to an array. More...
 
BA_API void JVal_terminate (JVal *o, AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
 Free this node, all descendants, and all following siblings recursively. More...
 
BA_API void JVal_setX (JVal *o, JErr *e, JVType t, void *v)
 Low-level scalar replacement used by the typed setter macros. More...
 
BA_API void JParserValFact_constructor (JParserValFact *o, AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
 Initialize a factory without allocating a tree. More...
 
BA_API JValJParserValFact_manageFirstVal (JParserValFact *o)
 Detach the current root and reset the node counter when a root exists. More...
 
BA_API void JParserValFact_termFirstVal (JParserValFact *o)
 Free the attached tree and factory stack, preparing for another document. More...
 
BA_API void JParserValFact_destructor (JParserValFact *o)
 Free the attached root and all factory stack storage. More...
 
BA_API void JValFact_constructor (JValFact *o, AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
 Initialize a factory without allocating a tree. More...
 
BA_API JValJValFact_mkVal (JValFact *o, JVType t, const void *uv)
 Allocate a detached typed value. More...