YAJL 2.1.0
yajl_parse.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_PARSE_H__
25#define __YAJL_PARSE_H__
26
27#include <stddef.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
33 typedef enum {
42
45
47 typedef struct yajl_handle_t * yajl_handle;
48
74 typedef struct {
75 int (* yajl_null)(void * ctx);
76 int (* yajl_boolean)(void * ctx, int boolVal);
77 int (* yajl_integer)(void * ctx, long long integerVal);
78 int (* yajl_double)(void * ctx, double doubleVal);
81 int (* yajl_number)(void * ctx, const char * numberVal,
82 size_t numberLen);
83
86 int (* yajl_string)(void * ctx, const unsigned char * stringVal,
87 size_t stringLen);
88
89 int (* yajl_start_map)(void * ctx);
90 int (* yajl_map_key)(void * ctx, const unsigned char * key,
91 size_t stringLen);
92 int (* yajl_end_map)(void * ctx);
93
94 int (* yajl_start_array)(void * ctx);
95 int (* yajl_end_array)(void * ctx);
97
108 yajl_alloc_funcs * afs,
109 void * ctx);
110
111
115 typedef enum {
161
167
170
177 const unsigned char * jsonText,
178 size_t jsonTextLength);
179
190
201 YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose,
202 const unsigned char * jsonText,
203 size_t jsonTextLength);
204
218
220 YAJL_API void yajl_free_error(yajl_handle hand, unsigned char * str);
221
222#ifdef __cplusplus
223}
224#endif
225
226#endif
Definition: yajl_common.h:59
Definition: yajl_parse.h:74
#define YAJL_API
Definition: yajl_common.h:41
YAJL_API void yajl_free_error(yajl_handle hand, unsigned char *str)
yajl_status
Definition: yajl_parse.h:33
@ yajl_status_client_canceled
Definition: yajl_parse.h:37
@ yajl_status_ok
Definition: yajl_parse.h:35
@ yajl_status_error
Definition: yajl_parse.h:40
YAJL_API const char * yajl_status_to_string(yajl_status code)
yajl_option
Definition: yajl_parse.h:115
@ yajl_dont_validate_strings
Definition: yajl_parse.h:133
@ yajl_allow_multiple_values
Definition: yajl_parse.h:151
@ yajl_allow_trailing_garbage
Definition: yajl_parse.h:141
@ yajl_allow_comments
Definition: yajl_parse.h:123
@ yajl_allow_partial_values
Definition: yajl_parse.h:159
YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose, const unsigned char *jsonText, size_t jsonTextLength)
YAJL_API yajl_status yajl_parse(yajl_handle hand, const unsigned char *jsonText, size_t jsonTextLength)
YAJL_API size_t yajl_get_bytes_consumed(yajl_handle hand)
YAJL_API void yajl_free(yajl_handle handle)
struct yajl_handle_t * yajl_handle
Definition: yajl_parse.h:47
YAJL_API yajl_handle yajl_alloc(const yajl_callbacks *callbacks, yajl_alloc_funcs *afs, void *ctx)
YAJL_API yajl_status yajl_complete_parse(yajl_handle hand)
YAJL_API int yajl_config(yajl_handle h, yajl_option opt,...)