Barracuda Application Server C/C++ Reference
NO
ubjson.h
1 /*
2  * ____ _________ __ _
3  * / __ \___ ____ _/ /_ __(_)___ ___ ___ / / ____ ____ _(_)____
4  * / /_/ / _ \/ __ `/ / / / / / __ `__ \/ _ \/ / / __ \/ __ `/ / ___/
5  * / _, _/ __/ /_/ / / / / / / / / / / / __/ /___/ /_/ / /_/ / / /__
6  * /_/ |_|\___/\__,_/_/ /_/ /_/_/ /_/ /_/\___/_____/\____/\__, /_/\___/
7  * /____/
8  *
9  * Barracuda Application Server
10  *
11  ****************************************************************************
12  * HEADER
13  *
14  * $Id: ubjson.h 4914 2021-12-01 18:24:30Z wini $
15  *
16  * COPYRIGHT: Real Time Logic LLC, 2014
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 
41 #ifndef __ubjson_h
42 #define __ubjson_h
43 
44 #include <TargConfig.h>
45 #include <stdarg.h>
46 
52 #ifndef UBJ_ALIGNMT
53 #define UBJ_ALIGNMT uintptr_t
54 #endif
55 #define UBJ_POINTER_NOT_ALIGNED(p) \
56  (0 != ((uintptr_t)p & (sizeof(UBJ_ALIGNMT) - 1)))
57 
58 
59 #define UBJPARS_STACK_LEN 3
60 
65 typedef enum {
67  UBJT_Null='Z',
68  UBJT_NoOp='N',
70  UBJT_Int8='i',
71  UBJT_Uint8='U',
72  UBJT_Int16='I',
73  UBJT_Int32='l',
74  UBJT_Int64='L',
78  UBJT_Char='C',
82  UBJT_Count='#',
84  UBJT_EndArray=']'
85 } UBJT;
86 
87 
90 typedef enum {
91 
95 
100 
103 
107 
111 
116 
118 typedef struct {
120  union {
121  U8 uint8;
122  S8 int8;
123  char ch;
124  S16 int16;
125  S32 int32;
126  S64 int64;
127 #ifndef NO_DOUBLE
128  double float64;
129  float float32;
130 #endif
131  const char* string;
132  } u;
133 
135  S32 len;
136 
138  S32 x;
139 
141  char* name;
142 
144  U8 t;
145 } UBJVal;
146 
147 
148 #ifdef __cplusplus
149 extern "C" {
150 #endif
151 
152 /* Sets the value type (t) and the union (u) to the smallest number
153  representation for 'in'
154 */
155 void UBJVal_setMinInteger(UBJVal* o, S64 in);
156 
157 #ifdef __cplusplus
158 }
159 #endif
160 
161 
165 typedef struct
166 {
167  S32 count; /* Set if optimized format */
168  S32 ix; /* Current index goes from 0 to count-1 */
169  U8 isObj; /* TRUE for object, FALSE for Array */
170  U8 stronglyTyped; /* Set to token type if a strongly typed container */
171 } UBJPStackNode;
172 
173 
174 struct UBJPIntf;
175 
181 typedef int (*UBJPIntf_Service)(struct UBJPIntf* o, UBJVal* v, int recLevel);
182 
183 
188 typedef struct UBJPIntf
189 {
190 #ifdef __cplusplus
191 
195  ~UBJPIntf();
196  UBJPIntf() {}
197 #endif
198  UBJPIntf_Service service;
200 
201 #define UBJPIntf_constructor(o,serviceMA) (o)->service=serviceMA
202 #define UBJPIntf_destructor(o)
203 #define UBJPIntf_service(o,v,recLev) (o)->service(o,v,recLev)
204 
205 #ifdef __cplusplus
207  UBJPIntf_constructor(this, s);
208 }
209 inline UBJPIntf::~UBJPIntf() {
210  UBJPIntf_destructor(this);
211 }
212 #endif
213 
220 typedef struct UBJParser
221 {
222 #ifdef __cplusplus
223 
236  UBJParser(UBJPIntf* intf,char* name,int memberNameLen,int extraStackLen=0);
237 
248  int parse(const U8* buf, U32 size);
249 
251  ~UBJParser();
252 
256  int getIndex();
257 
262  int getCount();
263 
268  int getStatus();
269 
270 #endif
271  const U8* lxBufEnd;
272  const U8* lxTokenPtr;
273  U8* valPtr;
274  S32 lxBytes2Read;
275  U8 lxParseX; /* Parsing one of: S, H # */
276  U8 lxState; /* UBJLxState */
277  U8 status; /* UBJPStatus */
278  U8 pState; /* parser state */
279  UBJVal val;
280  UBJPIntf* intf;
281  int memberNameLen;
282  int stackIx; /* index in 'stack' */
283  int stackLen; /* min UBJPARS_STACK_LEN */
284  U8 stringFragment;
285  UBJPStackNode stack[UBJPARS_STACK_LEN];
287 
288 #ifdef __cplusplus
289 extern "C" {
290 #endif
291 void UBJParser_constructor(UBJParser* o, UBJPIntf* intf, char* name,
292  int memberNameLen, int extraStackLen);
293 #define UBJParser_destructor(o)
294 int UBJParser_parse(UBJParser* o, const U8* buf, U32 size);
295 #define UBJParser_getIndex(o) (o)->stack[(o)->stackIx].ix
296 #define UBJParser_getCount(o) (o)->stack[(o)->stackIx].count
297 #define UBJParser_getStatus(o) (o)->status
298 #ifdef __cplusplus
299 }
301  UBJPIntf* intf, char* name, int memberNameLen, int extraStackLen) {
302  UBJParser_constructor(this, intf, name, memberNameLen, extraStackLen);
303 }
305  UBJParser_destructor(this);
306 }
307 inline int UBJParser::parse(const U8* buf, U32 size) {
308  return UBJParser_parse(this, buf, size);
309 }
310 inline int UBJParser::getIndex() {
311  return UBJParser_getIndex(this);
312 }
313 inline int UBJParser::getCount() {
314  return UBJParser_getCount(this);
315 }
316 inline int UBJParser::getStatus() {
317  return UBJParser_getStatus(this);
318 }
319 #endif
320 
321 struct UBJEBuf;
322 
329 typedef int (*UBJEBuf_FlushCB)(struct UBJEBuf* o, int sizeRequired);
330 
332 typedef struct UBJEBuf
333 {
334 #ifdef __cplusplus
335 
340  UBJEBuf(UBJEBuf_FlushCB cb, U8* buf, S32 bufLen);
341  ~UBJEBuf();
342 #endif
343  UBJEBuf_FlushCB flushCB;
344  U8* data;
345  S32 dlen;
346  S32 cursor;
348 
349 #define UBJEBuf_constructor(o, flushCBM, dataM, dlenM) \
350  (o)->flushCB=flushCBM,(o)->data=dataM,(o)->dlen=dlenM,(o)->cursor=0
351 #define UBJEBuf_destructor(o)
352 
353 #ifdef __cplusplus
354 inline UBJEBuf::UBJEBuf(UBJEBuf_FlushCB cb, U8* buf, S32 bufLen) {
355  UBJEBuf_constructor(this, cb,buf,bufLen);
356 }
357 inline UBJEBuf::~UBJEBuf() {
358  UBJEBuf_destructor(this);
359 }
360 #endif
361 
363 typedef enum
364 {
367 
370 
373 
376 
379 
382 
384  UBJEStatus_ok=0
386 
387 
393 typedef struct UBJEncoder
394 {
395 #ifdef __cplusplus
396 
402  UBJEncoder(UBJEBuf* buf);
403 
406  ~UBJEncoder();
407 
411  int setName(const char* n);
412 
414  int null();
415 
417  int boolean(bool b);
418 
420  int uint8(U8 v);
421 
423  int int8(S8 v);
424 
426  int character(char v);
427 
429  int int16(S16 v);
430 
432  int int32(S32 v);
433 
435  int int64(S64 v);
436 
438  int float64(double v);
439 
441  int float32(float v);
442 
444  int string(const char* s, S32 len);
445 
458  int beginArray(S32 count=-1, UBJT type=UBJT_InvalidType);
459 
472  int beginObject(S32 count=-1, UBJT type=UBJT_InvalidType);
473 
475  int endArray();
476 
478  int endObject();
479 
481  void reset();
482 
484  int vset(const char** fmt, va_list* argList, bool isObj);
485 
514  int set(const char* fmt, ...);
515 #endif
516 
517  UBJVal val;
518  struct /* Used as bit field and set if the object/array has a 'count' */
519  {
520  S32 level;
521  U8 data[8];
522  } countStack;
523  UBJEBuf* buf;
524  int status;
525  UBJT stronglyTyped;
527 
528 
532 #define UBJE_MEMBER(o, m) #m, (o)->m
533 
534 #define UBJEncoder_constructor(o, ubjsBuf) \
535  memset(o,0,sizeof(UBJEncoder)),(o)->buf=ubjsBuf
536 #define UBJEncoder_destructor(o)
537 #define UBJEncoder_reset(o) ((o)->status=0,(o)->val.name=0,o->buf->cursor=0,0)
538 
539 #ifdef __cplusplus
540 extern "C" {
541 #endif
542 int UBJEncoder_setStatus(UBJEncoder* o, UBJEStatus s);
543 int UBJEncoder_val(UBJEncoder* o);
544 int UBJEncoder_vset(UBJEncoder* o,const char** fmt,va_list* argList,int isObj);
545 int UBJEncoder_set(UBJEncoder* o, const char* fmt, ...);
546 #ifdef __cplusplus
547 }
548 #endif
549 
550 #define UBJEncoder_setName(o,v) ((o)->val.name=(char*)v)
551 #define UBJEncoder_null(o) ((o)->val.t=UBJT_Null,UBJEncoder_val(o))
552 #define UBJEncoder_boolean(o,v) \
553  ((o)->val.t=UBJT_Boolean,(o)->val.u.uint8=v,UBJEncoder_val(o))
554 #define UBJEncoder_uint8(o,v) \
555  ((o)->val.t=UBJT_Uint8,(o)->val.u.uint8=v,UBJEncoder_val(o))
556 #define UBJEncoder_int8(o,v) \
557  ((o)->val.t=UBJT_Int8,(o)->val.u.int8=v,UBJEncoder_val(o))
558 #define UBJEncoder_character(o,v) \
559  ((o)->val.t=UBJT_Char,(o)->val.u.int8=v,UBJEncoder_val(o))
560 #define UBJEncoder_int16(o,v) \
561  ((o)->val.t=UBJT_Int16,(o)->val.u.int16=v,UBJEncoder_val(o))
562 #define UBJEncoder_int32(o,v) \
563  ((o)->val.t=UBJT_Int32,(o)->val.u.int32=v,UBJEncoder_val(o))
564 #define UBJEncoder_int64(o,v) \
565  ((o)->val.t=UBJT_Int64,(o)->val.u.int64=v,UBJEncoder_val(o))
566 #define UBJEncoder_float64(o,v) \
567  ((o)->val.t=UBJT_Float64,(o)->val.u.float64=v,UBJEncoder_val(o))
568 #define UBJEncoder_float32(o,v) \
569  ((o)->val.t=UBJT_Float32,(o)->val.u.float32=v,UBJEncoder_val(o))
570 #define UBJEncoder_string(o,v,l) \
571  ((o)->val.t=UBJT_String,(o)->val.u.string=v,(o)->val.len=l,UBJEncoder_val(o))
572 #define UBJEncoder_beginArray(o,count, sType) \
573  ((o)->val.t=UBJT_BeginArray,(o)->val.len=count, \
574  (o)->val.x=sType,UBJEncoder_val(o))
575 #define UBJEncoder_beginObject(o,count, sType) \
576  ((o)->val.t=UBJT_BeginObject,(o)->val.len=count, \
577  (o)->val.x=sType,UBJEncoder_val(o))
578 #define UBJEncoder_endArray(o) ((o)->val.t=UBJT_EndArray,UBJEncoder_val(o))
579 #define UBJEncoder_endObject(o) ((o)->val.t=UBJT_EndObject,UBJEncoder_val(o))
580 
581 #ifdef __cplusplus
583  UBJEncoder_constructor(this, b);
584 }
586  UBJEncoder_destructor(this);
587 }
588 inline int UBJEncoder::setName(const char* n) {
589  return UBJEncoder_setName(this, n);
590 }
591 inline int UBJEncoder::null() {
592  return UBJEncoder_null(this);
593 }
594 inline int UBJEncoder::boolean(bool b) {
595  return UBJEncoder_boolean(this, b ? 1 : 0);
596 }
597 inline int UBJEncoder::uint8(U8 v) {
598  return UBJEncoder_uint8(this, v);
599 }
600 inline int UBJEncoder::int8(S8 v) {
601  return UBJEncoder_int8(this, v);
602 }
603 inline int UBJEncoder::character(char v) {
604  return UBJEncoder_character(this, v);
605 }
606 inline int UBJEncoder::int16(S16 v) {
607  return UBJEncoder_int16(this, v);
608 }
609 inline int UBJEncoder::int32(S32 v) {
610  return UBJEncoder_int32(this, v);
611 }
612 inline int UBJEncoder::int64(S64 v) {
613  return UBJEncoder_int64(this, v);
614 }
615 inline int UBJEncoder::float64(double v) {
616  return UBJEncoder_float64(this, v);
617 }
618 inline int UBJEncoder::float32(float v) {
619  return UBJEncoder_float32(this, v);
620 }
621 inline int UBJEncoder::string(const char* s, S32 len) {
622  return UBJEncoder_string(this, s, len);
623 }
624 inline int UBJEncoder::beginArray(S32 count, UBJT t) {
625  return UBJEncoder_beginArray(this, count, t);
626 }
627 inline int UBJEncoder::beginObject(S32 count, UBJT t) {
628  return UBJEncoder_beginObject(this, count, t);
629 }
630 inline int UBJEncoder::endArray() {
631  return UBJEncoder_endArray(this);
632 }
633 inline int UBJEncoder::endObject() {
634  return UBJEncoder_endObject(this);
635 }
636 inline void UBJEncoder::reset() {
637  UBJEncoder_reset(this);
638 }
639 inline int UBJEncoder::vset(const char** fmt, va_list* argList, bool isObj){
640  return UBJEncoder_vset(this, fmt, argList, isObj ? 1 : 0);
641 }
642 inline int UBJEncoder::set(const char* fmt, ...){
643  int status;
644  va_list varg;
645  va_start(varg, fmt);
646  status = UBJEncoder_vset(this, &fmt, &varg, 0);
647  va_end(varg);
648  return status;
649 }
650 #endif
651  /* end of UBJSONRef */
653 
654 
655 #endif
UBJT
UBJT
UBJSON Value Type: See UBJVal::t and the UBJSON type reference for more information.
Definition: ubjson.h:65
UBJParser::parse
int parse(const U8 *buf, U32 size)
Parse a UBJSON chunk.
Definition: ubjson.h:307
UBJEncoder::beginObject
int beginObject(S32 count=-1, UBJT type=UBJT_InvalidType)
Begin formatting an object.
Definition: ubjson.h:627
UBJT_NoOp
@ UBJT_NoOp
Type UBJT_NoOp.
Definition: ubjson.h:68
UBJEBuf::UBJEBuf
UBJEBuf(UBJEBuf_FlushCB cb, U8 *buf, S32 bufLen)
Initialize the UBJSON Encoder buffer.
Definition: ubjson.h:354
UBJT_EndObject
@ UBJT_EndObject
Type UBJT_EndObject.
Definition: ubjson.h:83
UBJEStatus_TypeMismatch
@ UBJEStatus_TypeMismatch
The value set does not mach type set for Optimized Strongly Typed
Definition: ubjson.h:375
UBJEncoder::~UBJEncoder
~UBJEncoder()
Destructor.
Definition: ubjson.h:585
UBJT_Int8
@ UBJT_Int8
Type UBJT_Int8.
Definition: ubjson.h:70
UBJParser
The UBJSON parser parses a binary UBJSON stream and calls the UBJPIntf callback interface for each pa...
Definition: ubjson.h:221
UBJParser::~UBJParser
~UBJParser()
Destructor.
Definition: ubjson.h:304
UBJT_String
@ UBJT_String
Type UBJT_String.
Definition: ubjson.h:79
UBJParser::getStatus
int getStatus()
Returns the parser status.
Definition: ubjson.h:316
UBJEncoder::int8
int int8(S8 v)
Set int8.
Definition: ubjson.h:600
UBJParser::getCount
int getCount()
Returns the length of the optimized container when type (t) is UBJT_Count.
Definition: ubjson.h:313
UBJPIntf::UBJPIntf
UBJPIntf(UBJPIntf_Service s)
Create the callback interface object.
Definition: ubjson.h:206
UBJEncoder::beginArray
int beginArray(S32 count=-1, UBJT type=UBJT_InvalidType)
Begin formatting an array.
Definition: ubjson.h:624
UBJParser::UBJParser
UBJParser(UBJPIntf *intf, char *name, int memberNameLen, int extraStackLen=0)
Create the callback interface object.
Definition: ubjson.h:300
UBJEStatus
UBJEStatus
UBJSON Encoder status.
Definition: ubjson.h:364
UBJVal::int16
S16 int16
Use when 't' is UBJT_Int16.
Definition: ubjson.h:124
UBJPStatus_Done
@ UBJPStatus_Done
The parser completed parsing a new UBJSON object, but found the start of a new object in the provided...
Definition: ubjson.h:99
UBJVal::len
S32 len
When t=UBJT_Count: container len, When t=UBJT_String: string chunk len.
Definition: ubjson.h:135
UBJVal::int8
S8 int8
Use when 't' is UBJT_Uint8.
Definition: ubjson.h:122
UBJEncoder::float64
int float64(double v)
Set float64.
Definition: ubjson.h:615
UBJT_Uint8
@ UBJT_Uint8
Type UBJT_Uint8.
Definition: ubjson.h:71
UBJVal::float32
float float32
Use when 't' is UBJT_Float32.
Definition: ubjson.h:129
UBJPStatus_IntfErr
@ UBJPStatus_IntfErr
The UBJParserIntf interface reported a problem.
Definition: ubjson.h:110
UBJT_Null
@ UBJT_Null
Type UBJT_Null.
Definition: ubjson.h:67
UBJEncoder::vset
int vset(const char **fmt, va_list *argList, bool isObj)
See UBJEncoder:set for details.
Definition: ubjson.h:639
UBJVal::string
const char * string
Use when 't' is UBJT_String.
Definition: ubjson.h:131
UBJT_Int16
@ UBJT_Int16
Type UBJT_Int16.
Definition: ubjson.h:72
UBJEncoder::boolean
int boolean(bool b)
Set boolean.
Definition: ubjson.h:594
UBJEncoder::endArray
int endArray()
End of array.
Definition: ubjson.h:630
UBJEncoder::float32
int float32(float v)
Set float32.
Definition: ubjson.h:618
UBJEncoder::reset
void reset()
Resets the UBJEBuf cursor (the buffer provided in the constructor)
Definition: ubjson.h:636
UBJVal::uint8
U8 uint8
Use when 't' is UBJT_Uint8 or UBJT_Boolean.
Definition: ubjson.h:121
UBJEncoder::int16
int int16(S16 v)
Set int16.
Definition: ubjson.h:606
UBJEBuf
The UBJSON Encoder buffer is used by the encoder UBJEncoder.
Definition: ubjson.h:333
UBJEncoder
UBJSON Encoder.
Definition: ubjson.h:394
UBJPIntf
The UBJPIntf interface class is the interface between the parser and an object that implements the UB...
Definition: ubjson.h:189
UBJEncoder::uint8
int uint8(U8 v)
Set uint8.
Definition: ubjson.h:597
UBJParser::getIndex
int getIndex()
Returns the current container index position when parsing an optimized container.
Definition: ubjson.h:310
UBJT_InvalidType
@ UBJT_InvalidType
Not a valid UBJSON type.
Definition: ubjson.h:66
UBJT_Int32
@ UBJT_Int32
Type UBJT_Int32.
Definition: ubjson.h:73
UBJParser
struct UBJParser UBJParser
The UBJSON parser parses a binary UBJSON stream and calls the UBJPIntf callback interface for each pa...
UBJEStatus_Unknown
@ UBJEStatus_Unknown
Unknown type (Must be a type from UBJT)
Definition: ubjson.h:381
UBJEncoder::character
int character(char v)
Set 'char'.
Definition: ubjson.h:603
UBJPStatus_DoneEOS
@ UBJPStatus_DoneEOS
The parser completed parsing a new UBJSON object.
Definition: ubjson.h:94
UBJT_BeginArray
@ UBJT_BeginArray
Type UBJT_BeginArray.
Definition: ubjson.h:81
UBJEStatus_LengthRequired
@ UBJEStatus_LengthRequired
Length required for Optimized Strongly Typed Container.
Definition: ubjson.h:369
UBJVal::int64
S64 int64
Use when 't' is UBJT_Int64.
Definition: ubjson.h:126
UBJPStatus_ParseErr
@ UBJPStatus_ParseErr
UBJSON Parse error.
Definition: ubjson.h:106
UBJEncoder::string
int string(const char *s, S32 len)
Set string.
Definition: ubjson.h:621
UBJPStatus_NeedMoreData
@ UBJPStatus_NeedMoreData
The parser requires more data to complete.
Definition: ubjson.h:102
UBJVal::name
char * name
Object member name: set when parent is an object.
Definition: ubjson.h:141
UBJPIntf_Service
int(* UBJPIntf_Service)(struct UBJPIntf *o, UBJVal *v, int recLevel)
Parser callback function used by interface class UBJPIntf.
Definition: ubjson.h:181
UBJEStatus_FlushErr
@ UBJEStatus_FlushErr
UBJEBuf_FlushCB returned a non zero value.
Definition: ubjson.h:366
UBJEncoder::setName
int setName(const char *n)
Set member name.
Definition: ubjson.h:588
UBJVal::x
S32 x
When t=UBJT_Count: type UBJT.
Definition: ubjson.h:138
UBJVal::int32
S32 int32
Use when 't' is UBJT_Int32.
Definition: ubjson.h:125
UBJEncoder::endObject
int endObject()
End of object.
Definition: ubjson.h:633
UBJEncoder::int32
int int32(S32 v)
Set int32.
Definition: ubjson.h:609
UBJVal::ch
char ch
Use when 't' is UBJT_Char.
Definition: ubjson.h:123
UBJT_Int64
@ UBJT_Int64
Type UBJT_Int64.
Definition: ubjson.h:74
UBJPStatus_Overflow
@ UBJPStatus_Overflow
Parsed data/array/object too big.
Definition: ubjson.h:114
UBJEncoder::int64
int int64(S64 v)
Set int64.
Definition: ubjson.h:612
UBJEStatus_ok
@ UBJEStatus_ok
No error.
Definition: ubjson.h:384
UBJPIntf
struct UBJPIntf UBJPIntf
The UBJPIntf interface class is the interface between the parser and an object that implements the UB...
UBJT_BeginObject
@ UBJT_BeginObject
Type UBJT_BeginObject.
Definition: ubjson.h:80
UBJEBuf_FlushCB
int(* UBJEBuf_FlushCB)(struct UBJEBuf *o, int sizeRequired)
UBJSON Encoder buffer callback can be used for flushing the buffer or for expanding the buffer.
Definition: ubjson.h:329
UBJT_Count
@ UBJT_Count
Type UBJT_Count.
Definition: ubjson.h:82
UBJVal
UBJParser Value (passed into the parser callback interface UBJPIntf)
Definition: ubjson.h:118
UBJEStatus_StackOverflow
@ UBJEStatus_StackOverflow
Object depth exceeding internal stack.
Definition: ubjson.h:372
UBJPStatus
UBJPStatus
UBJSON Parser Status.
Definition: ubjson.h:90
UBJT_HNumber
@ UBJT_HNumber
Type UBJT_HNumber.
Definition: ubjson.h:77
UBJEncoder::UBJEncoder
UBJEncoder(UBJEBuf *buf)
Create/initialize an UBJEncoder instance.
Definition: ubjson.h:582
UBJVal::float64
double float64
Use when 't' is UBJT_Float64.
Definition: ubjson.h:128
UBJT_Float64
@ UBJT_Float64
Type UBJT_Float64.
Definition: ubjson.h:76
UBJVal::t
U8 t
UBJSON Type, t is set to one of the types in UBJT.
Definition: ubjson.h:144
UBJT_Char
@ UBJT_Char
Type UBJT_Char.
Definition: ubjson.h:78
UBJT_Boolean
@ UBJT_Boolean
Type UBJT_Boolean.
Definition: ubjson.h:69
UBJEBuf
struct UBJEBuf UBJEBuf
The UBJSON Encoder buffer is used by the encoder UBJEncoder.
UBJT_Float32
@ UBJT_Float32
Type UBJT_Float32.
Definition: ubjson.h:75
UBJEncoder::set
int set(const char *fmt,...)
Encode/serialize C structs/data to UBJSON using formatted output.
Definition: ubjson.h:642
UBJPStackNode
The event based parser uses a stack instead of recursion and the UBJPStackNode type represent one ent...
Definition: ubjson.h:166
UBJEncoder
struct UBJEncoder UBJEncoder
UBJSON Encoder.
UBJEStatus_Unbalanced
@ UBJEStatus_Unbalanced
(curly) bracket start/end mismatch
Definition: ubjson.h:378
UBJT_EndArray
@ UBJT_EndArray
Type UBJT_EndArray.
Definition: ubjson.h:84
UBJEncoder::null
int null()
Set UBJSON NULL.
Definition: ubjson.h:591