Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
ubjson.h
Go to the documentation of this file.
1/*
2 * ____ _________ __ _
3 * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4 * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5 * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6 * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7 * /____/
8 *
9 * Barracuda Application Server
10 *
11 ****************************************************************************
12 * HEADER
13 *
14 * $Id: ubjson.h 6657 2026-10-28 18:19:39Z wini $
15 *
16 * COPYRIGHT: Real Time Logic LLC, 2014 - 2026
17 *
18 * This software is copyrighted by and is the sole property of Real
19 * Time Logic LLC. All rights, title, ownership, or other interests in
20 * the software remain the property of Real Time Logic LLC. This
21 * software may only be used in accordance with the terms and
22 * conditions stipulated in the corresponding license agreement under
23 * which the software has been supplied. Any unauthorized use,
24 * duplication, transmission, distribution, or disclosure of this
25 * software is expressly forbidden.
26 *
27 * This Copyright notice may not be removed or modified without prior
28 * written consent of Real Time Logic LLC.
29 *
30 * Real Time Logic LLC. reserves the right to modify this software
31 * without notice.
32 *
33 * http://realtimelogic.com
34 ****************************************************************************
35
36 Universal Binary JSON http://ubjson.org/
37 Core API and parser
38
39*/
40
43#ifndef __ubjson_h
44#define __ubjson_h
45
46#include <TargConfig.h>
47#include <stdarg.h>
48
54#ifndef UBJ_ALIGNMT
55#define UBJ_ALIGNMT uintptr_t
56#endif
57#define UBJ_POINTER_NOT_ALIGNED(p) \
58 (0 != ((uintptr_t)p & (sizeof(UBJ_ALIGNMT) - 1)))
59
60
61#define UBJPARS_STACK_LEN 3
62
67typedef enum {
86 UBJT_EndArray=']'
88
89
92typedef enum {
93
97
102
105
109
113
118
120typedef struct {
122 union {
125 char ch;
129 double float64;
130 float float32;
131 const char* string;
132 } u;
133
136
139
141 char* name;
142
145} UBJVal;
146
147
148#ifdef __cplusplus
149extern "C" {
150#endif
151
152/* Sets the value type (t) and the union (u) to the smallest number
153 representation for 'in'
154*/
160
161#ifdef __cplusplus
162}
163#endif
164
165
169typedef struct
170{
171 S32 count; /* Set if optimized format */
172 S32 ix; /* Current index goes from 0 to count-1 */
173 U8 isObj; /* TRUE for object, FALSE for Array */
174 U8 stronglyTyped; /* Set to token type if a strongly typed container */
175 U8 state; /* Container header, body, member value, or pending count */
177
178
179struct UBJPIntf;
180
191typedef int (*UBJPIntf_Service)(struct UBJPIntf* o, UBJVal* v, int recLevel);
192
193
198typedef struct UBJPIntf
199{
200#ifdef __cplusplus
205 ~UBJPIntf();
206 UBJPIntf() {}
207#endif
208 UBJPIntf_Service service;
210
211#define UBJPIntf_constructor(o,serviceMA) (o)->service=serviceMA
212#define UBJPIntf_destructor(o)
213#define UBJPIntf_service(o,v,recLev) (o)->service(o,v,recLev)
214
215#ifdef __cplusplus
217 UBJPIntf_constructor(this, s);
218}
219inline UBJPIntf::~UBJPIntf() {
220 UBJPIntf_destructor(this);
221}
222#endif
223
237typedef struct UBJParser
238{
239#ifdef __cplusplus
256 UBJParser(UBJPIntf* intf,char* name,int memberNameLen,int extraStackLen=0);
257
269 int parse(const U8* buf, U32 size);
270
274 ~UBJParser();
275
281 int getIndex();
282
287 int getCount();
288
292 int getStatus();
293
294#endif
295 const U8* lxBufEnd;
296 const U8* lxTokenPtr;
297 U8* valPtr;
298 S32 lxBytes2Read;
299 U8 lxParseX; /* Parsing one of: S, H # */
300 U8 lxState; /* UBJLxState */
301 U8 status; /* UBJPStatus */
302 U8 pState; /* parser state */
303 UBJVal val;
304 UBJPIntf* intf;
305 int memberNameLen;
306 int stackIx; /* index in 'stack' */
307 int stackLen; /* min UBJPARS_STACK_LEN */
308 U8 stringFragment;
309 UBJPStackNode stack[UBJPARS_STACK_LEN];
311
312#ifdef __cplusplus
313extern "C" {
314#endif
318void UBJParser_constructor(UBJParser* o, UBJPIntf* intf, char* name,
319 int memberNameLen, int extraStackLen);
323#define UBJParser_destructor(o)
327int UBJParser_parse(UBJParser* o, const U8* buf, U32 size);
331#define UBJParser_getIndex(o) (o)->stack[(o)->stackIx].ix
335#define UBJParser_getCount(o) (o)->stack[(o)->stackIx].count
339#define UBJParser_getStatus(o) (o)->status
340#ifdef __cplusplus
341}
343 UBJPIntf* intf, char* name, int memberNameLen, int extraStackLen) {
344 UBJParser_constructor(this, intf, name, memberNameLen, extraStackLen);
345}
348}
349inline int UBJParser::parse(const U8* buf, U32 size) {
350 return UBJParser_parse(this, buf, size);
351}
353 return UBJParser_getIndex(this);
354}
356 return UBJParser_getCount(this);
357}
359 return UBJParser_getStatus(this);
360}
361#endif
362
363struct UBJEBuf;
364
373typedef int (*UBJEBuf_FlushCB)(struct UBJEBuf* o, int sizeRequired);
374
376typedef struct UBJEBuf
377{
378#ifdef __cplusplus
385 UBJEBuf(UBJEBuf_FlushCB cb, U8* buf, S32 bufLen);
388 ~UBJEBuf();
389#endif
390 UBJEBuf_FlushCB flushCB;
391 U8* data;
392 S32 dlen;
393 S32 cursor;
395
396#define UBJEBuf_constructor(o, flushCBM, dataM, dlenM) \
397 (o)->flushCB=flushCBM,(o)->data=dataM,(o)->dlen=dlenM,(o)->cursor=0
398#define UBJEBuf_destructor(o)
399
400#ifdef __cplusplus
401inline UBJEBuf::UBJEBuf(UBJEBuf_FlushCB cb, U8* buf, S32 bufLen) {
402 UBJEBuf_constructor(this, cb,buf,bufLen);
403}
405 UBJEBuf_destructor(this);
406}
407#endif
408
410typedef enum
411{
414
417
420
423
426
429
432
436
437
451typedef struct UBJEncoder
452{
453#ifdef __cplusplus
454
461 UBJEncoder(UBJEBuf* buf);
462
465 ~UBJEncoder();
466
473 int setName(const char* n);
474
479 int null();
480
486 int boolean(bool b);
487
493 int uint8(U8 v);
494
500 int int8(S8 v);
501
507 int character(char v);
508
514 int int16(S16 v);
515
521 int int32(S32 v);
522
528 int int64(S64 v);
529
535 int float64(double v);
536
542 int float32(float v);
543
551 int string(const char* s, S32 len);
552
571 int beginArray(S32 count=-1, UBJT type=UBJT_InvalidType);
572
591 int beginObject(S32 count=-1, UBJT type=UBJT_InvalidType);
592
598 int endArray();
599
605 int endObject();
606
611 void reset();
612
621 int vset(const char** fmt, va_list* argList, bool isObj);
622
658 int set(const char* fmt, ...);
659#endif
660
661 UBJVal val;
662 struct /* Used as bit field and set if the object/array has a 'count' */
663 {
664 S32 level;
665 U8 data[8];
666 } countStack;
667 UBJEBuf* buf;
668 int status;
669 UBJT stronglyTyped;
671
672
676#define UBJE_MEMBER(o, m) #m, (o)->m
677
682#define UBJEncoder_constructor(o, ubjsBuf) \
683 memset(o,0,sizeof(UBJEncoder)),(o)->buf=ubjsBuf
688#define UBJEncoder_destructor(o)
693#define UBJEncoder_reset(o) ((o)->status=0,(o)->val.name=0,o->buf->cursor=0,0)
694
695#ifdef __cplusplus
696extern "C" {
697#endif
698int UBJEncoder_setStatus(UBJEncoder* o, UBJEStatus s);
699int UBJEncoder_val(UBJEncoder* o);
703int UBJEncoder_vset(UBJEncoder* o,const char** fmt,va_list* argList,int isObj);
707int UBJEncoder_set(UBJEncoder* o, const char* fmt, ...);
708#ifdef __cplusplus
709}
710#endif
711
718#define UBJEncoder_setName(o,v) ((o)->val.name=(char*)v)
725#define UBJEncoder_null(o) ((o)->val.t=UBJT_Null,UBJEncoder_val(o))
732#define UBJEncoder_boolean(o,v) \
733 ((o)->val.t=UBJT_Boolean,(o)->val.u.uint8=v,UBJEncoder_val(o))
740#define UBJEncoder_uint8(o,v) \
741 ((o)->val.t=UBJT_Uint8,(o)->val.u.uint8=v,UBJEncoder_val(o))
748#define UBJEncoder_int8(o,v) \
749 ((o)->val.t=UBJT_Int8,(o)->val.u.int8=v,UBJEncoder_val(o))
756#define UBJEncoder_character(o,v) \
757 ((o)->val.t=UBJT_Char,(o)->val.u.int8=v,UBJEncoder_val(o))
764#define UBJEncoder_int16(o,v) \
765 ((o)->val.t=UBJT_Int16,(o)->val.u.int16=v,UBJEncoder_val(o))
772#define UBJEncoder_int32(o,v) \
773 ((o)->val.t=UBJT_Int32,(o)->val.u.int32=v,UBJEncoder_val(o))
780#define UBJEncoder_int64(o,v) \
781 ((o)->val.t=UBJT_Int64,(o)->val.u.int64=v,UBJEncoder_val(o))
788#define UBJEncoder_float64(o,v) \
789 ((o)->val.t=UBJT_Float64,(o)->val.u.float64=v,UBJEncoder_val(o))
796#define UBJEncoder_float32(o,v) \
797 ((o)->val.t=UBJT_Float32,(o)->val.u.float32=v,UBJEncoder_val(o))
805#define UBJEncoder_string(o,v,l) \
806 ((o)->val.t=UBJT_String,(o)->val.u.string=v,(o)->val.len=l,UBJEncoder_val(o))
814#define UBJEncoder_beginArray(o,count, sType) \
815 ((o)->val.t=UBJT_BeginArray,(o)->val.len=count, \
816 (o)->val.x=sType,UBJEncoder_val(o))
824#define UBJEncoder_beginObject(o,count, sType) \
825 ((o)->val.t=UBJT_BeginObject,(o)->val.len=count, \
826 (o)->val.x=sType,UBJEncoder_val(o))
833#define UBJEncoder_endArray(o) ((o)->val.t=UBJT_EndArray,UBJEncoder_val(o))
840#define UBJEncoder_endObject(o) ((o)->val.t=UBJT_EndObject,UBJEncoder_val(o))
841
842#ifdef __cplusplus
844 UBJEncoder_constructor(this, b);
845}
848}
849inline int UBJEncoder::setName(const char* n) {
850 return UBJEncoder_setName(this, n);
851}
852inline int UBJEncoder::null() {
853 return UBJEncoder_null(this);
854}
855inline int UBJEncoder::boolean(bool b) {
856 return UBJEncoder_boolean(this, b ? 1 : 0);
857}
858inline int UBJEncoder::uint8(U8 v) {
859 return UBJEncoder_uint8(this, v);
860}
861inline int UBJEncoder::int8(S8 v) {
862 return UBJEncoder_int8(this, v);
863}
864inline int UBJEncoder::character(char v) {
865 return UBJEncoder_character(this, v);
866}
867inline int UBJEncoder::int16(S16 v) {
868 return UBJEncoder_int16(this, v);
869}
870inline int UBJEncoder::int32(S32 v) {
871 return UBJEncoder_int32(this, v);
872}
873inline int UBJEncoder::int64(S64 v) {
874 return UBJEncoder_int64(this, v);
875}
876inline int UBJEncoder::float64(double v) {
877 return UBJEncoder_float64(this, v);
878}
879inline int UBJEncoder::float32(float v) {
880 return UBJEncoder_float32(this, v);
881}
882inline int UBJEncoder::string(const char* s, S32 len) {
883 return UBJEncoder_string(this, s, len);
884}
885inline int UBJEncoder::beginArray(S32 count, UBJT t) {
886 return UBJEncoder_beginArray(this, count, t);
887}
888inline int UBJEncoder::beginObject(S32 count, UBJT t) {
889 return UBJEncoder_beginObject(this, count, t);
890}
892 return UBJEncoder_endArray(this);
893}
895 return UBJEncoder_endObject(this);
896}
897inline void UBJEncoder::reset() {
898 UBJEncoder_reset(this);
899}
900inline int UBJEncoder::vset(const char** fmt, va_list* argList, bool isObj){
901 return UBJEncoder_vset(this, fmt, argList, isObj ? 1 : 0);
902}
903inline int UBJEncoder::set(const char* fmt, ...){
904 int status;
905 va_list varg;
906 va_start(varg, fmt);
907 status = UBJEncoder_vset(this, &fmt, &varg, 0);
908 va_end(varg);
909 return status;
910}
911#endif
912 /* end of UBJSONRef */
914
915
916#endif
#define UBJEncoder_endArray(o)
End the current array.
Definition: ubjson.h:833
struct UBJEncoder UBJEncoder
UBJSON Encoder.
#define UBJParser_getIndex(o)
Query the current optimized-container position.
Definition: ubjson.h:331
#define UBJEncoder_character(o, v)
Encode a char value.
Definition: ubjson.h:756
int endObject()
Close the matching current container.
Definition: ubjson.h:894
#define UBJEncoder_constructor(o, ubjsBuf)
Initialize the encoder; no allocation, flush, or return value.
Definition: ubjson.h:682
struct UBJParser UBJParser
The UBJSON parser parses a binary UBJSON stream and calls the UBJPIntf callback interface for each pa...
#define UBJParser_destructor(o)
No-op destructor.
Definition: ubjson.h:323
#define UBJEncoder_int8(o, v)
Encode a S8 value.
Definition: ubjson.h:748
#define UBJEncoder_float32(o, v)
Encode a float value.
Definition: ubjson.h:796
~UBJEBuf()
No-op destructor; neither flushes nor frees application buffer storage.
Definition: ubjson.h:404
#define UBJEncoder_setName(o, v)
Set the pending member name.
Definition: ubjson.h:718
int vset(const char **fmt, va_list *argList, bool isObj)
Emit formatted values as for set(), advancing the format cursor.
Definition: ubjson.h:900
int int32(S32 v)
Emit one int32 value.
Definition: ubjson.h:870
int uint8(U8 v)
Emit one uint8 value.
Definition: ubjson.h:858
int UBJParser_parse(UBJParser *o, const U8 *buf, U32 size)
Feed or resume parsing a top-level UBJSON object/array.
struct UBJEBuf UBJEBuf
The UBJSON Encoder buffer is used by the encoder UBJEncoder.
struct UBJPIntf UBJPIntf
The UBJPIntf interface class is the interface between the parser and an object that implements the UB...
void UBJParser_constructor(UBJParser *o, UBJPIntf *intf, char *name, int memberNameLen, int extraStackLen)
Create the callback interface object.
UBJT
UBJSON Value Type: See UBJVal::t and the UBJSON type reference for more information.
Definition: ubjson.h:67
int int8(S8 v)
Emit one int8 value.
Definition: ubjson.h:861
~UBJEncoder()
No-op destructor; does not flush output or free the borrowed buffer.
Definition: ubjson.h:846
int getIndex()
Query the current optimized-container position.
Definition: ubjson.h:352
int UBJEncoder_set(UBJEncoder *o, const char *fmt,...)
Encode/serialize C structs/data to UBJSON using formatted output.
#define UBJEncoder_reset(o)
Discard buffered bytes and clear status/name.
Definition: ubjson.h:693
void UBJVal_setMinInteger(UBJVal *o, S64 in)
Choose the smallest supported integer representation.
#define UBJParser_getCount(o)
Query the current container's declared count.
Definition: ubjson.h:335
int character(char v)
Emit one character value.
Definition: ubjson.h:864
#define UBJEncoder_uint8(o, v)
Encode a U8 value.
Definition: ubjson.h:740
#define UBJEncoder_null(o)
Encode null.
Definition: ubjson.h:725
UBJEStatus
UBJSON Encoder status.
Definition: ubjson.h:411
UBJEncoder(UBJEBuf *buf)
Create/initialize an UBJEncoder instance.
Definition: ubjson.h:843
#define UBJEncoder_string(o, v, l)
Encode string bytes without requiring NUL termination.
Definition: ubjson.h:805
#define UBJEncoder_int16(o, v)
Encode a S16 value.
Definition: ubjson.h:764
int setName(const char *n)
Store a name for the next object value; do not use for array elements.
Definition: ubjson.h:849
int UBJEncoder_vset(UBJEncoder *o, const char **fmt, va_list *argList, int isObj)
Emit formatted values as for set(), advancing the format cursor.
#define UBJEncoder_boolean(o, v)
Encode a boolean.
Definition: ubjson.h:732
UBJEBuf(UBJEBuf_FlushCB cb, U8 *buf, S32 bufLen)
Initialize the UBJSON Encoder buffer.
Definition: ubjson.h:401
int getCount()
Query the current container's declared count.
Definition: ubjson.h:355
int parse(const U8 *buf, U32 size)
Feed or resume parsing a top-level UBJSON object/array.
Definition: ubjson.h:349
#define UBJEncoder_float64(o, v)
Encode a double value.
Definition: ubjson.h:788
int(* UBJEBuf_FlushCB)(struct UBJEBuf *o, int sizeRequired)
Make room in an encoder buffer by flushing or expanding it.
Definition: ubjson.h:373
#define UBJEncoder_int64(o, v)
Encode a S64 value.
Definition: ubjson.h:780
int set(const char *fmt,...)
Encode/serialize C structs/data to UBJSON using formatted output.
Definition: ubjson.h:903
#define UBJEncoder_beginObject(o, count, sType)
Begin an object; emit exactly count named members when count is nonnegative.
Definition: ubjson.h:824
UBJPStatus
UBJSON Parser Status.
Definition: ubjson.h:92
int endArray()
Close the matching current container.
Definition: ubjson.h:891
UBJParser(UBJPIntf *intf, char *name, int memberNameLen, int extraStackLen=0)
Create the callback interface object.
Definition: ubjson.h:342
#define UBJEncoder_int32(o, v)
Encode a S32 value.
Definition: ubjson.h:772
int string(const char *s, S32 len)
Emit a length-delimited string.
Definition: ubjson.h:882
#define UBJParser_getStatus(o)
Definition: ubjson.h:339
int(* UBJPIntf_Service)(struct UBJPIntf *o, UBJVal *v, int recLevel)
Receive a parsed UBJSON event synchronously.
Definition: ubjson.h:191
int beginArray(S32 count=-1, UBJT type=UBJT_InvalidType)
Begin formatting an array.
Definition: ubjson.h:885
int float32(float v)
Emit one float32 value.
Definition: ubjson.h:879
UBJPIntf(UBJPIntf_Service s)
Create the callback interface object.
Definition: ubjson.h:216
#define UBJEncoder_beginArray(o, count, sType)
Begin an array; emit exactly count children when count is nonnegative.
Definition: ubjson.h:814
int float64(double v)
Emit one float64 value.
Definition: ubjson.h:876
int getStatus()
Definition: ubjson.h:358
~UBJParser()
No-op destructor.
Definition: ubjson.h:346
int int64(S64 v)
Emit one int64 value.
Definition: ubjson.h:873
void reset()
Discard buffered bytes and clear status and the pending member name.
Definition: ubjson.h:897
int boolean(bool b)
Emit one boolean value.
Definition: ubjson.h:855
#define UBJEncoder_destructor(o)
No-op; does not flush or free buffers.
Definition: ubjson.h:688
int null()
Emit UBJSON null.
Definition: ubjson.h:852
#define UBJEncoder_endObject(o)
End the current object.
Definition: ubjson.h:840
int int16(S16 v)
Emit one int16 value.
Definition: ubjson.h:867
int beginObject(S32 count=-1, UBJT type=UBJT_InvalidType)
Begin formatting an object.
Definition: ubjson.h:888
@ UBJT_Int8
Type UBJT_Int8.
Definition: ubjson.h:72
@ UBJT_BeginObject
Type UBJT_BeginObject.
Definition: ubjson.h:82
@ UBJT_EndArray
Type UBJT_EndArray.
Definition: ubjson.h:86
@ UBJT_Boolean
Type UBJT_Boolean.
Definition: ubjson.h:71
@ UBJT_HNumber
Raw numeric text; the parser does not validate its grammar.
Definition: ubjson.h:79
@ UBJT_BeginArray
Type UBJT_BeginArray.
Definition: ubjson.h:83
@ UBJT_Int64
Type UBJT_Int64.
Definition: ubjson.h:76
@ UBJT_NoOp
Type UBJT_NoOp.
Definition: ubjson.h:70
@ UBJT_Float64
Type UBJT_Float64.
Definition: ubjson.h:78
@ UBJT_Int32
Type UBJT_Int32.
Definition: ubjson.h:75
@ UBJT_String
Type UBJT_String.
Definition: ubjson.h:81
@ UBJT_Count
Type UBJT_Count.
Definition: ubjson.h:84
@ UBJT_Null
Type UBJT_Null.
Definition: ubjson.h:69
@ UBJT_Int16
Type UBJT_Int16.
Definition: ubjson.h:74
@ UBJT_InvalidType
Not a valid UBJSON type.
Definition: ubjson.h:68
@ UBJT_Char
Type UBJT_Char.
Definition: ubjson.h:80
@ UBJT_Float32
Type UBJT_Float32.
Definition: ubjson.h:77
@ UBJT_Uint8
Type UBJT_Uint8.
Definition: ubjson.h:73
@ UBJT_EndObject
Type UBJT_EndObject.
Definition: ubjson.h:85
@ UBJEStatus_ok
No error.
Definition: ubjson.h:434
@ UBJEStatus_TypeMismatch
The value set does not match the type set for Optimized Strongly Typed.
Definition: ubjson.h:422
@ UBJEStatus_LengthRequired
Length required for Optimized Strongly Typed Container.
Definition: ubjson.h:416
@ UBJEStatus_StackOverflow
Object depth exceeding internal stack.
Definition: ubjson.h:419
@ UBJEStatus_EmptyName
Empty object member names are unsupported.
Definition: ubjson.h:431
@ UBJEStatus_Unknown
Unknown type (Must be a type from UBJT)
Definition: ubjson.h:428
@ UBJEStatus_FlushErr
UBJEBuf_FlushCB returned a non zero value.
Definition: ubjson.h:413
@ UBJEStatus_Unbalanced
(curly) bracket start/end mismatch
Definition: ubjson.h:425
@ UBJPStatus_Done
The parser completed parsing a new UBJSON object, but found the unread bytes in the supplied buffer,...
Definition: ubjson.h:101
@ UBJPStatus_ParseErr
UBJSON Parse error.
Definition: ubjson.h:108
@ UBJPStatus_Overflow
Parsed data/array/object too big.
Definition: ubjson.h:116
@ UBJPStatus_DoneEOS
The parser completed parsing a new UBJSON object.
Definition: ubjson.h:96
@ UBJPStatus_IntfErr
The UBJParserIntf interface reported a problem.
Definition: ubjson.h:112
@ UBJPStatus_NeedMoreData
The parser requires more data to complete.
Definition: ubjson.h:104
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
int16_t S16
Signed 16-bit integer.
Definition: GenPrimT.h:86
uint8_t U8
Unsigned 8-bit integer.
Definition: GenPrimT.h:92
int8_t S8
Signed 8-bit integer.
Definition: GenPrimT.h:84
The UBJSON Encoder buffer is used by the encoder UBJEncoder.
Definition: ubjson.h:377
UBJSON Encoder.
Definition: ubjson.h:452
The UBJPIntf interface class is the interface between the parser and an object that implements the UB...
Definition: ubjson.h:199
The event based parser uses a stack instead of recursion and the UBJPStackNode type represent one ent...
Definition: ubjson.h:170
The UBJSON parser parses a binary UBJSON stream and calls the UBJPIntf callback interface for each pa...
Definition: ubjson.h:238
UBJParser Value (passed into the parser callback interface UBJPIntf)
Definition: ubjson.h:120
U8 uint8
Use when 't' is UBJT_Uint8 or UBJT_Boolean.
Definition: ubjson.h:123
S32 int32
Use when 't' is UBJT_Int32.
Definition: ubjson.h:127
double float64
Use when 't' is UBJT_Float64.
Definition: ubjson.h:129
S8 int8
Use when 't' is UBJT_Int8.
Definition: ubjson.h:124
S64 int64
Use when 't' is UBJT_Int64.
Definition: ubjson.h:128
float float32
Use when 't' is UBJT_Float32.
Definition: ubjson.h:130
const char * string
Borrowed chunk for String/HNumber; not NUL-terminated.
Definition: ubjson.h:131
S16 int16
Use when 't' is UBJT_Int16.
Definition: ubjson.h:126
S32 len
When t=UBJT_Count: container len, When t=UBJT_String: string chunk len.
Definition: ubjson.h:135
char * name
Object member name: set when parent is an object.
Definition: ubjson.h:141
S32 x
When t=UBJT_Count: type UBJT.
Definition: ubjson.h:138
char ch
Use when 't' is UBJT_Char.
Definition: ubjson.h:125
U8 t
UBJSON Type, t is set to one of the types in UBJT.
Definition: ubjson.h:144