diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-01-25 21:50:14 +0100 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-01-25 21:50:14 +0100 |
commit | 28b9d2236753645a96e94fb35724e16d93876206 (patch) | |
tree | 09020714e74581b9173edbcd9a0c81bc6d4e36cd /source | |
parent | 2654a133cb1d94a0505c478f90dfc608640716e9 (diff) | |
download | kit-28b9d2236753645a96e94fb35724e16d93876206.zip |
Update unival interface
Diffstat (limited to 'source')
-rw-r--r-- | source/kit/unival.h | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/source/kit/unival.h b/source/kit/unival.h index 63868d5..e0362b1 100644 --- a/source/kit/unival.h +++ b/source/kit/unival.h @@ -1,5 +1,5 @@ -#ifndef KIT_UV_H -#define KIT_UV_H +#ifndef KIT_UNIVAL_H +#define KIT_UNIVAL_H #include "string_builder.h" #include "input_stream.h" @@ -19,15 +19,18 @@ enum { KIT_UV_COMPOSITE, }; -enum { KIT_UV_ENCODE_BZIP = 1 }; -enum { KIT_UV_PRINT_PRETTY = 1, KIT_UV_PRINT_JSON = 2 }; +enum { + KIT_UV_ENCODE_BZIP = 1, + KIT_UV_PRINT_PRETTY = 1, + KIT_UV_PRINT_JSON = 2, +}; -typedef struct kit_uv_data kit_unival_t; +typedef struct kit_unival_ kit_unival_t; typedef KIT_DA(kit_unival_t) kit_da_unival_t; typedef KIT_DA(u8) kit_uv_bytes_t; -struct kit_uv_data { +struct kit_unival_ { i8 type; union { i8 boolean; @@ -48,28 +51,33 @@ typedef struct { kit_unival_t *value; } kit_uv_decode_result_t; +kit_uv_decode_result_t kit_uv_decode(kit_is_handle_t is, + kit_allocator_t *alloc); + typedef struct { s32 status; kit_uv_bytes_t value; } kit_uv_encode_result_t; -typedef struct { - s32 status; - kit_str_builder_t value; -} kit_uv_print_result_t; - -kit_uv_decode_result_t kit_uv_decode(kit_is_handle_t is, - kit_allocator_t *alloc); kit_uv_encode_result_t kit_uv_encode(kit_unival_t *value, kit_allocator_t *alloc, i32 flags); + kit_uv_decode_result_t kit_uv_parse(kit_is_handle_t is, kit_allocator_t *alloc); + kit_uv_decode_result_t kit_uv_parse_json(kit_is_handle_t is, kit_allocator_t *alloc); -kit_uv_print_result_t kit_uv_print(kit_unival_t *value, - kit_allocator_t *alloc, i32 flags); -void kit_uv_destroy(kit_unival_t *value); + +typedef struct { + s32 status; + kit_str_builder_t value; +} kit_uv_print_result_t; + +kit_uv_print_result_t kit_uv_print(kit_unival_t *value, + kit_allocator_t *alloc, i32 flags); + +void kit_uv_destroy(kit_unival_t *value); #ifdef __cplusplus } |