Barracuda Application Server C/C++ Reference
NO
UBJEncoder Struct Reference

Detailed Description

UBJSON Encoder.

The encoder performs limited error checking and you can produce incorrect UBJSON data if you incorrectly use the methods in this class.

#include <ubjson.h>

Public Member Functions

 UBJEncoder (UBJEBuf *buf)
 Create/initialize an UBJEncoder instance. More...
 
 ~UBJEncoder ()
 Destructor.
 
int setName (const char *n)
 Set member name. More...
 
int null ()
 Set UBJSON NULL.
 
int boolean (bool b)
 Set boolean.
 
int uint8 (U8 v)
 Set uint8.
 
int int8 (S8 v)
 Set int8.
 
int character (char v)
 Set 'char'.
 
int int16 (S16 v)
 Set int16.
 
int int32 (S32 v)
 Set int32.
 
int int64 (S64 v)
 Set int64.
 
int float64 (double v)
 Set float64.
 
int float32 (float v)
 Set float32.
 
int string (const char *s, S32 len)
 Set string.
 
int beginArray (S32 count=-1, UBJT type=UBJT_InvalidType)
 Begin formatting an array. More...
 
int beginObject (S32 count=-1, UBJT type=UBJT_InvalidType)
 Begin formatting an object. More...
 
int endArray ()
 End of array.
 
int endObject ()
 End of object.
 
void reset ()
 Resets the UBJEBuf cursor (the buffer provided in the constructor)
 
int vset (const char **fmt, va_list *argList, bool isObj)
 See UBJEncoder:set for details.
 
int set (const char *fmt,...)
 Encode/serialize C structs/data to UBJSON using formatted output. More...