src/cx/json.h

changeset 967
a58f602ed2fe
parent 966
1aa7ec3e46e7
equal deleted inserted replaced
966:1aa7ec3e46e7 967:a58f602ed2fe
36 #ifndef UCX_JSON_H 36 #ifndef UCX_JSON_H
37 #define UCX_JSON_H 37 #define UCX_JSON_H
38 38
39 #include "common.h" 39 #include "common.h"
40 #include "string.h" 40 #include "string.h"
41 #include "array_list.h"
41 42
42 #ifdef __cplusplus 43 #ifdef __cplusplus
43 extern "C" { 44 extern "C" {
44 #endif 45 #endif
45 46
144 145
145 int error; 146 int error;
146 }; 147 };
147 148
148 struct cx_json_array_s { 149 struct cx_json_array_s {
149 CxJsonValue **array; 150 CX_ARRAY_DECLARE(CxJsonValue*, array);
150 size_t alloc;
151 size_t size;
152 }; 151 };
153 152
154 struct cx_json_object_s { 153 struct cx_json_object_s {
155 CxJsonObjValue *values; 154 CX_ARRAY_DECLARE(CxJsonObjValue, values);
156 size_t alloc;
157 size_t size;
158 }; 155 };
159 156
160 struct cx_json_obj_value_s { 157 struct cx_json_obj_value_s {
161 char *name; 158 char *name;
162 CxJsonValue *value; 159 CxJsonValue *value;
278 return value->value.literal == CX_JSON_TRUE; 275 return value->value.literal == CX_JSON_TRUE;
279 } 276 }
280 277
281 __attribute__((__nonnull__)) 278 __attribute__((__nonnull__))
282 static inline size_t cxJsonArrSize(CxJsonValue *value) { 279 static inline size_t cxJsonArrSize(CxJsonValue *value) {
283 return value->value.array.size; 280 return value->value.array.array_size;
284 } 281 }
285 282
286 __attribute__((__nonnull__, __returns_nonnull__)) 283 __attribute__((__nonnull__, __returns_nonnull__))
287 CxJsonValue *cxJsonArrGet(CxJsonValue *value, size_t index); 284 CxJsonValue *cxJsonArrGet(CxJsonValue *value, size_t index);
288 285

mercurial