81 JVal*
vget(
JErr* err,
const char** fmt, va_list* argList);
298 struct JVal* firstChild;
318#define JVal_getType(o) (o)->type
319BA_API
JVal* JVal_vget(
JVal* o,
JErr* err,
const char** fmt, va_list* argList);
320BA_API
JVal* JVal_get(
JVal* o,
JErr* err,
const char* fmt, ...);
321BA_API S32 JVal_getInt(
JVal* o,
JErr* e);
322BA_API S64 JVal_getLong(
JVal* o,
JErr* e);
323BA_API
double JVal_getDouble(
JVal* o,
JErr* e);
324BA_API BaBool JVal_getBoolean(
JVal* o,
JErr* e);
325BA_API
const char* JVal_getString(
JVal* o,
JErr* e);
326BA_API
char* JVal_manageString(
JVal* o,
JErr* e);
327BA_API
const char* JVal_getName(
JVal* o);
328BA_API
char* JVal_manageName(
JVal* o);
329#define JVal_getNextElem(o) (o)->next
334BA_API S32 JVal_getLength(
struct JVal* o,
JErr* e);
335#define JVal_isObjectMember(o) ((o)->memberName != 0)
336BA_API
int JVal_unlink(
JVal* o,
JVal* child);
337BA_API
int JVal_addMember(
JVal* o,
JErr* e,
const char* memberName,
342#define JVal_setInt(o, e, v) JVal_setX(o, e, JVType_Int, &v)
343#define JVal_setLong(o, e, v) JVal_setX(o, e, JVType_Long, &v)
344#define JVal_setDouble(o, e, v) JVal_setX(o, e, JVType_Double, &v)
345#define JVal_setBoolean(o, e, v) JVal_setX(o, e, JVType_Boolean, &v)
346#define JVal_setNull(o, e) JVal_setX(o, e, JVType_Null, 0)
347#define JVal_setString(o, e, v) JVal_setX(o, e, JVType_String, v)
352 return JVal_getType(
this); }
354 return JVal_vget(
this,err,fmt, argList); }
356 JVal* retv; va_list argList;
357 va_start(argList, fmt);
358 retv = JVal_vget(
this,err,&fmt,&argList);
363 return JVal_getInt(
this, e); }
365 return JVal_getLong(
this, e); }
367 return JVal_getDouble(
this, e); }
369 return JVal_getBoolean(
this, e); }
371 return JVal_getString(
this, e); }
373 return JVal_manageString(
this, e); }
375 return JVal_getName(
this); }
377 return JVal_manageName(
this); }
379 return JVal_getNextElem(
this); }
381 return JVal_getObject(
this, e); }
383 return JVal_getArray(
this, e); }
385 return JVal_getJ(
this, e); }
387 return JVal_manageJ(
this, e); }
389 return JVal_getLength(
this, e); }
392 JVal_setInt(
this, e, val); }
394 JVal_setLong(
this, e, val); }
396 JVal_setDouble(
this, e, val); }
398 JVal_setBoolean(
this, e, val); }
400 JVal_setNull(
this, e); }
402 JVal_setString(
this, e, val); }
404 return JVal_isObjectMember(
this) ? true :
false; }
406 return JVal_unlink(
this, child); }
409 return JVal_addMember(
this, e, name, child, dAlloc); }
411 return JVal_add(
this, e, child); }
413 JVal_terminate(
this, vAlloc, dAlloc); }
424 JParserValFactStat_OK=0,
425 JParserValFactStat_DMemErr,
426 JParserValFactStat_VMemErr,
427 JParserValFactStat_MaxNodes
484 JParserValFactStat status;
489BA_API
void JParserValFact_constructor(
491#define JParserValFact_getFirstVal(o) \
492 ((o)->vStack && *(o)->vStack ? *(o)->vStack : 0)
500 JParserValFact_constructor(
this, vAlloc, dAlloc);}
502 return JParserValFact_getFirstVal(
this); }
504 return JParserValFact_manageFirstVal(
this); }
506 JParserValFact_termFirstVal(
this); }
508 JParserValFact_destructor(
this); }
534 JVal* mkString(
const char* v);
538 JVal* mkDouble(
double v);
550 JVal* mkBoolean(
bool v);
570#define JValFact_mkString(o, v) JValFact_mkVal(o, JVType_String, v)
571#define JValFact_mkDouble(o, v) JValFact_mkVal(o, JVType_Double, &v)
572#define JValFact_mkInt(o, v) JValFact_mkVal(o, JVType_Int, &v)
573#define JValFact_mkLong(o, v) JValFact_mkVal(o, JVType_Long, &v)
574#define JValFact_mkBoolean(o, v) JValFact_mkVal(o, JVType_Boolean, &v)
575#define JValFact_mkNull(o) JValFact_mkVal(o, JVType_Null, 0)
576#define JValFact_mkObject(o) JValFact_mkVal(o, JVType_Object, 0)
577#define JValFact_mkArray(o) JValFact_mkVal(o, JVType_Array, 0)
578BA_API
void JValFact_constructor(
584 JValFact_constructor(
this,vAlloc, dAlloc); }
586 return JValFact_mkString(
this, v); }
588 return JValFact_mkDouble(
this, v); }
590 return JValFact_mkInt(
this, v); }
592 return JValFact_mkLong(
this, v); }
594 BaBool b = v ? TRUE : FALSE;
595 return JValFact_mkBoolean(
this, b); }
597 return JValFact_mkNull(
this); }
599 return JValFact_mkObject(
this); }
601 return JValFact_mkArray(
this); }
JParserValFact(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
create a JParserValFact JVal factory instance.
Definition: JVal.h:498
JVal * manageFirstVal()
Similar to getFirstVal, but you must manage the JVal tree as the value is detached from the JParserVa...
Definition: JVal.h:503
~JParserValFact()
The destructor terminates all nodes not managed.
Definition: JVal.h:507
void termFirstVal()
Terminate the syntax tree such that the JParserValFact instance can be reused when the JParser instan...
Definition: JVal.h:505
JVal * getFirstVal()
Returns the root of the JVal syntax tree.
Definition: JVal.h:501
const char * getName()
Returns the member name if this value is part of a JSON object.
Definition: JVal.h:374
void setLong(JErr *e, S64 v)
Sets a new integer value or changes the JSON type and sets the integer value.
Definition: JVal.h:393
JVal * mkDouble(double v)
Make a float.
Definition: JVal.h:587
char * manageString(JErr *e)
Similar to getString, but you must manage the value as the value is detached from the tree.
Definition: JVal.h:372
JVal * mkLong(S64 v)
Make a long integer.
Definition: JVal.h:591
JVal * mkInt(S32 v)
Make an integer.
Definition: JVal.h:589
JVal * mkBoolean(bool v)
Make a boolean.
Definition: JVal.h:593
int addMember(JErr *e, const char *memberName, JVal *child, AllocatorIntf *dAlloc)
Add a child to an object.
Definition: JVal.h:407
void setString(JErr *e, char *v)
Sets a string value and changes the JSON type if needed.
Definition: JVal.h:401
void terminate(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
Terminate the node and all sub nodes.
Definition: JVal.h:412
S64 getLong(JErr *e)
Returns the integer as a long value for an integer JVal type or attempts to convert the value to a lo...
Definition: JVal.h:364
bool isObjectMember()
Returns true if this is a child element in an object.
Definition: JVal.h:403
JVal * getArray(JErr *e)
Returns the first child if an array.
Definition: JVal.h:382
JVal * getNextElem()
Returns the next element if the parent is an object or an array.
Definition: JVal.h:378
JVType
The JSON types.
Definition: JParser.h:103
JVal * mkNull()
Make a null value.
Definition: JVal.h:596
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)
Similar to getJ, but you must manage the JVal as the value is detached from the tree.
Definition: JVal.h:386
JVal * getObject(JErr *e)
Returns the first child if an object.
Definition: JVal.h:380
JVal * getJ(JErr *e)
Returns the first child if an array or object.
Definition: JVal.h:384
double getDouble(JErr *e)
Returns the double value for a JVal float or attempts to convert the value to a float.
Definition: JVal.h:366
BaBool getBoolean(JErr *e)
Returns the boolean value for a boolean JVal type or false if the JVal is JVType_Null.
Definition: JVal.h:368
JVal * mkString(const char *v)
Make a string.
Definition: JVal.h:585
JVal * get(JErr *err, const char *fmt,...)
Get any type of value(s) from a JVal node or JVal tree.
Definition: JVal.h:355
JVal * mkArray()
Make a JSON array.
Definition: JVal.h:600
S32 getInt(JErr *e)
Returns the integer value for an integer JVal type or attempts to convert the value to an integer.
Definition: JVal.h:362
JVType getType()
Returns the JSON type.
Definition: JVal.h:351
JVal * mkObject()
Make a JSON object.
Definition: JVal.h:598
JVal * vget(JErr *err, const char **fmt, va_list *argList)
Equivalent to get with variable argument list replaced by argList.
Definition: JVal.h:353
char * manageName()
Similar to getName, but you must manage the value as the value is detached from the tree.
Definition: JVal.h:376
int add(JErr *e, JVal *child)
Add a child to an array.
Definition: JVal.h:410
S32 getLength(JErr *e)
Returns the elements left in the list.
Definition: JVal.h:388
void setBoolean(JErr *e, BaBool v)
Sets a new boolean value or changes the JSON type and sets the boolean value.
Definition: JVal.h:397
void setDouble(JErr *e, double v)
Sets a new float value or changes the JSON type to float and sets the float value.
Definition: JVal.h:395
int unlink(JVal *child)
Remove a child.
Definition: JVal.h:405
void setNull(JErr *e)
Changes the JSON type if not NULL.
Definition: JVal.h:399
const char * getString(JErr *e)
Returns the string as a const or returns NULL if the JVAL is a NULL type.
Definition: JVal.h:370
JValFact(AllocatorIntf *vAlloc, AllocatorIntf *dAlloc)
create a JValFact JVal factory instance.
Definition: JVal.h:583
void setInt(JErr *e, S32 v)
Sets a new integer value or changes the JSON type and sets the integer value.
Definition: JVal.h:391
Memory allocation and deallocation Interface class.
Definition: AllocatorIntf.h:83
The JSON error container object.
Definition: JParser.h:155
The JParserIntf interface class is the interface between the parser and an object that implements the...
Definition: JParser.h:65
JParserValFact is the JVal JSON parser factory class.
Definition: JVal.h:447
The JValFact enables one to manually create a JVal syntax tree or add nodes to an existing syntax tre...
Definition: JVal.h:523
JVal represents a value in a JSON tree.
Definition: JVal.h:73