diff options
Diffstat (limited to 'source/kit/unival.h')
-rw-r--r-- | source/kit/unival.h | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/source/kit/unival.h b/source/kit/unival.h index a87a763..e0362b1 100644 --- a/source/kit/unival.h +++ b/source/kit/unival.h @@ -1,7 +1,6 @@ -#ifndef KIT_UV_H -#define KIT_UV_H +#ifndef KIT_UNIVAL_H +#define KIT_UNIVAL_H -#include "status.h" #include "string_builder.h" #include "input_stream.h" @@ -20,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; @@ -45,32 +47,37 @@ struct kit_uv_data { }; typedef struct { - kit_status_t status; + s32 status; 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 { - kit_status_t status; + s32 status; kit_uv_bytes_t value; } kit_uv_encode_result_t; -typedef struct { - kit_status_t 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 } |