164 CxJsonValue* vbuf_internal[8]; |
163 CxJsonValue* vbuf_internal[8]; |
165 |
164 |
166 int error; // TODO: currently unused |
165 int error; // TODO: currently unused |
167 bool tokenizer_escape; // TODO: check if it can be replaced with look-behind |
166 bool tokenizer_escape; // TODO: check if it can be replaced with look-behind |
168 }; |
167 }; |
|
168 |
|
169 /** |
|
170 * Status codes for the json interface. |
|
171 */ |
|
172 enum cx_json_status { |
|
173 /** |
|
174 * Everything is fine. |
|
175 */ |
|
176 CX_JSON_NO_ERROR, |
|
177 /** |
|
178 * The input buffer does not contain more data. |
|
179 */ |
|
180 CX_JSON_NO_DATA, |
|
181 /** |
|
182 * The input ends unexpectedly. |
|
183 * |
|
184 * Refill the buffer with cxJsonFill() to complete the json data. |
|
185 */ |
|
186 CX_JSON_INCOMPLETE_DATA, |
|
187 /** |
|
188 * Not used as a status and never returned by any function. |
|
189 * |
|
190 * You can use this enumerator to check for all "good" status results |
|
191 * by checking if the status is less than \c CX_JSON_OK. |
|
192 * |
|
193 * A "good" status means, that you can refill data and continue parsing. |
|
194 */ |
|
195 CX_JSON_OK, |
|
196 /** |
|
197 * Input buffer is \c NULL. |
|
198 */ |
|
199 CX_JSON_NULL_INPUT, |
|
200 /** |
|
201 * Allocating memory for the internal buffer failed. |
|
202 */ |
|
203 CX_JSON_BUFFER_ALLOC_FAILED, |
|
204 /** |
|
205 * Allocating memory for a json value failed. |
|
206 */ |
|
207 CX_JSON_VALUE_ALLOC_FAILED, |
|
208 /** |
|
209 * A number value is incorrectly formatted. |
|
210 */ |
|
211 CX_JSON_FORMAT_ERROR_NUMBER, |
|
212 /** |
|
213 * The tokenizer found something unexpected. |
|
214 */ |
|
215 CX_JSON_FORMAT_ERROR_UNEXPECTED_TOKEN |
|
216 }; |
|
217 |
|
218 /** |
|
219 * Typedef for the json status enum. |
|
220 */ |
|
221 typedef enum cx_json_status CxJsonStatus; |
169 |
222 |
170 cx_attr_nonnull_arg(1) |
223 cx_attr_nonnull_arg(1) |
171 void cxJsonInit(CxJson *json, const CxAllocator *allocator); |
224 void cxJsonInit(CxJson *json, const CxAllocator *allocator); |
172 |
225 |
173 cx_attr_nonnull |
226 cx_attr_nonnull |