Updated json_entities
This commit is contained in:
@@ -5,26 +5,60 @@
|
||||
#include "dstring.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef struct json_value jval_t;
|
||||
typedef struct jentity jentity_t;
|
||||
typedef struct jcoll jcoll_t;
|
||||
typedef struct jval jval_t;
|
||||
typedef struct jpair jpair_t;
|
||||
|
||||
typedef enum {
|
||||
JVAL_OBJECT,
|
||||
JVAL_ARRAY,
|
||||
JVAL_STRING,
|
||||
JVAL_INTEGER,
|
||||
JVAL_DOUBLE,
|
||||
JVAL_BOOLEAN,
|
||||
JVAL_NULL,
|
||||
} jval_type_t;
|
||||
JSON_VALUE_COLLECTION,
|
||||
JSON_VALUE_STRING,
|
||||
JSON_VALUE_INTEGER,
|
||||
JSON_VALUE_DOUBLE,
|
||||
JSON_VALUE_BOOLEAN,
|
||||
JSON_VALUE_NULL,
|
||||
} jval_type;
|
||||
|
||||
struct json_value {
|
||||
jval_type_t type;
|
||||
union {
|
||||
dstr_t *string;
|
||||
i64 num_int;
|
||||
f64 num_dbl;
|
||||
bool boolean;
|
||||
};
|
||||
struct jval {
|
||||
jval_type type;
|
||||
union {
|
||||
jcoll_t *collection;
|
||||
dstr_t *string;
|
||||
i64 num_int;
|
||||
f64 num_dbl;
|
||||
bool boolean;
|
||||
};
|
||||
};
|
||||
|
||||
struct jpair {
|
||||
dstr_t *key;
|
||||
jval_t value;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
JVAL_SINGLE,
|
||||
JVAL_PAIR,
|
||||
} jentity_type;
|
||||
|
||||
struct jentity {
|
||||
jentity_type type;
|
||||
union {
|
||||
jval_t value;
|
||||
jpair_t pair;
|
||||
};
|
||||
jentity_t *parent;
|
||||
jentity_t *next;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
JCOLL_OBJECT,
|
||||
JCOLL_ARRAY,
|
||||
} jcoll_type;
|
||||
|
||||
struct jcoll {
|
||||
u64 size;
|
||||
jcoll_type type;
|
||||
jentity_t *first_child;
|
||||
};
|
||||
|
||||
#endif // !JSON_ENTITIES_H
|
||||
|
@@ -23,10 +23,10 @@ typedef enum {
|
||||
JSON_TRUE,
|
||||
JSON_FALSE,
|
||||
JSON_NULL,
|
||||
} jval_type_t;
|
||||
} jval_type;
|
||||
|
||||
struct json_val {
|
||||
jval_type_t type;
|
||||
jval_type type;
|
||||
union {
|
||||
jcoll_t *collection;
|
||||
const char *string;
|
||||
|
Reference in New Issue
Block a user