9 #ifndef HAT_JSON_MAX_DEPTH
10 #define HAT_JSON_MAX_DEPTH 1024
13 #define HAT_JSON_SUCCESS 0
14 #define HAT_JSON_ERROR (-1)
16 #define HAT_JSON_TOKEN_NULL 0
17 #define HAT_JSON_TOKEN_BOOL 1
18 #define HAT_JSON_TOKEN_INT 2
19 #define HAT_JSON_TOKEN_REAL 3
20 #define HAT_JSON_TOKEN_STR 4
21 #define HAT_JSON_TOKEN_ARR 5
22 #define HAT_JSON_TOKEN_ARR_END 6
23 #define HAT_JSON_TOKEN_OBJ 7
24 #define HAT_JSON_TOKEN_OBJ_KEY 8
25 #define HAT_JSON_TOKEN_OBJ_END 9
void hat_json_writer_write_end(hat_json_writer_t *w)
void hat_json_writer_write_str(hat_json_writer_t *w, char *value, size_t len)
hat_json_parser_t * hat_json_parser_create(hat_allocator_t *a, hat_json_parser_cb_t cb, void *ctx)
void *(* hat_json_parser_cb_t)(hat_json_token_t *token, hat_json_value_t *value, void *ctx)
Definition: json.h:47
void hat_json_parser_destroy(hat_json_parser_t *p)
int hat_json_error_t
Definition: json.h:31
void hat_json_writer_destroy(hat_json_writer_t *w)
void hat_json_writer_write_arr(hat_json_writer_t *w)
void hat_json_writer_write_real(hat_json_writer_t *w, double value)
void hat_json_writer_write_int(hat_json_writer_t *w, int64_t value)
struct hat_json_parser_t hat_json_parser_t
Definition: json.h:53
hat_json_error_t hat_json_parser_parse(hat_json_parser_t *p, hat_buff_t *buff)
void hat_json_writer_write_bool(hat_json_writer_t *w, bool value)
void hat_json_writer_write_obj(hat_json_writer_t *w)
hat_json_writer_t * hat_json_writer_create(hat_allocator_t *a, hat_json_writer_cb_t cb, void *ctx)
int hat_json_token_t
Definition: json.h:33
bool hat_json_parser_empty(hat_json_parser_t *p)
void hat_json_writer_write_null(hat_json_writer_t *w)
hat_json_error_t(* hat_json_writer_cb_t)(char *data, size_t len, void *ctx)
Definition: json.h:50
struct hat_json_writer_t hat_json_writer_t
Definition: json.h:55
Allocator base struct.
Definition: allocator.h:36
Data buffer.
Definition: buff.h:28
double real_value
Definition: json.h:38
char * data
Definition: json.h:40
size_t len
Definition: json.h:41
bool bool_value
Definition: json.h:36
int64_t int_value
Definition: json.h:37