]> andersk Git - libyaml.git/blob - include/yaml/yaml.h
Add doxygen support.
[libyaml.git] / include / yaml / yaml.h
1 /**
2  * @file yaml.h
3  * @brief Public interface for libyaml.
4  * 
5  * Include the header file with
6  * @code
7  * #include <yaml/yaml.h>
8  * @endcode
9  */
10
11 #ifndef YAML_H
12 #define YAML_H
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 #include <stdlib.h>
19
20 #include "yaml_version.h"
21 #include "yaml_error.h"
22
23 typedef enum {
24     YAML_DETECT_ENCODING,
25     YAML_UTF8_ENCODING,
26     YAML_UTF16LE_ENCODING,
27     YAML_UTF16BE_ENCODING
28 } yaml_encoding_t;
29
30 typedef enum {
31     YAML_ANY_SCALAR_STYLE,
32     YAML_PLAIN_SCALAR_STYLE,
33     YAML_SINGLE_QUOTED_SCALAR_STYLE,
34     YAML_DOUBLE_QUOTED_SCALAR_STYLE,
35     YAML_LITERAL_SCALAR_STYLE,
36     YAML_FOLDED_SCALAR_STYLE
37 } yaml_scalar_style_t;
38
39 typedef enum {
40     YAML_ANY_SEQUENCE_STYLE,
41     YAML_BLOCK_SEQUENCE_STYLE,
42     YAML_FLOW_SEQUENCE_STYLE
43 } yaml_sequence_style_t;
44
45 typedef enum {
46     YAML_ANY_MAPPING_STYLE,
47     YAML_BLOCK_MAPPING_STYLE,
48     YAML_FLOW_MAPPING_STYLE
49 } yaml_mapping_style_t;
50
51 typedef enum {
52     YAML_STREAM_START_TOKEN,
53     YAML_STREAM_END_TOKEN,
54
55     YAML_VERSION_DIRECTIVE_TOKEN,
56     YAML_TAG_DIRECTIVE_TOKEN,
57     YAML_DOCUMENT_START_TOKEN,
58     YAML_DOCUMENT_END_TOKEN,
59
60     YAML_BLOCK_SEQUENCE_START_TOKEN,
61     YAML_BLOCK_MAPPING_START_TOKEN,
62     YAML_BLOCK_END_TOKEN,
63
64     YAML_FLOW_SEQUENCE_START_TOKEN,
65     YAML_FLOW_SEQUENCE_END_TOKEN,
66     YAML_FLOW_MAPPING_START_TOKEN,
67     YAML_FLOW_MAPPING_END_TOKEN,
68
69     YAML_BLOCK_ENTRY_TOKEN,
70     YAML_FLOW_ENTRY_TOKEN,
71     YAML_KEY_TOKEN,
72     YAML_VALUE_TOKEN,
73
74     YAML_ALIAS_TOKEN,
75     YAML_ANCHOR_TOKEN,
76     YAML_TAG_TOKEN,
77     YAML_SCALAR_TOKEN
78 } yaml_token_type_t;
79
80 typedef enum {
81     YAML_STREAM_START_EVENT,
82     YAML_STREAM_END_EVENT,
83
84     YAML_DOCUMENT_START_EVENT,
85     YAML_DOCUMENT_END_EVENT,
86
87     YAML_ALIAS_EVENT,
88     YAML_SCALAR_EVENT,
89
90     YAML_SEQUENCE_START_EVENT,
91     YAML_SEQUENCE_END_EVENT,
92
93     YAML_MAPPING_START_EVENT,
94     YAML_MAPPING_END_EVENT
95 } yaml_event_type_t;
96
97 typedef struct {
98     size_t offset;
99     size_t index;
100     size_t line;
101     size_t column;
102 } yaml_mark_t;
103
104 typedef struct {
105     yaml_error_type_t type;
106     char *context;
107     yaml_mark_t context_mark;
108     char *problem;
109     yaml_mark_t problem_mark;
110 } yaml_error_t;
111
112 typedef struct {
113     yaml_token_type_t type;
114     union {
115         yaml_encoding_t encoding;
116         char *anchor;
117         char *tag;
118         struct {
119             char *value;
120             size_t length;
121             yaml_scalar_style_t style;
122         } scalar;
123         struct {
124             int major;
125             int minor;
126         } version;
127         struct {
128           char *handle;
129           char *prefix;
130         } tag_pair;
131     } data;
132     yaml_mark_t start_mark;
133     yaml_mark_t end_mark;
134 } yaml_token_t;
135
136 typedef struct {
137     yaml_event_type_t type;
138     union {
139         struct {
140             yaml_encoding_t encoding;
141         } stream_start;
142         struct {
143             struct {
144                 int major;
145                 int minor;
146             } version;
147             struct {
148                 char *handle;
149                 char *prefix;
150             } **tag_pairs;
151             int implicit;
152         } document_start;
153         struct {
154             int implicit;
155         } document_end;
156         struct {
157             char *anchor;
158         } alias;
159         struct {
160             char *anchor;
161             char *tag;
162             char *value;
163             size_t length;
164             int plain_implicit;
165             int quoted_implicit;
166             yaml_scalar_style_t style;
167         } scalar;
168         struct {
169             char *anchor;
170             char *tag;
171             int implicit;
172             yaml_sequence_style_t style;
173         } sequence_start;
174         struct {
175             char *anchor;
176             char *tag;
177             int implicit;
178             yaml_mapping_style_t style;
179         } mapping_start;
180     } data;
181     yaml_mark_t start_mark;
182     yaml_mark_t end_mark;
183 } yaml_event_t;
184
185 /*
186 typedef struct {
187 } yaml_parser_t;
188
189 typedef struct {
190 } yaml_emitter_t;
191 */
192
193 #ifdef __cplusplus
194 }
195 #endif
196
197 #endif /* #ifndef YAML_H */
198
This page took 0.869246 seconds and 5 git commands to generate.