This is Unofficial EPICS BASE Doxygen Site
yajl_parse.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007-2011, Lloyd Hilaiel <lloyd@hilaiel.com>
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 
23 #ifndef __YAJL_PARSE_H__
24 #define __YAJL_PARSE_H__
25 
26 #include "yajl_common.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32  typedef enum {
40  } yajl_status;
41 
43  YAJL_API const char * yajl_status_to_string(yajl_status code);
44 
46  typedef struct yajl_handle_t * yajl_handle;
47 
71  typedef struct {
72  int (* yajl_null)(void * ctx);
73  int (* yajl_boolean)(void * ctx, int boolVal);
74  int (* yajl_integer)(void * ctx, long long integerVal);
75  int (* yajl_double)(void * ctx, double doubleVal);
78  int (* yajl_number)(void * ctx, const char * numberVal,
79  size_t numberLen);
80 
83  int (* yajl_string)(void * ctx, const unsigned char * stringVal,
84  size_t stringLen);
85 
86  int (* yajl_start_map)(void * ctx);
87  int (* yajl_map_key)(void * ctx, const unsigned char * key,
88  size_t stringLen);
89  int (* yajl_end_map)(void * ctx);
90 
91  int (* yajl_start_array)(void * ctx);
92  int (* yajl_end_array)(void * ctx);
94 
104  YAJL_API yajl_handle yajl_alloc(const yajl_callbacks * callbacks,
105  yajl_alloc_funcs * afs,
106  void * ctx);
107 
108 
112  typedef enum {
159  } yajl_option;
160 
165  YAJL_API int yajl_config(yajl_handle h, yajl_option opt, ...);
166 
168  YAJL_API void yajl_free(yajl_handle handle);
169 
175  YAJL_API yajl_status yajl_parse(yajl_handle hand,
176  const unsigned char * jsonText,
177  size_t jsonTextLength);
178 
188  YAJL_API yajl_status yajl_complete_parse(yajl_handle hand);
189 
200  YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose,
201  const unsigned char * jsonText,
202  size_t jsonTextLength);
203 
216  YAJL_API size_t yajl_get_bytes_consumed(yajl_handle hand);
217 
219  YAJL_API void yajl_free_error(yajl_handle hand, unsigned char * str);
220 
221 #ifdef __cplusplus
222 }
223 #endif
224 
225 #endif
YAJL_API int yajl_config(yajl_handle h, yajl_option opt,...)
Definition: yajl.c:85
#define str(v)
#define YAJL_API
Definition: yajl_common.h:52
YAJL_API yajl_status yajl_complete_parse(yajl_handle hand)
Definition: yajl.c:142
Common routines and macros used by other YAJL APIs.
YAJL_API void yajl_free_error(yajl_handle hand, unsigned char *str)
Definition: yajl.c:175
YAJL_API void yajl_free(yajl_handle handle)
Definition: yajl.c:109
YAJL_API yajl_handle yajl_alloc(const yajl_callbacks *callbacks, yajl_alloc_funcs *afs, void *ctx)
Definition: yajl.c:46
YAJL_API unsigned char * yajl_get_error(yajl_handle hand, int verbose, const unsigned char *jsonText, size_t jsonTextLength)
Definition: yajl.c:160
yajl_status
Definition: yajl_parse.h:32
void verbose(void)
Definition: verbose.c:27
struct yajl_handle_t * yajl_handle
Definition: yajl_parse.h:46
YAJL_API size_t yajl_get_bytes_consumed(yajl_handle hand)
Definition: yajl.c:167
YAJL_API yajl_status yajl_parse(yajl_handle hand, const unsigned char *jsonText, size_t jsonTextLength)
Definition: yajl.c:121
const yajl_callbacks * callbacks
Definition: yajl_parser.h:43
yajl_option
Definition: yajl_parse.h:112
YAJL_API const char * yajl_status_to_string(yajl_status code)
Definition: yajl.c:28