31#ifndef aida_pva_json_h
32#define aida_pva_json_h
43#define json_int_t long
45#define json_int_t __int64
62 unsigned long max_memory;
68 void* (* mem_alloc)(size_t,
int zero,
void* user_data);
69 void (* mem_free)(
void*,
void* user_data);
77#define json_enable_comments 0x01
92extern const struct _json_value json_value_none;
94typedef struct _json_object_entry
97 unsigned int name_length;
99 struct _json_value* value;
103typedef struct _json_value
105 struct _json_value* parent;
126 json_object_entry* values;
128#if defined(__cplusplus)
129 json_object_entry * begin ()
const
132 json_object_entry * end ()
const
133 {
return values + length;
142 struct _json_value** values;
144#if defined(__cplusplus)
145 _json_value ** begin ()
const
148 _json_value ** end ()
const
149 {
return values + length;
159 struct _json_value* next_alloc;
164#ifdef JSON_TRACK_SOURCE
168 unsigned int line, col;
179 inline _json_value ()
180 { memset (
this, 0,
sizeof (_json_value));
183 inline const struct _json_value &operator [] (
int index)
const
185 if (type != json_array || index < 0
186 || ((
unsigned int) index) >= u.array.length)
188 return json_value_none;
191 return *u.array.values [index];
194 inline const struct _json_value &operator [] (
const char * index)
const
196 if (type != json_object)
197 return json_value_none;
199 for (
unsigned int i = 0; i < u.object.length; ++ i)
200 if (!strcmp (u.object.values [i].name, index))
201 return *u.object.values [i].value;
203 return json_value_none;
206 inline operator const char * ()
const
218 inline operator json_int_t ()
const
226 return (json_int_t) u.dbl;
233 inline operator bool ()
const
235 if (type != json_boolean)
238 return u.boolean != 0;
241 inline operator double ()
const
246 return (
double) u.integer;
260json_value* json_parse(
const json_char* json,
263#define json_error_max 128
264json_value* json_parse_ex(json_settings* settings,
265 const json_char* json,
269void json_value_free(json_value*);
274void json_value_free_ex(json_settings* settings,
277unsigned int totalStingLengthOf(json_value *jsonArray);