blob: fdc95362d2f268129a9b5797ec3435fa580488d3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
#ifndef KIT_XML_H
#define KIT_XML_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 {
s32 status;
kit_xml_t xml;
} kit_xml_parse_result_t;
typedef struct {
s32 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);
b8 kit_xml_has_property(kit_xml_t *xml, kit_str_t name);
kit_str_t kit_xml_property(kit_xml_t *xml, kit_str_t name);
void kit_xml_destroy(kit_xml_t *xml);
#ifdef __cplusplus
}
#endif
#ifndef KIT_DISABLE_SHORT_NAMES
# 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
# define xml_parse kit_xml_parse
# define xml_print kit_xml_print
# define xml_full_text kit_xml_full_text
# define xml_has_property kit_xml_has_property
# define xml_property kit_xml_property
# define xml_destroy kit_xml_destroy
#endif
#endif
|