Changeset 199 for libyaml/trunk/include/yaml/yaml.h
- Timestamp:
- 07/03/06 09:34:57 (7 years ago)
- File:
-
- 1 edited
-
libyaml/trunk/include/yaml/yaml.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libyaml/trunk/include/yaml/yaml.h
r185 r199 78 78 typedef unsigned char yaml_char_t; 79 79 80 /** The version directive data. */ 81 typedef struct { 82 /** The major version number. */ 83 int major; 84 /** The minor version number. */ 85 int minor; 86 } yaml_version_directive_t; 87 88 /** The tag directive data. */ 89 typedef struct { 90 /** The tag handle. */ 91 yaml_char_t *handle; 92 /** The tag prefix. */ 93 yaml_char_t *prefix; 94 } yaml_tag_directive_t; 95 80 96 /** The stream encoding. */ 81 97 typedef enum { … … 195 211 union { 196 212 197 /** The stream encoding (for @c YAML_STREAM_START_TOKEN). */ 198 yaml_encoding_t encoding; 199 200 /** The anchor (for @c YAML_ALIAS_TOKEN and @c YAML_ANCHOR_TOKEN). */ 201 yaml_char_t *anchor; 213 /** The stream start (for @c YAML_STREAM_START_TOKEN). */ 214 struct { 215 /** The stream encoding. */ 216 yaml_encoding_t encoding; 217 } stream_start; 218 219 /** The alias (for @c YAML_ALIAS_TOKEN). */ 220 struct { 221 /** The alias value. */ 222 yaml_char_t *value; 223 } alias; 224 225 /** The anchor (for @c YAML_ANCHOR_TOKEN). */ 226 struct { 227 /** The anchor value. */ 228 yaml_char_t *value; 229 } anchor; 202 230 203 231 /** The tag (for @c YAML_TAG_TOKEN). */ … … 420 448 /** @} */ 421 449 422 /* 423 450 /** 451 * @defgroup events Events 452 * @{ 453 */ 454 455 /** Event types. */ 424 456 typedef enum { 425 457 YAML_STREAM_START_EVENT, … … 439 471 } yaml_event_type_t; 440 472 473 /** The event structure. */ 441 474 typedef struct { 475 476 /** The event type. */ 442 477 yaml_event_type_t type; 478 479 /** The event data. */ 443 480 union { 444 struct { 481 482 /** The stream parameters (for @c YAML_STREAM_START_EVENT). */ 483 struct { 484 /** The document encoding. */ 445 485 yaml_encoding_t encoding; 446 486 } stream_start; 447 struct { 448 struct { 449 int major; 450 int minor; 451 } version; 452 struct { 453 char *handle; 454 char *prefix; 455 } **tag_pairs; 487 488 /** The document parameters (for @c YAML_DOCUMENT_START_EVENT). */ 489 struct { 490 /** The version directive. */ 491 yaml_version_directive_t *version_directive; 492 /** The list of tag directives. */ 493 yaml_tag_directive_t **tag_directives; 494 /** Is the document indicator implicit? */ 456 495 int implicit; 457 496 } document_start; 458 struct { 497 498 /** The document end parameters (for @c YAML_DOCUMENT_END_EVENT). */ 499 struct { 500 /** Is the document end indicator implicit? */ 459 501 int implicit; 460 502 } document_end; 461 struct { 462 char *anchor; 503 504 /** The alias parameters (for @c YAML_ALIAS_EVENT). */ 505 struct { 506 /** The anchor. */ 507 yaml_char_t *anchor; 463 508 } alias; 464 struct { 465 char *anchor; 466 char *tag; 467 char *value; 509 510 /** The scalar parameters (for @c YAML_SCALAR_EVENT). */ 511 struct { 512 /** The anchor. */ 513 yaml_char_t *anchor; 514 /** The tag. */ 515 yaml_char_t *tag; 516 /** The scalar value. */ 517 yaml_char_t *value; 518 /** The length of the scalar value. */ 468 519 size_t length; 520 /** Is the tag optional for the plain style? */ 469 521 int plain_implicit; 522 /** Is the tag optional for any non-plain style? */ 470 523 int quoted_implicit; 524 /** The scalar style. */ 471 525 yaml_scalar_style_t style; 472 526 } scalar; 473 struct { 474 char *anchor; 475 char *tag; 527 528 /** The sequence parameters (for @c YAML_SEQUENCE_START_EVENT). */ 529 struct { 530 /** The anchor. */ 531 yaml_char_t *anchor; 532 /** The tag. */ 533 yaml_char_t *tag; 534 /** Is the tag optional? */ 476 535 int implicit; 536 /** The sequence style. */ 477 537 yaml_sequence_style_t style; 478 538 } sequence_start; 479 struct { 480 char *anchor; 481 char *tag; 539 540 /** The mapping parameters (for @c YAML_MAPPING_START_EVENT). */ 541 struct { 542 /** The anchor. */ 543 yaml_char_t *anchor; 544 /** The tag. */ 545 yaml_char_t *tag; 546 /** Is the tag optional? */ 482 547 int implicit; 548 /** The mapping style. */ 483 549 yaml_mapping_style_t style; 484 550 } mapping_start; 551 485 552 } data; 553 554 /** The beginning of the token. */ 486 555 yaml_mark_t start_mark; 556 557 /** The end of the token. */ 487 558 yaml_mark_t end_mark; 488 559 } yaml_event_t; 489 560 490 */ 491 561 /** 562 * Create a new @c YAML_STREAM_START_EVENT event. 563 * 564 * @param[in] encoding The stream encoding. 565 * @param[in] start_mark The beginning of the event. 566 * @param[in] end_mark The end of the event. 567 * 568 * @returns A new event object, or @c NULL on error. 569 */ 570 571 YAML_DECLARE(yaml_event_t *) 572 yaml_stream_start_event_new(yaml_encoding_t encoding, 573 yaml_mark_t start_mark, yaml_mark_t end_mark); 574 575 /** 576 * Create a new @c YAML_STREAM_END_TOKEN event. 577 * 578 * @param[in] start_mark The beginning of the event. 579 * @param[in] end_mark The end of the event. 580 * 581 * @returns A new event object, or @c NULL on error. 582 */ 583 584 YAML_DECLARE(yaml_event_t *) 585 yaml_stream_end_event_new(yaml_mark_t start_mark, yaml_mark_t end_mark); 586 587 /** 588 * Create a new @c YAML_DOCUMENT_START_EVENT event. 589 * 590 * @param[in] version_directive The version directive or @c NULL. 591 * @param[in] tag_directives A list of tag directives or @c NULL. 592 * @param[in] implicit Is the document indicator present? 593 * @param[in] start_mark The beginning of the event. 594 * @param[in] end_mark The end of the event. 595 * 596 * @returns A new event object, or @c NULL on error. 597 */ 598 599 YAML_DECLARE(yaml_event_t *) 600 yaml_document_start_event_new(yaml_version_directive_t *version_directive, 601 yaml_tag_directive_t **tag_directives, int implicit, 602 yaml_mark_t start_mark, yaml_mark_t end_mark); 603 604 /** 605 * Create a new @c YAML_DOCUMENT_END_EVENT event. 606 * 607 * @param[in] implicit Is the document end indicator present? 608 * @param[in] start_mark The beginning of the event. 609 * @param[in] end_mark The end of the event. 610 * 611 * @returns A new event object, or @c NULL on error. 612 */ 613 614 YAML_DECLARE(yaml_event_t *) 615 yaml_document_end_event_new(int implicit, 616 yaml_mark_t start_mark, yaml_mark_t end_mark); 617 618 /** 619 * Create a new @c YAML_ALIAS_EVENT event. 620 * 621 * @param[in] anchor The anchor value. 622 * @param[in] start_mark The beginning of the event. 623 * @param[in] end_mark The end of the event. 624 * 625 * @returns A new event object, or @c NULL on error. 626 */ 627 628 YAML_DECLARE(yaml_event_t *) 629 yaml_alias_event_new(yaml_char_t *anchor, 630 yaml_mark_t start_mark, yaml_mark_t end_mark); 631 632 /** 633 * Create a new @c YAML_SCALAR_EVENT event. 634 * 635 * @param[in] anchor The anchor value or @c NULL. 636 * @param[in] tag The tag value or @c NULL. 637 * @param[in] value The scalar value. 638 * @param[in] length The length of the scalar value. 639 * @param[in] plain_implicit Is the tag optional for the plain style? 640 * @param[in] quoted_implicit Is the tag optional for any non-plain style? 641 * @param[in] style The scalar style. 642 * @param[in] start_mark The beginning of the event. 643 * @param[in] end_mark The end of the event. 644 * 645 * @returns A new event object, or @c NULL on error. 646 */ 647 648 YAML_DECLARE(yaml_event_t *) 649 yaml_scalar_event_new(yaml_char_t *anchor, yaml_char_t *tag, 650 yaml_char_t *value, size_t length, 651 int plain_implicit, int quoted_implicit, 652 yaml_scalar_style_t style, 653 yaml_mark_t start_mark, yaml_mark_t end_mark); 654 655 /** 656 * Create a new @c YAML_SEQUENCE_START_EVENT event. 657 * 658 * @param[in] anchor The anchor value or @c NULL. 659 * @param[in] tag The tag value or @c NULL. 660 * @param[in] implicit Is the tag optional? 661 * @param[in] style The sequence style. 662 * @param[in] start_mark The beginning of the event. 663 * @param[in] end_mark The end of the event. 664 * 665 * @returns A new event object, or @c NULL on error. 666 */ 667 668 YAML_DECLARE(yaml_event_t *) 669 yaml_sequence_start_new(yaml_char_t *anchor, yaml_char_t *tag, 670 int implicit, yaml_sequence_style_t style, 671 yaml_mark_t start_mark, yaml_mark_t end_mark); 672 673 /** 674 * Create a new @c YAML_SEQUENCE_END_EVENT event. 675 * 676 * @param[in] start_mark The beginning of the event. 677 * @param[in] end_mark The end of the event. 678 * 679 * @returns A new event object, or @c NULL on error. 680 */ 681 682 YAML_DECLARE(yaml_event_t *) 683 yaml_sequence_end_new(yaml_mark_t start_mark, yaml_mark_t end_mark); 684 685 /** 686 * Create a new @c YAML_MAPPING_START_EVENT event. 687 * 688 * @param[in] anchor The anchor value or @c NULL. 689 * @param[in] tag The tag value or @c NULL. 690 * @param[in] implicit Is the tag optional? 691 * @param[in] style The mapping style. 692 * @param[in] start_mark The beginning of the event. 693 * @param[in] end_mark The end of the event. 694 * 695 * @returns A new event object, or @c NULL on error. 696 */ 697 698 YAML_DECLARE(yaml_event_t *) 699 yaml_mapping_start_new(yaml_char_t *anchor, yaml_char_t *tag, 700 int implicit, yaml_mapping_style_t style, 701 yaml_mark_t start_mark, yaml_mark_t end_mark); 702 703 /** 704 * Create a new @c YAML_MAPPING_END_EVENT event. 705 * 706 * @param[in] start_mark The beginning of the event. 707 * @param[in] end_mark The end of the event. 708 * 709 * @returns A new event object, or @c NULL on error. 710 */ 711 712 YAML_DECLARE(yaml_event_t *) 713 yaml_mapping_end_new(yaml_mark_t start_mark, yaml_mark_t end_mark); 714 715 /** 716 * Destroy an event object. 717 * 718 * @param[in] event An event object. 719 */ 720 721 YAML_DECLARE(void) 722 yaml_event_delete(yaml_event_t *event); 723 724 /** @} */ 492 725 493 726 /**
Note: See TracChangeset
for help on using the changeset viewer.
