![]() |
This is Unofficial EPICS BASE Doxygen Site
|
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include "epicsMath.h"
#include "yajl_gen.h"
#include "yajl_buf.h"
#include "yajl_encode.h"
Go to the source code of this file.
Classes | |
struct | yajl_gen_t |
Macros | |
#define | INSERT_SEP |
#define | INSERT_WHITESPACE |
#define | ENSURE_NOT_KEY |
#define | ENSURE_VALID_STATE |
#define | INCREMENT_DEPTH if (++(g->depth) >= YAJL_MAX_DEPTH) return yajl_max_depth_exceeded; |
#define | DECREMENT_DEPTH if (--(g->depth) >= YAJL_MAX_DEPTH) return yajl_max_depth_exceeded; |
#define | APPENDED_ATOM |
#define | FINAL_NEWLINE |
Enumerations | |
enum | yajl_gen_state { yajl_gen_start, yajl_gen_map_start, yajl_gen_map_key, yajl_gen_map_val, yajl_gen_array_start, yajl_gen_in_array, yajl_gen_complete, yajl_gen_error } |
Functions | |
int | yajl_gen_config (yajl_gen g, yajl_gen_option opt,...) |
yajl_gen | yajl_gen_alloc (const yajl_alloc_funcs *afs) |
void | yajl_gen_free (yajl_gen g) |
yajl_gen_status | yajl_gen_integer (yajl_gen g, long long int number) |
yajl_gen_status | yajl_gen_double (yajl_gen g, double number) |
yajl_gen_status | yajl_gen_number (yajl_gen g, const char *s, size_t l) |
yajl_gen_status | yajl_gen_string (yajl_gen g, const unsigned char *str, size_t len) |
yajl_gen_status | yajl_gen_null (yajl_gen g) |
yajl_gen_status | yajl_gen_bool (yajl_gen g, int boolean) |
yajl_gen_status | yajl_gen_map_open (yajl_gen g) |
yajl_gen_status | yajl_gen_map_close (yajl_gen g) |
yajl_gen_status | yajl_gen_array_open (yajl_gen g) |
yajl_gen_status | yajl_gen_array_close (yajl_gen g) |
yajl_gen_status | yajl_gen_get_buf (yajl_gen g, const unsigned char **buf, size_t *len) |
void | yajl_gen_clear (yajl_gen g) |
#define APPENDED_ATOM |
Definition at line 176 of file yajl_gen.c.
#define DECREMENT_DEPTH if (--(g->depth) >= YAJL_MAX_DEPTH) return yajl_max_depth_exceeded; |
Definition at line 173 of file yajl_gen.c.
#define ENSURE_NOT_KEY |
Definition at line 155 of file yajl_gen.c.
#define ENSURE_VALID_STATE |
Definition at line 163 of file yajl_gen.c.
#define FINAL_NEWLINE |
Definition at line 195 of file yajl_gen.c.
#define INCREMENT_DEPTH if (++(g->depth) >= YAJL_MAX_DEPTH) return yajl_max_depth_exceeded; |
Definition at line 170 of file yajl_gen.c.
#define INSERT_SEP |
Definition at line 134 of file yajl_gen.c.
#define INSERT_WHITESPACE |
Definition at line 144 of file yajl_gen.c.
enum yajl_gen_state |
Enumerator | |
---|---|
yajl_gen_start | |
yajl_gen_map_start | |
yajl_gen_map_key | |
yajl_gen_map_val | |
yajl_gen_array_start | |
yajl_gen_in_array | |
yajl_gen_complete | |
yajl_gen_error |
Definition at line 27 of file yajl_gen.c.
yajl_gen yajl_gen_alloc | ( | const yajl_alloc_funcs * | allocFuncs | ) |
Allocate a generator handle
allocFuncs | An optional pointer to a structure which allows the client to overide the memory allocation used by yajl. May be NULL, in which case malloc(), free() and realloc() will be used. |
Definition at line 97 of file yajl_gen.c.
yajl_gen_status yajl_gen_array_close | ( | yajl_gen | hand | ) |
Finish generating a JSON array.
Definition at line 318 of file yajl_gen.c.
yajl_gen_status yajl_gen_array_open | ( | yajl_gen | hand | ) |
Start generating a JSON array.
Definition at line 306 of file yajl_gen.c.
yajl_gen_status yajl_gen_bool | ( | yajl_gen | hand, |
int | boolean | ||
) |
Generate a true
or false
value from boolean
.
Definition at line 267 of file yajl_gen.c.
void yajl_gen_clear | ( | yajl_gen | hand | ) |
Clear yajl's output buffer, but maintain all internal generation state. This function will not "reset" the generator state, and is intended to enable incremental JSON outputing.
Definition at line 341 of file yajl_gen.c.
int yajl_gen_config | ( | yajl_gen | g, |
yajl_gen_option | opt, | ||
... | |||
) |
Allow the modification of generator options subsequent to handle allocation (via yajl_alloc())
Definition at line 51 of file yajl_gen.c.
yajl_gen_status yajl_gen_double | ( | yajl_gen | hand, |
double | number | ||
) |
Generate a floating point number. number
may not be infinity or NaN, as these have no representation in JSON. In these cases the generator will return yajl_gen_invalid_number
Definition at line 212 of file yajl_gen.c.
void yajl_gen_free | ( | yajl_gen | handle | ) |
Free a generator handle
Definition at line 128 of file yajl_gen.c.
yajl_gen_status yajl_gen_get_buf | ( | yajl_gen | hand, |
const unsigned char ** | buf, | ||
size_t * | len | ||
) |
Access the null terminated generator buffer. If incrementally outputing JSON, one should call yajl_gen_clear() to clear the buffer. This allows stream generation.
Definition at line 331 of file yajl_gen.c.
yajl_gen_status yajl_gen_integer | ( | yajl_gen | hand, |
long long int | number | ||
) |
yajl_gen_status yajl_gen_map_close | ( | yajl_gen | hand | ) |
Finish generating a JSON map.
Definition at line 292 of file yajl_gen.c.
yajl_gen_status yajl_gen_map_open | ( | yajl_gen | hand | ) |
Start generating a JSON map. This should be followed by calls to yajl_gen_string() to provide a key and another yajl_gen routine to provide the value associated with that key.
Definition at line 279 of file yajl_gen.c.
yajl_gen_status yajl_gen_null | ( | yajl_gen | hand | ) |
yajl_gen_status yajl_gen_number | ( | yajl_gen | hand, |
const char * | num, | ||
size_t | len | ||
) |
Generate a number from the string given in num
.
Definition at line 226 of file yajl_gen.c.
yajl_gen_status yajl_gen_string | ( | yajl_gen | hand, |
const unsigned char * | str, | ||
size_t | len | ||
) |
Generate a string value or map key from str
.
Definition at line 236 of file yajl_gen.c.