1
0
Fork 0
json_parser_c/json.h

40 lines
1.6 KiB
C

#ifndef JSON_H
#define JSON_H
#include <stddef.h>
#include <wchar.h>
#define JSON_DEFAULT_STRING_LENGTH 256
#define JSON_TYPE_NULL 0
#define JSON_TYPE_BOOLEAN 1
#define JSON_TYPE_NUMBER 2
#define JSON_TYPE_STRING 3
#define JSON_TYPE_ARRAY 4
#define JSON_TYPE_OBJECT 5
typedef struct json_node json_node;
void json_set_string_length(size_t length);
const wchar_t *json_error_get_path(void);
const wchar_t *json_error_get_message(void);
void json_error_clear(void);
json_node *json_parse(const wchar_t *s);
void json_stringify(json_node *node, wchar_t *s);
json_node *json_node_create(json_type type);
void json_node_destroy(json_node *node);
json_type json_node_type(json_node *node);
json_node *json_node_upper(json_node *node);
json_node *json_node_next(json_node *node);
json_node *json_node_previous(json_node *node);
size_t json_array_size(json_node *node);
json_node *json_array_get(json_node *node, size_t pos);
json_node *json_object_get(json_node *node, const wchar_t *key);
void json_array_push_back(json_node *dest_node, json_node *src_node);
void json_array_push_front(json_node *dest_node, json_node *src_node);
json_node *json_array_pop_back(json_node *node);
json_node *json_array_pop_front(json_node *node);
json_node *json_object_set(json_node *dest_node, const wchar_t *key, json_node *src_node);
double json_number_get_value(json_node *node);
const wchar_t *json_string_get_value(json_node *node);
int json_boolean_get_value(json_node *node);
void json_number_set_value(json_node *node, double value);
void json_string_set_value(json_node *node, const wchar_t *s);
void json_boolean_set_value(json_node *node, int value);
#endif