|
Barracuda Application Server C/C++ Reference
NO
|
The JEncoder can serialize a JSON JVAL syntax tree to the JSON text format.
The JEncoder can also be used for assembling JSON text from calling the primitive methods in this class.
Example:
#include <JEncoder.h>
Public Member Functions | |
| JEncoder (JErr *err, BufPrint *out) | |
| Create an instance of the JEncoder class. | |
| int | setInt (S32 val) |
| Format an integer value. | |
| int | setLong (S64 val) |
| Format a long integer value. | |
| int | setDouble (double val) |
| Format a double value. | |
| int | setString (const char *val) |
| Format a string value. More... | |
| int | b64enc (const void *source, S32 slen) |
| Encode and emit (binary) data using B64 encoding. | |
| int | fmtString (const char *fmt,...) |
| Converts (according to format 'fmt') and writes to stream. More... | |
| int | vFmtString (const char *fmt, va_list argList) |
| Equivalent to fmtString with variable argument list replaced by argList. | |
| int | setBoolean (bool val) |
| Format a boolean value. | |
| int | setNull () |
| Set a JSON null value. | |
| int | setJV (struct JVal *val, bool iterateNext=false) |
| Format a node or a tree of JVal nodes. | |
| int | set (const char *fmt,...) |
| Encode/serialize C structs/data to JSON using formatted output. More... | |
| int | setName (const char *name) |
| Set the member name before calling any of the set<value> members if formatting an object. More... | |
| int | beginObject () |
| Begin object formatting. More... | |
| int | endObject () |
| End object formatting. | |
| int | beginArray () |
| Begin array formatting. | |
| int | endArray () |
| End array formatting. | |
| JErr * | getErr () |
| Returns the JErr object. | |
| int | flush () |
| Flush JEncoder data to the output stream. | |
| int | commit () |
| Calls flush and enables the construction of a new object. | |
| BufPrint * | getBufPrint () |
| Fetch the internal BufPrint object. | |