diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2023-12-29 06:21:33 +0100 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2023-12-29 06:21:33 +0100 |
commit | 2d6c8fec45b23a8a28668ecf3ef281139ab778a7 (patch) | |
tree | 75d2a8538992129a83c0c2b83688289443d697e5 /source/kit/xml.h | |
parent | 820b171245f2f14766f3accdb0246a4e2c0d596a (diff) | |
download | saw-2d6c8fec45b23a8a28668ecf3ef281139ab778a7.zip |
refactor dependencies; include dependencies source code
Diffstat (limited to 'source/kit/xml.h')
-rw-r--r-- | source/kit/xml.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/source/kit/xml.h b/source/kit/xml.h new file mode 100644 index 0000000..0bd5744 --- /dev/null +++ b/source/kit/xml.h @@ -0,0 +1,63 @@ +#ifndef KIT_XML_H +#define KIT_XML_H + +#include "status.h" +#include "string_builder.h" +#include "input_stream.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct kit_xml_ kit_xml_t; + +typedef struct { + kit_str_builder_t name; + kit_str_builder_t value; +} kit_xml_property_t; + +typedef KIT_DA(kit_xml_property_t) kit_da_xml_property_t; +typedef KIT_DA(kit_xml_t) kit_da_xml_t; + +struct kit_xml_ { + i8 is_declaration; + kit_str_builder_t tag; + kit_str_builder_t text; + kit_str_builder_t tail; + kit_da_xml_property_t properties; + kit_da_xml_t children; +}; + +typedef struct { + kit_status_t status; + kit_xml_t xml; +} kit_xml_parse_result_t; + +typedef struct { + kit_status_t status; + kit_str_builder_t text; +} kit_xml_text_t; + +kit_xml_parse_result_t kit_xml_parse(kit_is_handle_t is, + kit_allocator_t *alloc); +kit_xml_text_t kit_xml_print(kit_xml_t *xml, kit_allocator_t *alloc); +kit_xml_text_t kit_xml_full_text(kit_xml_t *xml, + kit_allocator_t *alloc); +void kit_xml_destroy(kit_xml_t *xml); + +#ifdef __cplusplus +} +#endif + +#ifndef KIT_DISABLE_SHORT_NAMES +# define xml_parse kit_xml_parse +# define xml_print kit_xml_print +# define xml_full_text kit_xml_full_text +# define xml_destroy kit_xml_destroy +# define xml_t kit_xml_t +# define xml_property_t kit_xml_property_t +# define xml_parse_result_t kit_xml_parse_result_t +# define xml_text_t kit_xml_text_t +#endif + +#endif |