-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyaml-0.1.vapi
1811 lines (1591 loc) · 52.3 KB
/
yaml-0.1.vapi
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (c) 2019 Junde Yhi <lmy441900@aosc.xyz>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
[CCode (cheader_filename = "yaml.h")]
namespace Yaml {
/**
* Get the library version as a string.
*
* @return The function return the pointer to a static string of the form
* ``"X.Y.Z"``, where ```X`` is the major version number, ``Y`` is a minor
* version number, and ``Z`` is the patch version number.
*/
public static unowned string get_version_string();
/**
* Get the library version numbers.
*
* @param major Major version number.
* @param minor Minor version number.
* @param patch Patch version number.
*/
public static void get_version(out int major, out int minor, out int patch);
/*
* Not bound: The character type (UTF-8 octet).
*
* This should be equivalent to Vala's ``string`` type.
*/
/** The version directive data. */
[CCode (cname = "yaml_version_directive_t", has_destroy_function = false, has_type_id = false)]
public struct VersionDirective {
/** The major version number. */
int major;
/** The minor version number. */
int minor;
}
/** The tag directive data. */
[CCode (cname = "yaml_tag_directive_t", has_destroy_function = false, has_type_id = false)]
public struct TagDirective {
/** The tag handle. */
string? handle;
/** The tag prefix. */
string? prefix;
}
/** The stream encoding. */
[CCode (cname = "yaml_encoding_t", has_type_id = false)]
public enum Encoding {
/** Let the parser choose the encoding. */
[CCode (cname = "YAML_ANY_ENCODING")]
ANY,
/** The default UTF-8 encoding. */
[CCode (cname = "YAML_UTF8_ENCODING")]
UTF8,
/** The UTF-16-LE encoding with BOM. */
[CCode (cname = "YAML_UTF16LE_ENCODING")]
UTF16LE,
/** The UTF-16-BE encoding with BOM. */
[CCode (cname = "YAML_UTF16BE_ENCODING")]
UTF16BE,
}
/** Line break types. */
[CCode (cname = "yaml_break_t", has_type_id = false)]
public enum Break {
/** Let the parser choose the break type. */
[CCode (cname = "YAML_ANY_BREAK")]
ANY,
/** Use CR for line breaks (Mac style). */
[CCode (cname = "YAML_CR_BREAK")]
CR,
/** Use LN for line breaks (Unix style). */
[CCode (cname = "YAML_LN_BREAK")]
LN,
/** Use CR LN for line breaks (DOS style). */
[CCode (cname = "YAML_CRLN_BREAK")]
CRLN,
}
/** Many bad things could happen with the parser and emitter. */
[CCode (cname = "yaml_error_type_t", has_type_id = false)]
public enum ErrorType {
/** No error is produced. */
[CCode (cname = "YAML_NO_ERROR")]
NO,
/** Cannot allocate or reallocate a block of memory. */
[CCode (cname = "YAML_MEMORY_ERROR")]
MEMORY,
/** Cannot read or decode the input stream. */
[CCode (cname = "YAML_READER_ERROR")]
READER,
/** Cannot scan the input stream. */
[CCode (cname = "YAML_SCANNER_ERROR")]
SCANNER,
/** Cannot parse the input stream. */
[CCode (cname = "YAML_PARSER_ERROR")]
PARSER,
/** Cannot compose a YAML document. */
[CCode (cname = "YAML_COMPOSER_ERROR")]
COMPOSER,
/** Cannot write to the output stream. */
[CCode (cname = "YAML_WRITER_ERROR")]
WRITER,
/** Cannot emit a YAML stream. */
[CCode (cname = "YAML_EMITTER_ERROR")]
EMITTER,
}
/** The pointer position. */
[CCode (cname = "yaml_mark_t", has_type_id = false)]
public struct Mark {
/** The position index. */
size_t index;
/** The position line. */
size_t line;
/** The position column. */
size_t column;
}
/** Scalar styles. */
[CCode (cname = "yaml_scalar_style_t", has_type_id = false)]
public enum ScalarStyle {
/** Let the emitter choose the style. */
[CCode (cname = "YAML_ANY_SCALAR_STYLE")]
ANY,
/** The plain scalar style. */
[CCode (cname = "YAML_PLAIN_SCALAR_STYLE")]
PLAIN,
/** The single-quoted scalar style. */
[CCode (cname = "YAML_SINGLE_QUOTED_SCALAR_STYLE")]
SINGLE_QUOTED,
/** The double-quoted scalar style. */
[CCode (cname = "YAML_DOUBLE_QUOTED_SCALAR_STYLE")]
DOUBLE_QUOTED,
/** The literal scalar style. */
[CCode (cname = "YAML_LITERAL_SCALAR_STYLE")]
LITERAL,
/** The folded scalar style. */
[CCode (cname = "YAML_FOLDED_SCALAR_STYLE")]
FOLDED,
}
/** Sequence styles. */
[CCode (cname = "yaml_sequence_style_t", has_type_id = false)]
public enum SequenceStyle {
/** Let the emitter choose the style. */
[CCode (cname = "YAML_ANY_SEQUENCE_STYLE")]
ANY,
/** The block sequence style. */
[CCode (cname = "YAML_BLOCK_SEQUENCE_STYLE")]
BLOCK,
/** The flow sequence style. */
[CCode (cname = "YAML_FLOW_SEQUENCE_STYLE")]
FLOW,
}
/** Mapping styles. */
[CCode (cname = "yaml_mapping_style_t", has_type_id = false)]
public enum MappingStyle {
/** Let the emitter choose the style. */
[CCode (cname = "YAML_ANY_MAPPING_STYLE")]
ANY,
/** The block mapping style. */
[CCode (cname = "YAML_BLOCK_MAPPING_STYLE")]
BLOCK,
/** The flow mapping style. */
[CCode (cname = "YAML_FLOW_MAPPING_STYLE")]
FLOW,
}
/** Token types. */
[CCode (cname = "yaml_token_type_t", has_type_id = false)]
public enum TokenType {
/** An empty token. */
[CCode (cname = "YAML_NO_TOKEN")]
NO,
/** A STREAM-START token. */
[CCode (cname = "YAML_STREAM_START_TOKEN")]
STREAM_START,
/** A STREAM-END token. */
[CCode (cname = "YAML_STREAM_END_TOKEN")]
STREAM_END,
/** A VERSION-DIRECTIVE token. */
[CCode (cname = "YAML_VERSION_DIRECTIVE_TOKEN")]
VERSION_DIRECTIVE,
/** A TAG-DIRECTIVE token. */
[CCode (cname = "YAML_TAG_DIRECTIVE_TOKEN")]
TAG_DIRECTIVE,
/** A DOCUMENT-START token. */
[CCode (cname = "YAML_DOCUMENT_START_TOKEN")]
DOCUMENT_START,
/** A DOCUMENT-END token. */
[CCode (cname = "YAML_DOCUMENT_END_TOKEN")]
DOCUMENT_END,
/** A BLOCK-SEQUENCE-START token. */
[CCode (cname = "YAML_BLOCK_SEQUENCE_START_TOKEN")]
BLOCK_SEQUENCE_START,
/** A BLOCK-SEQUENCE-END token. */
[CCode (cname = "YAML_BLOCK_MAPPING_START_TOKEN")]
BLOCK_MAPPING_START,
/** A BLOCK-END token. */
[CCode (cname = "YAML_BLOCK_END_TOKEN")]
BLOCK_END,
/** A FLOW-SEQUENCE-START token. */
[CCode (cname = "YAML_FLOW_SEQUENCE_START_TOKEN")]
FLOW_SEQUENCE_START,
/** A FLOW-SEQUENCE-END token. */
[CCode (cname = "YAML_FLOW_SEQUENCE_END_TOKEN")]
FLOW_SEQUENCE_END,
/** A FLOW-MAPPING-START token. */
[CCode (cname = "YAML_FLOW_MAPPING_START_TOKEN")]
FLOW_MAPPING_START,
/** A FLOW-MAPPING-END token. */
[CCode (cname = "YAML_FLOW_MAPPING_END_TOKEN")]
FLOW_MAPPING_END,
/** A BLOCK-ENTRY token. */
[CCode (cname = "YAML_BLOCK_ENTRY_TOKEN")]
BLOCK_ENTRY,
/** A FLOW-ENTRY token. */
[CCode (cname = "YAML_FLOW_ENTRY_TOKEN")]
FLOW_ENTRY,
/** A KEY token. */
[CCode (cname = "YAML_KEY_TOKEN")]
KEY,
/** A VALUE token. */
[CCode (cname = "YAML_VALUE_TOKEN")]
VALUE,
/** An ALIAS token. */
[CCode (cname = "YAML_ALIAS_TOKEN")]
ALIAS,
/** An ANCHOR token. */
[CCode (cname = "YAML_ANCHOR_TOKEN")]
ANCHOR,
/** A TAG token. */
[CCode (cname = "YAML_TAG_TOKEN")]
TAG,
/** A SCALAR token. */
[CCode (cname = "YAML_SCALAR_TOKEN")]
SCALAR
}
/** The token structure. */
[CCode (cname = "yaml_token_t", destroy_function = "yaml_token_delete", has_type_id = false)]
public struct Token {
/** The token type. */
TokenType type;
/* The token data. */
/* The stream start (for TokenType.STREAM_START). */
/** The stream encoding. */
[CCode (cname = "data.stream_start.encoding")]
Encoding data_stream_start_encoding;
/* The alias (for TokenType.ALIAS). */
/** The alias value. */
[CCode (cname = "data.alias.value")]
string? data_alias_value;
/* The anchor (for TokenType.ANCHOR). */
/** The anchor value. */
[CCode (cname = "data.anchor.value")]
string? data_anchor_value;
/* The tag (for TokenType.TAG). */
/** The tag handle. */
[CCode (cname = "data.tag.handle")]
string? data_tag_handle;
/** The tag suffix. */
[CCode (cname = "data.tag.suffix")]
string? data_tag_suffix;
/* The scalar value (for TokenType.SCALAR). */
/** The scalar value. */
[CCode (cname = "data.scalar.value")]
string? data_scalar_value;
/** The length of the scalar value. */
[CCode (cname = "data.scalar.length")]
size_t data_scalar_length;
/** The scalar style. */
[CCode (cname = "data.scalar.style")]
ScalarStyle data_scalar_style;
/* The version directive (for TokenType.VERSION_DIRECTIVE). */
/** The major version number. */
[CCode (cname = "data.version_directive.major")]
int data_version_directive_major;
/** The minor version number. */
[CCode (cname = "data.version_directive.minor")]
int data_version_directive_minor;
/** The tag directive (for TokenType.TAG_DIRECTIVE). */
/** The tag handle. */
[CCode (cname = "data.tag_directive.handle")]
string? data_tag_directive_handle;
/** The tag prefix. */
[CCode (cname = "data.tag_directive.prefix")]
string? data_tag_directive_prefix;
/** The beginning of the token. */
Mark start_mark;
/** The end of the token. */
Mark end_mark;
}
/** Event types. */
[CCode (cname = "yaml_event_type_t", has_type_id = false)]
public enum EventType {
/** An empty event. */
[CCode (cname = "YAML_NO_EVENT")]
NO,
/** A STREAM-START event. */
[CCode (cname = "YAML_STREAM_START_EVENT")]
STREAM_START,
/** A STREAM-END event. */
[CCode (cname = "YAML_STREAM_END_EVENT")]
STREAM_END,
/** A DOCUMENT-START event. */
[CCode (cname = "YAML_DOCUMENT_START_EVENT")]
DOCUMENT_START,
/** A DOCUMENT-END event. */
[CCode (cname = "YAML_DOCUMENT_END_EVENT")]
DOCUMENT_END,
/** An ALIAS event. */
[CCode (cname = "YAML_ALIAS_EVENT")]
ALIAS,
/** A SCALAR event. */
[CCode (cname = "YAML_SCALAR_EVENT")]
SCALAR,
/** A SEQUENCE-START event. */
[CCode (cname = "YAML_SEQUENCE_START_EVENT")]
SEQUENCE_START,
/** A SEQUENCE-END event. */
[CCode (cname = "YAML_SEQUENCE_END_EVENT")]
SEQUENCE_END,
/** A MAPPING-START event. */
[CCode (cname = "YAML_MAPPING_START_EVENT")]
MAPPING_START,
/** A MAPPING-END event. */
[CCode (cname = "YAML_MAPPING_END_EVENT")]
MAPPING_END,
}
/** The event structure. */
[CCode (cname = "yaml_event_t", destroy_function = "yaml_event_delete", has_type_id = false)]
public struct Event {
/** The event type. */
EventType type;
/* The event data. */
/* The stream parameters (for EventType.STREAM_START). */
/** The document encoding. */
[CCode (cname = "data.stream_start.encoding", has_type_id = false)]
Encoding data_stream_start_encoding;
/* The document parameters (for EventType.DOCUMENT_START). */
/** The version directive. */
[CCode (cname = "data.document_start.version_directive", has_type_id = false)]
VersionDirective? data_document_start_version_directive;
/* The list of tag directives. */
/** The beginning of the tag directives list. */
[CCode (cname = "data.document_start.tag_directives.start", has_type_id = false)]
TagDirective? data_document_start_tag_directives_start;
/** The end of the tag directives list. */
[CCode (cname = "data.document_start.tag_directives.end", has_type_id = false)]
TagDirective? data_document_start_tag_directives_end;
/** Is the document indicator implicit? */
[CCode (cname = "data.document_start.implicit", has_type_id = false)]
int data_document_start_implicit;
/* The document end parameters (for EventType.DOCUMENT_END). */
/** Is the document end indicator implicit? */
[CCode (cname = "data.document_end.implicit", has_type_id = false)]
int data_document_end_implicit;
/* The alias parameters (for EventType.ALIAS). */
/** The anchor. */
[CCode (cname = "data.alias.anchor", has_type_id = false)]
string? data_alias_anchor;
/* The scalar parameters (for EventType.SCALAR). */
/** The anchor. */
[CCode (cname = "data.scalar.anchor", has_type_id = false)]
string? data_scalar_anchor;
/** The tag. */
[CCode (cname = "data.scalar.tag", has_type_id = false)]
string? data_scalar_tag;
/** The scalar value. */
[CCode (cname = "data.scalar.value", has_type_id = false)]
string? data_scalar_value;
/** The length of the scalar value. */
[CCode (cname = "data.scalar.length", has_type_id = false)]
size_t data_scalar_length;
/** Is the tag optional for the plain style? */
[CCode (cname = "data.scalar.plain_implicit", has_type_id = false)]
int data_scalar_plain_implicit;
/** Is the tag optional for any non-plain style? */
[CCode (cname = "data.scalar.quoted_implicit", has_type_id = false)]
int data_scalar_quoted_implicit;
/** The scalar style. */
[CCode (cname = "data.scalar.style", has_type_id = false)]
ScalarStyle data_scalar_style;
/* The sequence parameters (for EventType.SEQUENCE_START). */
/** The anchor. */
[CCode (cname = "data.sequence_start.anchor", has_type_id = false)]
string? data_sequence_start_anchor;
/** The tag. */
[CCode (cname = "data.sequence_start.tag", has_type_id = false)]
string? data_sequence_start_tag;
/** Is the tag optional? */
[CCode (cname = "data.sequence_start.implicit", has_type_id = false)]
int data_sequence_start_implicit;
/** The sequence style. */
[CCode (cname = "data.sequence_start.style", has_type_id = false)]
SequenceStyle data_sequence_start_style;
/* The mapping parameters (for EventType.MAPPING_START). */
/** The anchor. */
[CCode (cname = "data.mapping_start.anchor", has_type_id = false)]
string? data_mapping_start_anchor;
/** The tag. */
[CCode (cname = "data.mapping_start.tag", has_type_id = false)]
string? data_mapping_start_tag;
/** Is the tag optional? */
[CCode (cname = "data.mapping_start.implicit", has_type_id = false)]
int data_mapping_start_implicit;
/** The mapping style. */
[CCode (cname = "data.mapping_start.style", has_type_id = false)]
SequenceStyle data_mapping_start_style;
/** The beginning of the event. */
Mark start_mark;
/** The end of the event. */
Mark end_mark;
/**
* Create the STREAM-START event.
*
* @param event An empty event object.
* @param encoding The stream encoding.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_stream_start_event_initialize")]
public int stream_start_initialize(Encoding encoding);
/**
* Create the STREAM-END event.
*
* @param event An empty event object.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_stream_end_event_initialize")]
public int stream_end_initialize();
/**
* Create the DOCUMENT-START event.
*
* The implicit argument is considered as a stylistic parameter and may be
* ignored by the emitter.
*
* @param event An empty event object.
* @param version_directive The %YAML directive value or ``NULL``.
* @param tag_directives_start The beginning of the %TAG directives list.
* @param tag_directives_end The end of the %TAG directives list.
* @param implicit If the document start indicator is implicit.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_document_start_event_initialize")]
public int document_start_initialize(VersionDirective? version_directive, TagDirective tag_directive_start, TagDirective tag_directive_end, int implicit);
/**
* Create the DOCUMENT-END event.
*
* The implicit argument is considered as a stylistic parameter and may be
* ignored by the emitter.
*
* @param event An empty event object.
* @param implicit If the document end indicator is implicit.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_document_end_event_initialize")]
public int document_end_initialize(int implicit);
/**
* Create an ALIAS event.
*
* @param event An empty event object.
* @param anchor The anchor value.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_alias_event_initialize")]
public int alias_initialize(string anchor);
/**
* Create a SCALAR event.
*
* The style argument may be ignored by the emitter.
*
* Either the tag attribute or one of the plain_implicit and quoted_implicit
* flags must be set.
*
* @param event An empty event object.
* @param anchor The scalar anchor or ``NULL``.
* @param tag The scalar tag or ``NULL``.
* @param value The scalar value.
* @param length The length of the scalar value.
* @param plain_implicit If the tag may be omitted for the plain style.
* @param quoted_implicit If the tag may be omitted for any non-plain style.
* @param style The scalar style.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_scalar_event_initialize")]
public int scalar_initialize(string? anchor, string? tag, string value, int length, int plain_implicit, int quoted_implicit, ScalarStyle style);
/**
* Create a SEQUENCE-START event.
*
* The style argument may be ignored by the emitter.
*
* Either the tag attribute or the implicit flag must be set.
*
* @param event An empty event object.
* @param anchor The sequence anchor or ``NULL``.
* @param tag The sequence tag or ``NULL``.
* @param implicit If the tag may be omitted.
* @param style The sequence style.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_sequence_start_event_initialize")]
public int sequence_start_initialize(string? anchor, string? tag, int implicit, SequenceStyle style);
/**
* Create a SEQUENCE-END event.
*
* @param event An empty event object.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_sequence_end_event_initialize")]
public int sequence_end_initialize();
/**
* Create a MAPPING-START event.
*
* The style argument may be ignored by the emitter.
*
* Either the tag attribute or the implicit flag must be set.
*
* @param event An empty event object.
* @param anchor The mapping anchor or ``NULL``.
* @param tag The mapping tag or ``NULL``.
* @param implicit If the tag may be omitted.
* @param style The mapping style.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_mapping_start_event_initialize")]
public int mapping_start_initialize(string? anchor, string? tag, int implicit, MappingStyle style);
/**
* Create a MAPPING-END event.
*
* @param event An empty event object.
*/
[CCode (cname = "yaml_mapping_end_event_initialize")]
public int mapping_end_initialize();
}
namespace Tag {
/** The tag ``!!null`` with the only possible value: ``null``. */
[CCode (cname = "YAML_NULL_TAG")]
public const string NULL;
/** The tag ``!!bool`` with the values: ``true`` and ``false``. */
[CCode (cname = "YAML_BOOL_TAG")]
public const string BOOL;
/** The tag ``!!str`` for string values. */
[CCode (cname = "YAML_STR_TAG")]
public const string STR;
/** The tag ``!!int`` for integer values. */
[CCode (cname = "YAML_INT_TAG")]
public const string INT;
/** The tag ``!!float`` for float values. */
[CCode (cname = "YAML_FLOAT_TAG")]
public const string FLOAT;
/** The tag ``!!timestamp`` for date and time values. */
[CCode (cname = "YAML_TIMESTAMP_TAG")]
public const string TIMESTAMP;
/** The tag ``!!seq`` is used to denote sequences. */
[CCode (cname = "YAML_SEQ_TAG")]
public const string SEQ;
/** The tag ``!!map`` is used to denote mapping. */
[CCode (cname = "YAML_MAP_TAG")]
public const string MAP;
/** The default scalar tag is ``!!str``. */
[CCode (cname = "YAML_DEFAULT_SCALAR_TAG")]
public const string DEFAULT_SCALAR;
/** The default sequence tag is ``!!seq``. */
[CCode (cname = "YAML_DEFAULT_SEQUENCE_TAG")]
public const string DEFAULT_SEQUENCE;
/** The default mapping tag is ``!!map``. */
[CCode (cname = "YAML_DEFAULT_MAPPING_TAG")]
public const string DEFAULT_MAPPING;
}
/** Node types. */
[CCode (cname = "yaml_node_type_t", has_type_id = false)]
public enum NodeType {
/** An empty node. */
[CCode (cname = "YAML_NO_NODE")]
NO,
/** A scalar node. */
[CCode (cname = "YAML_SCALAR_NODE")]
SCALAR,
/** A sequence node. */
[CCode (cname = "YAML_SEQUENCE_NODE")]
SEQUENCE,
/** A mapping node. */
[CCode (cname = "YAML_MAPPING_NODE")]
MAPPING,
}
/** The forward definition of a document node structure. */
[SimpleType]
[CCode (cname = "yaml_node_item_t", has_type_id = false)]
public struct NodeItem : int {}
/** An element of a sequence node. */
[CCode (cname = "yaml_node_pair_t", has_type_id = false)]
public struct NodePair {
/** The key of the element. */
int key;
/** The value of the element. */
int value;
}
/** The node structure. */
[CCode (cname = "yaml_node_t", has_destroy_function = false, has_type_id = false)]
public struct Node {
/** The node type. */
NodeType type;
/** The node tag. */
string tag;
/* The node data. */
/* The scalar parameters (for NodeType.SCALAR). */
/** The scalar value. */
[CCode (cname = "data.scalar.value")]
string data_scalar_value;
/** The length of the scalar value. */
[CCode (cname = "data.scalar.length")]
size_t data_scalar_length;
/** The scalar style. */
[CCode (cname = "data.scalar.style")]
ScalarStyle data_scalar_style;
/** The sequence parameters (for NodeType.SEQUENCE). */
/** The beginning of the stack of sequence items. */
[CCode (cname = "data.sequence.items.start")]
NodeItem? data_sequence_items_start;
/** The end of the stack of sequence items. */
[CCode (cname = "data.sequence.items.end")]
NodeItem? data_sequence_items_end;
/** The top of the stack of sequence items. */
[CCode (cname = "data.sequence.items.top")]
NodeItem? data_sequence_items_top;
/** The sequence style. */
[CCode (cname = "data.sequence.style")]
SequenceStyle style;
/* The mapping parameters (for NodeType.MAPPING). */
/** The beginning of the stack of mapping pairs (key, value). */
[CCode (cname = "data.mapping.pairs.start")]
NodePair? data_mapping_pairs_start;
/** The end of the stack of mapping pairs (key, value). */
[CCode (cname = "data.mapping.pairs.end")]
NodePair? data_mapping_pairs_end;
/** The top of the stack of mapping pairs (key, value). */
[CCode (cname = "data.mapping.pairs.top")]
NodePair? data_mapping_pairs_top;
/** The mapping style. */
[CCode (cname = "data.mapping.style")]
MappingStyle data_mapping_style;
/** The beginning of the node. */
Mark start_mark;
/** The end of the node. */
Mark end_mark;
}
/** The document structure. */
[CCode (cname = "yaml_document_t", destroy_function = "yaml_document_delete", has_type_id = false)]
public struct Document {
/* The document nodes. */
/** The beginning of the stack. */
[CCode (cname = "nodes.start")]
Node? node_start;
/** The end of the stack. */
[CCode (cname = "nodes.end")]
Node? node_end;
/** The top of the stack. */
[CCode (cname = "nodes.top")]
Node? node_top;
/** The version directive. */
VersionDirective? version_directive;
/* The list of tag directives. */
/** The beginning of the tag directives list. */
[CCode (cname = "tag_directives.start")]
TagDirective? tag_directives_start;
/** The end of the tag directives list. */
[CCode (cname = "tag_directives.end")]
TagDirective? tag_directives_end;
/** Is the document start indicator implicit? */
int start_implicit;
/** Is the document end indicator implicit? */
int end_implicit;
/** The beginning of the document. */
Mark start_mark;
/** The end of the document. */
Mark end_mark;
/**
* Create a YAML document.
*
* @param document An empty document object.
* @param version_directive The %YAML directive value or ``NULL``.
* @param tag_directives_start The beginning of the %TAG directives list.
* @param tag_directives_end The end of the %TAG directives list.
* @param start_implicit If the document start indicator is implicit.
* @param end_implicit If the document end indicator is implicit.
*
* @return 1 if the function succeeded, 0 on error.
*/
[CCode (cname = "yaml_document_initialize")]
public Document(VersionDirective? version_directive, TagDirective tag_directives_start, TagDirective tag_directives_end, int start_implicit, int end_implicit);
/**
* Get a node of a YAML document.
*
* The pointer returned by this function is valid until any of the functions
* modifying the documents are called.
*
* @param document A document object.
* @param index The node id.
*
* @return the node objct or ``NULL`` if ``node_id`` is out of range.
*/
public Node? get_node(int index);
/**
* Get the root of a YAML document node.
*
* The root object is the first object added to the document.
*
* The pointer returned by this function is valid until any of the functions
* modifying the documents are called.
*
* An empty document produced by the parser signifies the end of a YAML
* stream.
*
* @param document A document object.
*
* @return the node object or ``NULL`` if the document is empty.
*/
public Node? get_root_node();
/**
* Create a SCALAR node and attach it to the document.
*
* The style argument may be ignored by the emitter.
*
* @param document A document object.
* @param tag The scalar tag.
* @param value The scalar value.
* @param length The length of the scalar value.
* @param style The scalar style.
*
* @return the node id or ``0`` on error.
*/
public int add_scalar(string tag, string value, int length, ScalarStyle style);
/**
* Create a SEQUENCE node and attach it to the document.
*
* The style argument may be ignored by the emitter.
*
* @param document A document object.
* @param tag The sequence tag.
* @param style The sequence style.
*
* @return the node id or ``0`` on error.
*/
public int add_sequence(string tag, SequenceStyle style);
/**
* Create a MAPPING node and attach it to the document.
*
* The style argument may be ignored by the emitter.
*
* @param document A document object.
* @param tag The sequence tag.
* @param style The sequence style.
*
* @return the node id or ``0`` on error.
*/
public int add_mapping(string tag, MappingStyle style);
/**
* Add an item to a SEQUENCE node.
*
* @param document A document object.
* @param sequence The sequence node id.
* @param item The item node id.
*
* @return 1 if the function succeeded, 0 on error.
*/
public int append_sequence_item(int sequence, int item);
/**
* Add a pair of a key and a value to a MAPPING node.
*
* @param document A document object.
* @param mapping The mapping node id.
* @param key The key node id.
* @param value The value node id.
*
* @return 1 if the function succeeded, 0 on error.
*/
public int append_mapping_pair(int mapping, int key, int value);
}
/**
* The prototype of a read handler.
*
* The read handler is called when the parser needs to read more bytes from the
* source. The handler should write not more than size bytes to the buffer. The
* number of written bytes should be set to the length variable.
*
* @param data A pointer to an application data specified by
* ``yaml_parser_set_input()``.
* @param buffer The buffer to write the data from the source.
* @param size The size of the buffer.
* @param size_read The actual number of bytes read from the source.
*
* @return On success, the handler should return ``1``. If the handler failed,
* the returned value should be ``0``. On EOF, the handler should set the
* size_read to ``0`` and return ``1``.
*/
[CCode (cname = "yaml_read_handler_t", instance_pos = 0.1)]
public delegate int ReadHandler(
[CCode (array_length_type = "size_t")] uint8[] buffer,
ref size_t size_read
);
/**
* This structure holds information about a potential simple key.
*/
[CCode (cname = "yaml_simple_key_t", has_destroy_function = false, has_type_id = false)]
public struct SimpleKey {
/** Is a simple key possible? */
int possible;
/** Is a simple key required? */
int required;
/** The number of the token. */
size_t token_number;
/** The position mark. */
Mark mark;
}
/**
* The states of the parser.
*/
[CCode (cname = "yaml_parser_state_t", has_type_id = false)]
public enum ParserState {
/** Expect STREAM-START. */
[CCode (cname = "YAML_PARSE_STREAM_START_STATE")]
STREAM_START,
/** Expect the beginning of an implicit document. */
[CCode (cname = "YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE")]
IMPLICIT_DOCUMENT_START,
/** Expect DOCUMENT-START. */
[CCode (cname = "YAML_PARSE_DOCUMENT_START_STATE")]
DOCUMENT_START,
/** Expect the content of a document. */
[CCode (cname = "YAML_PARSE_DOCUMENT_CONTENT_STATE")]
DOCUMENT_CONTENT,
/** Expect DOCUMENT-END. */
[CCode (cname = "YAML_PARSE_DOCUMENT_END_STATE")]
DOCUMENT_END,
/** Expect a block node. */
[CCode (cname = "YAML_PARSE_BLOCK_NODE_STATE")]
BLOCK_NODE,
/** Expect a block node or indentless sequence. */
[CCode (cname = "YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE")]
BLOCK_NODE_OR_INDENTLESS_SEQUENCE,
/** Expect a flow node. */
[CCode (cname = "YAML_PARSE_FLOW_NODE_STATE")]
FLOW_NODE,
/** Expect the first entry of a block sequence. */
[CCode (cname = "YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE")]
BLOCK_SEQUENCE_FIRST_ENTRY,
/** Expect an entry of a block sequence. */
[CCode (cname = "YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE")]
BLOCK_SEQUENCE_ENTRY,
/** Expect an entry of an indentless sequence. */
[CCode (cname = "YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE")]
INDENTLESS_SEQUENCE_ENTRY,
/** Expect the first key of a block mapping. */
[CCode (cname = "YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE")]
BLOCK_MAPPING_FIRST_KEY,
/** Expect a block mapping key. */
[CCode (cname = "YAML_PARSE_BLOCK_MAPPING_KEY_STATE")]
BLOCK_MAPPING_KEY,
/** Expect a block mapping value. */
[CCode (cname = "YAML_PARSE_BLOCK_MAPPING_VALUE_STATE")]
BLOCK_MAPPING_VALUE,
/** Expect the first entry of a flow sequence. */
[CCode (cname = "YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE")]
FLOW_SEQUENCE_FIRST_ENTRY,