90 JVal*
vget(
JErr* err,
const char** fmt, va_list* argList);
387 struct JVal* firstChild;
398 size_t memberNameLen;
410#define JVal_getType(o) (o)->type
442#define JVal_getStringLen(o) (o)->stringLen
454#define JVal_getNameLen(o) (o)->memberNameLen
462#define JVal_getNextElem(o) (o)->next
486#define JVal_isObjectMember(o) ((o)->memberName != 0)
509#define JVal_setInt(o, e, v) JVal_setX(o, e, JVType_Int, &v)
514#define JVal_setLong(o, e, v) JVal_setX(o, e, JVType_Long, &v)
519#define JVal_setDouble(o, e, v) JVal_setX(o, e, JVType_Double, &v)
524#define JVal_setBoolean(o, e, v) JVal_setX(o, e, JVType_Boolean, &v)
528#define JVal_setNull(o, e) JVal_setX(o, e, JVType_Null, 0)
532#define JVal_setString(o, e, v) JVal_setX(o, e, JVType_String, v)
548 return JVal_vget(
this,err,fmt, argList); }
550 JVal* retv; va_list argList;
551 va_start(argList, fmt);
552 retv =
JVal_vget(
this,err,&fmt,&argList);
622 JParserValFactStat_OK=0,
623 JParserValFactStat_DMemErr,
624 JParserValFactStat_VMemErr,
625 JParserValFactStat_MaxNodes
703#define JParserValFact_getFirstVal(o) \
704 ((o)->vStack && *(o)->vStack ? *(o)->vStack : 0)
759 JVal* mkString(
const char* v);
766 JVal* mkDouble(
double v);
787 JVal* mkBoolean(
bool v);
816#define JValFact_mkString(o, v) JValFact_mkVal(o, JVType_String, v)
821#define JValFact_mkDouble(o, v) JValFact_mkVal(o, JVType_Double, &v)
826#define JValFact_mkInt(o, v) JValFact_mkVal(o, JVType_Int, &v)
831#define JValFact_mkLong(o, v) JValFact_mkVal(o, JVType_Long, &v)
836#define JValFact_mkBoolean(o, v) JValFact_mkVal(o, JVType_Boolean, &v)
840#define JValFact_mkNull(o) JValFact_mkVal(o, JVType_Null, 0)
844#define JValFact_mkObject(o) JValFact_mkVal(o, JVType_Object, 0)
848#define JValFact_mkArray(o) JValFact_mkVal(o, JVType_Array, 0)
877 BaBool b = v ? TRUE : FALSE;
JParserValFact(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Initialize a factory without allocating a tree.
Definition: JVal.h:719
JVal * manageFirstVal()
Detach the current root and reset the node counter when a root exists.
Definition: JVal.h:724
BA_API JVal * JParserValFact_manageFirstVal(JParserValFact *o)
Detach the current root and reset the node counter when a root exists.
~JParserValFact()
Free the attached root and all factory stack storage.
Definition: JVal.h:728
void termFirstVal()
Free the attached tree and factory stack, preparing for another document.
Definition: JVal.h:726
BA_API void JParserValFact_constructor(JParserValFact *o, AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Initialize a factory without allocating a tree.
JVal * getFirstVal()
Definition: JVal.h:722
BA_API void JParserValFact_termFirstVal(JParserValFact *o)
Free the attached tree and factory stack, preparing for another document.
#define JParserValFact_getFirstVal(o)
Definition: JVal.h:703
BA_API void JParserValFact_destructor(JParserValFact *o)
Free the attached root and all factory stack storage.
const char * getName()
Definition: JVal.h:570
void setLong(JErr *e, S64 v)
Replace a scalar value and set its type.
Definition: JVal.h:591
#define JVal_setDouble(o, e, v)
Replace a scalar value and set its type.
Definition: JVal.h:519
#define JValFact_mkArray(o)
Create a detached array node.
Definition: JVal.h:848
JVal * mkDouble(double v)
Create a detached double node.
Definition: JVal.h:870
char * manageString(JErr *e)
Detach a string's storage, leaving a String node with NULL data and zero length.
Definition: JVal.h:568
JVal * mkLong(S64 v)
Create a detached long node.
Definition: JVal.h:874
JVal * mkInt(S32 v)
Create a detached int node.
Definition: JVal.h:872
BA_API int JVal_add(JVal *o, JErr *e, JVal *child)
Prepend a child to an array.
BA_API JVal * JValFact_mkVal(JValFact *o, JVType t, const void *uv)
Allocate a detached typed value.
BA_API S32 JVal_getInt(JVal *o, JErr *e)
Convert a numeric, boolean, or null node to S32.
JVal * mkBoolean(bool v)
Create a detached boolean node.
Definition: JVal.h:876
BA_API S64 JVal_getLong(JVal *o, JErr *e)
Convert a numeric, boolean, or null node to S64.
BA_API JVal * JVal_getJ(JVal *o, JErr *e)
Access the first child of an object or array node.
BA_API JVal * JVal_getObject(JVal *o, JErr *e)
Access the first child of an object node.
#define JValFact_mkDouble(o, v)
Create a detached double node.
Definition: JVal.h:821
BA_API int JVal_addMember(JVal *o, JErr *e, const char *memberName, JVal *child, AllocatorIntf *dAlloc)
Prepend a child to an object.
int addMember(JErr *e, const char *memberName, JVal *child, AllocatorIntf *dAlloc)
Prepend a child to an object.
Definition: JVal.h:605
BA_API void JVal_setX(JVal *o, JErr *e, JVType t, void *v)
Low-level scalar replacement used by the typed setter macros.
BA_API JVal * JVal_getArray(JVal *o, JErr *e)
Access the first child of an array node.
void setString(JErr *e, char *v)
Store a string pointer without copying it and set the node's type.
Definition: JVal.h:599
#define JVal_getStringLen(o)
Definition: JVal.h:442
void terminate(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Free this node, all descendants, and all following siblings recursively.
Definition: JVal.h:610
#define JVal_setBoolean(o, e, v)
Replace a scalar value and set its type.
Definition: JVal.h:524
BA_API S32 JVal_getLength(struct JVal *o, JErr *e)
Count immediate children of this object/array.
BA_API JVal * JVal_get(JVal *o, JErr *err, const char *fmt,...)
Get any type of value(s) from a JVal node or JVal tree.
S64 getLong(JErr *e)
Convert a numeric, boolean, or null node to S64.
Definition: JVal.h:558
#define JValFact_mkLong(o, v)
Create a detached long node.
Definition: JVal.h:831
bool isObjectMember()
Definition: JVal.h:601
JVal * getArray(JErr *e)
Access the first child of an array node.
Definition: JVal.h:580
JVal * getNextElem()
Definition: JVal.h:576
JVType
The JSON types.
Definition: JParser.h:121
JVal * mkNull()
Create a detached null node.
Definition: JVal.h:879
BA_API JVal * JVal_manageJ(JVal *o, JErr *e)
Detach all children from an object/array, leaving the container empty.
#define JVal_setNull(o, e)
Replace a scalar value with JSON null.
Definition: JVal.h:528
struct JValFact JValFact
The JValFact enables one to manually create a JVal syntax tree or add nodes to an existing syntax tre...
JVal * manageJ(JErr *e)
Detach all children from an object/array, leaving the container empty.
Definition: JVal.h:584
JVal * getObject(JErr *e)
Access the first child of an object node.
Definition: JVal.h:578
JVal * getJ(JErr *e)
Access the first child of an object or array node.
Definition: JVal.h:582
BA_API char * JVal_manageName(JVal *o)
Detach the member name and clear its pointer/length in the node.
#define JValFact_mkObject(o)
Create a detached object node.
Definition: JVal.h:844
BA_API char * JVal_manageString(JVal *o, JErr *e)
Detach a string's storage, leaving a String node with NULL data and zero length.
size_t getNameLen()
Definition: JVal.h:572
#define JVal_getNextElem(o)
Definition: JVal.h:462
double getDouble(JErr *e)
Convert a numeric, boolean, or null node to double.
Definition: JVal.h:560
#define JVal_getType(o)
Definition: JVal.h:410
BA_API int JVal_unlink(JVal *o, JVal *child)
Remove one immediate child without destroying it.
BA_API BaBool JVal_getBoolean(JVal *o, JErr *e)
Read a boolean or null node.
BA_API const char * JVal_getString(JVal *o, JErr *e)
Access a string without transferring ownership.
#define JVal_isObjectMember(o)
Definition: JVal.h:486
BaBool getBoolean(JErr *e)
Read a boolean or null node.
Definition: JVal.h:562
#define JVal_setLong(o, e, v)
Replace a scalar value and set its type.
Definition: JVal.h:514
JVal * mkString(const char *v)
Create a detached string node.
Definition: JVal.h:868
#define JValFact_mkBoolean(o, v)
Create a detached boolean node.
Definition: JVal.h:836
JVal * get(JErr *err, const char *fmt,...)
Get any type of value(s) from a JVal node or JVal tree.
Definition: JVal.h:549
BA_API void JVal_terminate(JVal *o, AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Free this node, all descendants, and all following siblings recursively.
JVal * mkArray()
Create a detached array node.
Definition: JVal.h:883
S32 getInt(JErr *e)
Convert a numeric, boolean, or null node to S32.
Definition: JVal.h:556
JVType getType()
Definition: JVal.h:545
JVal * mkObject()
Create a detached object node.
Definition: JVal.h:881
BA_API double JVal_getDouble(JVal *o, JErr *e)
Convert a numeric, boolean, or null node to double.
JVal * vget(JErr *err, const char **fmt, va_list *argList)
Extract values as for get(), using mutable format and argument cursors.
Definition: JVal.h:547
size_t getStringLen()
Definition: JVal.h:566
char * manageName()
Detach the member name and clear its pointer/length in the node.
Definition: JVal.h:574
#define JValFact_mkInt(o, v)
Create a detached int node.
Definition: JVal.h:826
#define JValFact_mkNull(o)
Create a detached null node.
Definition: JVal.h:840
int add(JErr *e, JVal *child)
Prepend a child to an array.
Definition: JVal.h:608
BA_API void JValFact_constructor(JValFact *o, AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Initialize a factory without allocating a tree.
BA_API JVal * JVal_vget(JVal *o, JErr *err, const char **fmt, va_list *argList)
Extract values as for get(), using mutable format and argument cursors.
S32 getLength(JErr *e)
Count immediate children of this object/array.
Definition: JVal.h:586
void setBoolean(JErr *e, BaBool v)
Replace a scalar value and set its type.
Definition: JVal.h:595
void setDouble(JErr *e, double v)
Replace a scalar value and set its type.
Definition: JVal.h:593
int unlink(JVal *child)
Remove one immediate child without destroying it.
Definition: JVal.h:603
#define JVal_getNameLen(o)
Definition: JVal.h:454
void setNull(JErr *e)
Replace a scalar value with JSON null.
Definition: JVal.h:597
const char * getString(JErr *e)
Access a string without transferring ownership.
Definition: JVal.h:564
#define JVal_setString(o, e, v)
Store a string pointer without copying it and set the node's type.
Definition: JVal.h:532
JValFact(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Initialize a factory without allocating a tree.
Definition: JVal.h:866
#define JValFact_mkString(o, v)
Create a detached string node.
Definition: JVal.h:816
BA_API const char * JVal_getName(JVal *o)
void setInt(JErr *e, S32 v)
Replace a scalar value and set its type.
Definition: JVal.h:589
#define JVal_setInt(o, e, v)
Replace a scalar value and set its type.
Definition: JVal.h:509
int64_t S64
Signed 64-bit integer.
Definition: GenPrimT.h:90
int32_t S32
Signed 32-bit integer.
Definition: GenPrimT.h:88
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:96
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:92
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:121
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:98
The JSON error container object.
Definition: JParser.h:173
The JParserIntf interface class is the interface between the parser and an object that implements the...
Definition: JParser.h:72
JParserValFact is the JVal JSON parser factory class.
Definition: JVal.h:645
JParserValFactStat status
Factory status, initially OK; parse failures may set it.
Definition: JVal.h:690
U32 maxNodes
Node-count threshold, initially U32 maximum.
Definition: JVal.h:687
The JValFact enables one to manually create a JVal syntax tree or add nodes to an existing syntax tre...
Definition: JVal.h:744
JVal represents a value in a JSON tree.
Definition: JVal.h:78