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
00061 } yajl_gen_status;
00062
00064 typedef struct yajl_gen_t * yajl_gen;
00065
00067 typedef struct {
00069 unsigned int beautify;
00073 const char * indentString;
00074 } yajl_gen_config;
00075
00086 yajl_gen YAJL_API yajl_gen_alloc(const yajl_gen_config * config,
00087 const yajl_alloc_funcs * allocFuncs);
00088
00090 void YAJL_API yajl_gen_free(yajl_gen handle);
00091
00092 yajl_gen_status YAJL_API yajl_gen_integer(yajl_gen hand, long int number);
00093 yajl_gen_status YAJL_API yajl_gen_double(yajl_gen hand, double number);
00094 yajl_gen_status YAJL_API yajl_gen_number(yajl_gen hand,
00095 const char * num,
00096 unsigned int len);
00097 yajl_gen_status YAJL_API yajl_gen_string(yajl_gen hand,
00098 const unsigned char * str,
00099 unsigned int len);
00100 yajl_gen_status YAJL_API yajl_gen_null(yajl_gen hand);
00101 yajl_gen_status YAJL_API yajl_gen_bool(yajl_gen hand, int boolean);
00102 yajl_gen_status YAJL_API yajl_gen_map_open(yajl_gen hand);
00103 yajl_gen_status YAJL_API yajl_gen_map_close(yajl_gen hand);
00104 yajl_gen_status YAJL_API yajl_gen_array_open(yajl_gen hand);
00105 yajl_gen_status YAJL_API yajl_gen_array_close(yajl_gen hand);
00106
00110 yajl_gen_status YAJL_API yajl_gen_get_buf(yajl_gen hand,
00111 const unsigned char ** buf,
00112 unsigned int * len);
00113
00117 void YAJL_API yajl_gen_clear(yajl_gen hand);
00118
00119 #ifdef __cplusplus
00120 };
00121 #endif
00122
00123 #endif