00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00038 #include <yajl/yajl_common.h>
00039
00040 #ifndef __YAJL_GEN_H__
00041 #define __YAJL_GEN_H__
00042
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046
00047 typedef enum {
00049 yajl_gen_status_ok = 0,
00052 yajl_gen_keys_must_be_strings,
00055 yajl_max_depth_exceeded,
00058 yajl_gen_in_error_state,
00060 yajl_gen_generation_complete,
00063 yajl_gen_invalid_number,
00066 yajl_gen_no_buf
00067 } yajl_gen_status;
00068
00070 typedef struct yajl_gen_t * yajl_gen;
00071
00073 typedef void (*yajl_print_t)(void * ctx,
00074 const char * str,
00075 unsigned int len);
00076
00078 typedef struct {
00080 unsigned int beautify;
00084 const char * indentString;
00085 } yajl_gen_config;
00086
00097 yajl_gen YAJL_API yajl_gen_alloc(const yajl_gen_config * config,
00098 const yajl_alloc_funcs * allocFuncs);
00099
00117 yajl_gen YAJL_API yajl_gen_alloc2(yajl_print_t callback,
00118 const yajl_gen_config * config,
00119 const yajl_alloc_funcs * allocFuncs,
00120 void * ctx);
00121
00123 void YAJL_API yajl_gen_free(yajl_gen handle);
00124
00125 yajl_gen_status YAJL_API yajl_gen_integer(yajl_gen hand, long int number);
00129 yajl_gen_status YAJL_API yajl_gen_double(yajl_gen hand, double number);
00130 yajl_gen_status YAJL_API yajl_gen_number(yajl_gen hand,
00131 const char * num,
00132 unsigned int len);
00133 yajl_gen_status YAJL_API yajl_gen_string(yajl_gen hand,
00134 const unsigned char * str,
00135 unsigned int len);
00136 yajl_gen_status YAJL_API yajl_gen_null(yajl_gen hand);
00137 yajl_gen_status YAJL_API yajl_gen_bool(yajl_gen hand, int boolean);
00138 yajl_gen_status YAJL_API yajl_gen_map_open(yajl_gen hand);
00139 yajl_gen_status YAJL_API yajl_gen_map_close(yajl_gen hand);
00140 yajl_gen_status YAJL_API yajl_gen_array_open(yajl_gen hand);
00141 yajl_gen_status YAJL_API yajl_gen_array_close(yajl_gen hand);
00142
00146 yajl_gen_status YAJL_API yajl_gen_get_buf(yajl_gen hand,
00147 const unsigned char ** buf,
00148 unsigned int * len);
00149
00153 void YAJL_API yajl_gen_clear(yajl_gen hand);
00154
00155 #ifdef __cplusplus
00156 }
00157 #endif
00158
00159 #endif