|
libdballe
7.7
|
JSON serializer. More...
#include <json.h>
Public Member Functions | |
| JSONWriter (std::ostream &out) | |
| void | reset () |
| Reset the serializer state, to cancel the current output and prepare for a new one. | |
| void | start_list () |
| void | end_list () |
| void | start_mapping () |
| void | end_mapping () |
| void | add_null () |
| void | add_bool (bool val) |
| void | add_int (int val) |
| void | add_double (double val) |
| void | add_cstring (const char *val) |
| void | add_string (const std::string &val) |
| void | add_number (const std::string &val) |
| void | add_level (const Level &val) |
| void | add_trange (const Trange &val) |
| void | add_datetime (const Datetime &val) |
| void | add_coords (const Coords &val) |
| void | add_var (const wreport::Var &val) |
| void | add_break () |
| void | add (const std::string &val) |
| void | add (const char *val) |
| void | add (double val) |
| void | add (int val) |
| void | add (bool val) |
| void | add (wreport::Varcode val) |
| void | add (const Level &val) |
| void | add (const Trange &val) |
| void | add (const Datetime &val) |
| void | add (const Coords &val) |
| void | add (const wreport::Var &val) |
| template<typename T > | |
| void | add (const char *a, T b) |
| template<typename T > | |
| void | add_list (const T &val) |
Protected Types | |
| enum | State { LIST_FIRST, LIST, MAPPING_KEY_FIRST, MAPPING_KEY, MAPPING_VAL } |
Protected Member Functions | |
| void | val_head () |
| Append whatever separator is needed (if any) before a new value. | |
| void | jputc (char c) |
| void | jputs (const char *s) |
Protected Attributes | |
| std::ostream & | out |
| std::vector< State > | stack |
JSON serializer.
It is called with a sequence of sax-like events, and appends the resulting JSON to a string.
The JSON output is all in one line, so that end of line can be used as separator between distinct JSON records.
1.8.9.1