yajl_gen.h
Go to the documentation of this file.
/*
* Copyright (c) 2007-2014, Lloyd Hilaiel <me@lloyd.io>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <yajl/yajl_common.h>
#ifndef __YAJL_GEN_H__
#define __YAJL_GEN_H__
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
yajl_gen_status_ok = 0,
yajl_gen_keys_must_be_strings,
yajl_max_depth_exceeded,
yajl_gen_in_error_state,
yajl_gen_generation_complete,
yajl_gen_invalid_number,
yajl_gen_no_buf,
yajl_gen_invalid_string
} yajl_gen_status;
typedef struct yajl_gen_t * yajl_gen;
typedef void (*yajl_print_t)(void * ctx,
const char * str,
size_t len);
typedef enum {
yajl_gen_beautify = 0x01,
yajl_gen_indent_string = 0x02,
yajl_gen_print_callback = 0x04,
yajl_gen_validate_utf8 = 0x08,
yajl_gen_escape_solidus = 0x10
} yajl_gen_option;
YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt, ...);
YAJL_API yajl_gen yajl_gen_alloc(const yajl_alloc_funcs * allocFuncs);
YAJL_API void yajl_gen_free(yajl_gen handle);
YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long long int number);
YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number);
YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand,
const char * num,
size_t len);
YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand,
const unsigned char * str,
size_t len);
YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand);
YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean);
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 yajl_gen_status yajl_gen_array_open(yajl_gen hand);
YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand);
YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand,
const unsigned char ** buf,
size_t * len);
YAJL_API void yajl_gen_clear(yajl_gen hand);
YAJL_API void yajl_gen_reset(yajl_gen hand, const char * sep);
#ifdef __cplusplus
}
#endif
#endif
yajl_alloc_funcs
Definition yajl_common.h:59
YAJL_API
#define YAJL_API
Definition yajl_common.h:41
yajl_gen_config
YAJL_API int yajl_gen_config(yajl_gen g, yajl_gen_option opt,...)
yajl_gen_number
YAJL_API yajl_gen_status yajl_gen_number(yajl_gen hand, const char *num, size_t len)
yajl_gen_null
YAJL_API yajl_gen_status yajl_gen_null(yajl_gen hand)
yajl_gen_alloc
YAJL_API yajl_gen yajl_gen_alloc(const yajl_alloc_funcs *allocFuncs)
yajl_gen_integer
YAJL_API yajl_gen_status yajl_gen_integer(yajl_gen hand, long long int number)
yajl_gen
struct yajl_gen_t * yajl_gen
Definition yajl_gen.h:60
yajl_gen_clear
YAJL_API void yajl_gen_clear(yajl_gen hand)
yajl_gen_option
yajl_gen_option
Definition yajl_gen.h:70
yajl_gen_indent_string
@ yajl_gen_indent_string
Definition yajl_gen.h:78
yajl_gen_escape_solidus
@ yajl_gen_escape_solidus
Definition yajl_gen.h:101
yajl_gen_beautify
@ yajl_gen_beautify
Definition yajl_gen.h:72
yajl_gen_print_callback
@ yajl_gen_print_callback
Definition yajl_gen.h:88
yajl_gen_validate_utf8
@ yajl_gen_validate_utf8
Definition yajl_gen.h:94
yajl_gen_get_buf
YAJL_API yajl_gen_status yajl_gen_get_buf(yajl_gen hand, const unsigned char **buf, size_t *len)
yajl_gen_array_open
YAJL_API yajl_gen_status yajl_gen_array_open(yajl_gen hand)
yajl_gen_reset
YAJL_API void yajl_gen_reset(yajl_gen hand, const char *sep)
yajl_gen_free
YAJL_API void yajl_gen_free(yajl_gen handle)
yajl_gen_bool
YAJL_API yajl_gen_status yajl_gen_bool(yajl_gen hand, int boolean)
yajl_gen_string
YAJL_API yajl_gen_status yajl_gen_string(yajl_gen hand, const unsigned char *str, size_t len)
yajl_gen_map_open
YAJL_API yajl_gen_status yajl_gen_map_open(yajl_gen hand)
yajl_gen_double
YAJL_API yajl_gen_status yajl_gen_double(yajl_gen hand, double number)
yajl_print_t
void(* yajl_print_t)(void *ctx, const char *str, size_t len)
Definition yajl_gen.h:63
yajl_gen_array_close
YAJL_API yajl_gen_status yajl_gen_array_close(yajl_gen hand)
yajl_gen_map_close
YAJL_API yajl_gen_status yajl_gen_map_close(yajl_gen hand)
yajl_gen_status
yajl_gen_status
Definition yajl_gen.h:33
yajl_max_depth_exceeded
@ yajl_max_depth_exceeded
Definition yajl_gen.h:41
yajl_gen_status_ok
@ yajl_gen_status_ok
Definition yajl_gen.h:35
yajl_gen_generation_complete
@ yajl_gen_generation_complete
Definition yajl_gen.h:46
yajl_gen_invalid_number
@ yajl_gen_invalid_number
Definition yajl_gen.h:49
yajl_gen_invalid_string
@ yajl_gen_invalid_string
Definition yajl_gen.h:56
yajl_gen_in_error_state
@ yajl_gen_in_error_state
Definition yajl_gen.h:44
yajl_gen_keys_must_be_strings
@ yajl_gen_keys_must_be_strings
Definition yajl_gen.h:38
yajl_gen_no_buf
@ yajl_gen_no_buf
Definition yajl_gen.h:52