90 JVal*
vget(
JErr* err,
const char** fmt, va_list* argList);
387 struct JVal* firstChild;
400 size_t memberNameLen;
412#define JVal_getType(o) (o)->type
444#define JVal_getStringLen(o) (o)->stringLen
456#define JVal_getNameLen(o) (o)->memberNameLen
464#define JVal_getNextElem(o) (o)->next
488#define JVal_isObjectMember(o) ((o)->memberName != 0)
511#define JVal_setInt(o, e, v) JVal_setX(o, e, JVType_Int, &v)
516#define JVal_setLong(o, e, v) JVal_setX(o, e, JVType_Long, &v)
521#define JVal_setDouble(o, e, v) JVal_setX(o, e, JVType_Double, &v)
526#define JVal_setBoolean(o, e, v) JVal_setX(o, e, JVType_Boolean, &v)
530#define JVal_setNull(o, e) JVal_setX(o, e, JVType_Null, 0)
534#define JVal_setString(o, e, v) JVal_setX(o, e, JVType_String, v)
550 return JVal_vget(
this,err,fmt, argList); }
552 JVal* retv; va_list argList;
553 va_start(argList, fmt);
554 retv =
JVal_vget(
this,err,&fmt,&argList);
624 JParserValFactStat_OK=0,
625 JParserValFactStat_DMemErr,
626 JParserValFactStat_VMemErr,
627 JParserValFactStat_MaxNodes
705#define JParserValFact_getFirstVal(o) \
706 ((o)->vStack && *(o)->vStack ? *(o)->vStack : 0)
761 JVal* mkString(
const char* v);
768 JVal* mkDouble(
double v);
789 JVal* mkBoolean(
bool v);
818#define JValFact_mkString(o, v) JValFact_mkVal(o, JVType_String, v)
823#define JValFact_mkDouble(o, v) JValFact_mkVal(o, JVType_Double, &v)
828#define JValFact_mkInt(o, v) JValFact_mkVal(o, JVType_Int, &v)
833#define JValFact_mkLong(o, v) JValFact_mkVal(o, JVType_Long, &v)
838#define JValFact_mkBoolean(o, v) JValFact_mkVal(o, JVType_Boolean, &v)
842#define JValFact_mkNull(o) JValFact_mkVal(o, JVType_Null, 0)
846#define JValFact_mkObject(o) JValFact_mkVal(o, JVType_Object, 0)
850#define JValFact_mkArray(o) JValFact_mkVal(o, JVType_Array, 0)
879 BaBool b = v ? TRUE : FALSE;
JParserValFact(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Initialize a factory without allocating a tree.
Definition: JVal.h:721
JVal * manageFirstVal()
Detach the current root and reset the node counter when a root exists.
Definition: JVal.h:726
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:730
void termFirstVal()
Free the attached tree and factory stack, preparing for another document.
Definition: JVal.h:728
BA_API void JParserValFact_constructor(JParserValFact *o, AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Initialize a factory without allocating a tree.
JVal * getFirstVal()
Definition: JVal.h:724
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:705
BA_API void JParserValFact_destructor(JParserValFact *o)
Free the attached root and all factory stack storage.
const char * getName()
Definition: JVal.h:572
void setLong(JErr *e, S64 v)
Replace a scalar value and set its type.
Definition: JVal.h:593
#define JVal_setDouble(o, e, v)
Replace a scalar value and set its type.
Definition: JVal.h:521
#define JValFact_mkArray(o)
Create a detached array node.
Definition: JVal.h:850
JVal * mkDouble(double v)
Create a detached double node.
Definition: JVal.h:872
char * manageString(JErr *e)
Detach a string's storage, leaving a String node with NULL data and zero length.
Definition: JVal.h:570
JVal * mkLong(S64 v)
Create a detached long node.
Definition: JVal.h:876
JVal * mkInt(S32 v)
Create a detached int node.
Definition: JVal.h:874
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:878
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:823
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:607
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:601
#define JVal_getStringLen(o)
Definition: JVal.h:444
void terminate(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Free this node, all descendants, and all following siblings recursively.
Definition: JVal.h:612
#define JVal_setBoolean(o, e, v)
Replace a scalar value and set its type.
Definition: JVal.h:526
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:560
#define JValFact_mkLong(o, v)
Create a detached long node.
Definition: JVal.h:833
bool isObjectMember()
Definition: JVal.h:603
JVal * getArray(JErr *e)
Access the first child of an array node.
Definition: JVal.h:582
JVal * getNextElem()
Definition: JVal.h:578
JVType
The JSON types.
Definition: JParser.h:121
JVal * mkNull()
Create a detached null node.
Definition: JVal.h:881
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:530
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:586
JVal * getObject(JErr *e)
Access the first child of an object node.
Definition: JVal.h:580
JVal * getJ(JErr *e)
Access the first child of an object or array node.
Definition: JVal.h:584
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:846
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:574
#define JVal_getNextElem(o)
Definition: JVal.h:464
double getDouble(JErr *e)
Convert a numeric, boolean, or null node to double.
Definition: JVal.h:562
#define JVal_getType(o)
Definition: JVal.h:412
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:488
BaBool getBoolean(JErr *e)
Read a boolean or null node.
Definition: JVal.h:564
#define JVal_setLong(o, e, v)
Replace a scalar value and set its type.
Definition: JVal.h:516
JVal * mkString(const char *v)
Create a detached string node.
Definition: JVal.h:870
#define JValFact_mkBoolean(o, v)
Create a detached boolean node.
Definition: JVal.h:838
JVal * get(JErr *err, const char *fmt,...)
Get any type of value(s) from a JVal node or JVal tree.
Definition: JVal.h:551
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:885
S32 getInt(JErr *e)
Convert a numeric, boolean, or null node to S32.
Definition: JVal.h:558
JVType getType()
Definition: JVal.h:547
JVal * mkObject()
Create a detached object node.
Definition: JVal.h:883
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:549
size_t getStringLen()
Definition: JVal.h:568
char * manageName()
Detach the member name and clear its pointer/length in the node.
Definition: JVal.h:576
#define JValFact_mkInt(o, v)
Create a detached int node.
Definition: JVal.h:828
#define JValFact_mkNull(o)
Create a detached null node.
Definition: JVal.h:842
int add(JErr *e, JVal *child)
Prepend a child to an array.
Definition: JVal.h:610
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:588
void setBoolean(JErr *e, BaBool v)
Replace a scalar value and set its type.
Definition: JVal.h:597
void setDouble(JErr *e, double v)
Replace a scalar value and set its type.
Definition: JVal.h:595
int unlink(JVal *child)
Remove one immediate child without destroying it.
Definition: JVal.h:605
#define JVal_getNameLen(o)
Definition: JVal.h:456
void setNull(JErr *e)
Replace a scalar value with JSON null.
Definition: JVal.h:599
const char * getString(JErr *e)
Access a string without transferring ownership.
Definition: JVal.h:566
#define JVal_setString(o, e, v)
Store a string pointer without copying it and set the node's type.
Definition: JVal.h:534
JValFact(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Initialize a factory without allocating a tree.
Definition: JVal.h:868
#define JValFact_mkString(o, v)
Create a detached string node.
Definition: JVal.h:818
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:591
#define JVal_setInt(o, e, v)
Replace a scalar value and set its type.
Definition: JVal.h:511
int64_t S64
Signed 64-bit integer.
Definition: GenPrimT.h:87
int32_t S32
Signed 32-bit integer.
Definition: GenPrimT.h:85
uint32_t U32
Unsigned 32-bit integer.
Definition: GenPrimT.h:93
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:89
U8 BaBool
Boolean stored in an unsigned byte; FALSE is zero and TRUE is one.
Definition: GenPrimT.h:118
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:647
JParserValFactStat status
Factory status, initially OK; parse failures may set it.
Definition: JVal.h:692
U32 maxNodes
Node-count threshold, initially U32 maximum.
Definition: JVal.h:689
The JValFact enables one to manually create a JVal syntax tree or add nodes to an existing syntax tre...
Definition: JVal.h:746
JVal represents a value in a JSON tree.
Definition: JVal.h:78