YAJL  2.1.0
yajl_gen.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2014, Lloyd Hilaiel <me@lloyd.io>
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
22 #include <yajl/yajl_common.h>
23 
24 #ifndef __YAJL_GEN_H__
25 #define __YAJL_GEN_H__
26 
27 #include <stddef.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33  typedef enum {
58 
60  typedef struct yajl_gen_t * yajl_gen;
61 
63  typedef void (*yajl_print_t)(void * ctx,
64  const char * str,
65  size_t len);
66 
70  typedef enum {
102  } yajl_gen_option;
103 
108  YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...);
109 
118  YAJL_API yajl_gen yajl_gen_alloc(const yajl_alloc_funcs * allocFuncs);
119 
121  YAJL_API void yajl_gen_free(yajl_gen handle);
122 
123  YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long long int number);
127  YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number);
129  const char * num,
130  size_t len);
132  const unsigned char * str,
133  size_t len);
134  YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand);
135  YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean);
140 
145  const unsigned char ** buf,
146  size_t * len);
147 
151  YAJL_API void yajl_gen_clear(yajl_gen hand);
152 
159  YAJL_API void yajl_gen_reset(yajl_gen hand, const char * sep);
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif
struct yajl_gen_t * yajl_gen
Definition: yajl_gen.h:60
Definition: yajl_gen.h:72
Definition: yajl_gen.h:35
YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand)
YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number)
YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand)
YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand, const char *num, size_t len)
Definition: yajl_gen.h:88
#define YAJL_API
Definition: yajl_common.h:41
YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt,...)
Definition: yajl_gen.h:41
YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand)
YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand)
YAJL_API void yajl_gen_clear(yajl_gen hand)
Definition: yajl_gen.h:46
YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand)
YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean)
Definition: yajl_gen.h:94
Definition: yajl_gen.h:44
Definition: yajl_gen.h:101
YAJL_API void yajl_gen_free(yajl_gen handle)
void(* yajl_print_t)(void *ctx, const char *str, size_t len)
Definition: yajl_gen.h:63
YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand, const unsigned char *str, size_t len)
YAJL_API void yajl_gen_reset(yajl_gen hand, const char *sep)
Definition: yajl_gen.h:78
Definition: yajl_gen.h:38
yajl_gen_option
Definition: yajl_gen.h:70
YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand, const unsigned char **buf, size_t *len)
Definition: yajl_gen.h:52
YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long long int number)
YAJL_API yajl_gen yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
Definition: yajl_common.h:58
Definition: yajl_gen.h:56
Definition: yajl_gen.h:49
yajl_gen_status
Definition: yajl_gen.h:33