52 lines
753 B
C
52 lines
753 B
C
#ifndef JSON_TEST_H
|
|
#define JSON_TEST_H
|
|
|
|
#include "aliases.h"
|
|
#include <stdbool.h>
|
|
|
|
typedef struct json_obj_pair jobj_pair_t;
|
|
typedef struct json_coll jcoll_t;
|
|
typedef struct json_val jval_t;
|
|
|
|
typedef enum {
|
|
JSON_OBJECT,
|
|
JSON_ARRAY,
|
|
} jcoll_type_t;
|
|
|
|
typedef enum {
|
|
JSON_COLLECTION,
|
|
JSON_STRING,
|
|
JSON_INTEGER,
|
|
JSON_DOUBLE,
|
|
JSON_TRUE,
|
|
JSON_FALSE,
|
|
JSON_NULL,
|
|
} jval_type_t;
|
|
|
|
struct json_val {
|
|
jval_type_t type;
|
|
union {
|
|
jcoll_t *collection;
|
|
const char *string;
|
|
i64 num_int;
|
|
f64 num_dbl;
|
|
bool boolean;
|
|
};
|
|
};
|
|
|
|
struct json_obj_pair {
|
|
const char *key;
|
|
jval_t value;
|
|
};
|
|
|
|
struct json_coll {
|
|
jcoll_type_t type;
|
|
u64 size;
|
|
union {
|
|
jobj_pair_t pairs[50];
|
|
jval_t items[50];
|
|
};
|
|
};
|
|
|
|
#endif // !JSON_TEST_H
|