Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
JEncoder.h File Reference
#include "JVal.h"
#include "BufPrint.h"
Include dependency graph for JEncoder.h:

Go to the source code of this file.

Classes

struct  JEncoder
 The JEncoder can serialize a JSON JVAL syntax tree to the JSON text format. More...
 

Macros

#define JEncoder_destructor(o)   JEncoder_flush(o)
 Call flush() without freeing the borrowed writer or error object. More...
 
#define JEncoder_getErr(o)   (o)->err
 Query error storage. More...
 
#define JEncoder_getBufPrint(o)   (o)->out
 Query output storage. More...
 
#define JE_MEMBER(o, m)   #m, (o)->m
 JEncoder::set helper macro, used when setting a value for an object. More...
 

Typedefs

typedef struct JEncoder JEncoder
 The JEncoder can serialize a JSON JVAL syntax tree to the JSON text format. More...
 

Functions

BA_API void JEncoder_constructor (JEncoder *o, JErr *err, BufPrint *out)
 Initialize an encoder without writing output or resetting err. More...
 
BA_API int JEncoder_flush (JEncoder *o)
 Flush the underlying writer if JErr is clear. More...
 
BA_API int JEncoder_commit (JEncoder *o)
 Permit a new top-level value and flush the writer. More...
 
BA_API int JEncoder_setInt (JEncoder *o, S32 val)
 Write a JSON number. More...
 
BA_API int JEncoder_setLong (JEncoder *o, S64 val)
 Write a JSON number. More...
 
BA_API int JEncoder_setDouble (JEncoder *o, double val)
 Write a JSON number. More...
 
BA_API int JEncoder_fmtString (JEncoder *o, const char *fmt,...)
 Format text inside JSON quotation marks. More...
 
BA_API int JEncoder_vFmtString (JEncoder *o, const char *fmt, va_list argList)
 Write formatted text between JSON quotes, or JSON null. More...
 
BA_API int JEncoder_setString (JEncoder *o, const char *val, size_t len)
 Write a quoted JSON string through BufPrint::jsonString. More...
 
BA_API int JEncoder_b64enc (JEncoder *o, const void *source, S32 slen)
 Write binary data as a quoted standard Base64 string. More...
 
BA_API int JEncoder_setBoolean (JEncoder *o, BaBool val)
 Write a JSON boolean. More...
 
BA_API int JEncoder_setNull (JEncoder *o)
 Write JSON null. More...
 
BA_API int JEncoder_setJV (JEncoder *o, struct JVal *val, BaBool iterateNext)
 Serialize a JVal node and its child values. More...
 
BA_API int JEncoder_set (JEncoder *o, const char *fmt,...)
 Encode/serialize C structs/data to JSON using formatted output. More...
 
BA_API int JEncoder_setName (JEncoder *o, const char *name)
 Write an object member name before its value. More...
 
BA_API int JEncoder_beginObject (JEncoder *o)
 Begin a JSON object value; call setName() before each member value. More...
 
BA_API int JEncoder_endObject (JEncoder *o)
 Close the current object after its final complete member. More...
 
BA_API int JEncoder_beginArray (JEncoder *o)
 Begin a JSON array value; array elements have no member-name call. More...
 
BA_API int JEncoder_endArray (JEncoder *o)
 Close the current array after its final complete element. More...