Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Macros | Typedefs | Enumerations | Functions
Nodes

## Data Structures
struct | yaml_node_pair_s
| An element of a mapping node. More...
struct | yaml_node_s
| The node structure. More...
struct | yaml_document_s
| The document structure. More...

## Macros
#define | YAML_NULL_TAG "tag:yaml.org,2002:null"
| The tag `!!null` with the only possible value: `null`. More...
#define | YAML_BOOL_TAG "tag:yaml.org,2002:bool"
| The tag `!!bool` with the values: `true` and `falce`. More...
#define | YAML_STR_TAG "tag:yaml.org,2002:str"
| The tag `!!str` for string values. More...
#define | YAML_INT_TAG "tag:yaml.org,2002:int"
| The tag `!!int` for integer values. More...
#define | YAML_FLOAT_TAG "tag:yaml.org,2002:float"
| The tag `!!float` for float values. More...
#define | YAML_TIMESTAMP_TAG "tag:yaml.org,2002:timestamp"
| The tag `!!timestamp` for date and time values. More...
#define | YAML_SEQ_TAG "tag:yaml.org,2002:seq"
| The tag `!!seq` is used to denote sequences. More...
#define | YAML_MAP_TAG "tag:yaml.org,2002:map"
| The tag `!!map` is used to denote mapping. More...
#define | YAML_DEFAULT_SCALAR_TAG YAML_STR_TAG
| The default scalar tag is `!!str`. More...
#define | YAML_DEFAULT_SEQUENCE_TAG YAML_SEQ_TAG
| The default sequence tag is `!!seq`. More...
#define | YAML_DEFAULT_MAPPING_TAG YAML_MAP_TAG
| The default mapping tag is `!!map`. More...

## Typedefs
typedef enum yaml_node_type_e | yaml_node_type_t
| Node types. More...
typedef struct yaml_node_s | yaml_node_t
| The forward definition of a document node structure. More...
typedef int | yaml_node_item_t
| An element of a sequence node. More...
typedef struct yaml_node_pair_s | yaml_node_pair_t
| An element of a mapping node. More...
typedef struct yaml_document_s | yaml_document_t
| The document structure. More...

## Enumerations
enum | yaml_node_type_e { YAML_NO_NODE, YAML_SCALAR_NODE, YAML_SEQUENCE_NODE, YAML_MAPPING_NODE }
| Node types. More...

## Functions
| yaml_document_initialize (yaml_document_t *document, yaml_version_directive_t *version_directive, yaml_tag_directive_t *tag_directives_start, yaml_tag_directive_t *tag_directives_end, int start_implicit, int end_implicit)
| Create a YAML document. More...
| yaml_document_delete (yaml_document_t *document)
| Delete a YAML document and all its nodes. More...
| yaml_document_get_node (yaml_document_t *document, int index)
| Get a node of a YAML document. More...
| yaml_document_get_root_node (yaml_document_t *document)
| Get the root of a YAML document node. More...
| yaml_document_add_scalar (yaml_document_t *document, yaml_char_t *tag, yaml_char_t *value, int length, yaml_scalar_style_t style)
| Create a SCALAR node and attach it to the document. More...
| yaml_document_add_sequence (yaml_document_t *document, yaml_char_t *tag, yaml_sequence_style_t style)
| Create a SEQUENCE node and attach it to the document. More...
| yaml_document_add_mapping (yaml_document_t *document, yaml_char_t *tag, yaml_mapping_style_t style)
| Create a MAPPING node and attach it to the document. More...
| yaml_document_append_sequence_item (yaml_document_t *document, int sequence, int item)
| Add an item to a SEQUENCE node. More...
| yaml_document_append_mapping_pair (yaml_document_t *document, int mapping, int key, int value)
| Add a pair of a key and a value to a MAPPING node. More...

## Detailed Description

## Macro Definition Documentation

#define YAML_BOOL_TAG "tag:yaml.org,2002:bool"

The tag `!!bool` with the values: `true` and `falce`.

Definition at line 667 of file yaml.h.

#define YAML_DEFAULT_MAPPING_TAG YAML_MAP_TAG

The default mapping tag is `!!map`.

Definition at line 687 of file yaml.h.

Referenced by yaml_document_add_mapping(), yaml_emitter_dump_mapping(), and yaml_parser_load_mapping().

#define YAML_DEFAULT_SCALAR_TAG YAML_STR_TAG

The default scalar tag is `!!str`.

Definition at line 683 of file yaml.h.

Referenced by yaml_document_add_scalar(), yaml_emitter_dump_scalar(), and yaml_parser_load_scalar().

#define YAML_DEFAULT_SEQUENCE_TAG YAML_SEQ_TAG

The default sequence tag is `!!seq`.

Definition at line 685 of file yaml.h.

Referenced by yaml_document_add_sequence(), yaml_emitter_dump_sequence(), and yaml_parser_load_sequence().

#define YAML_FLOAT_TAG "tag:yaml.org,2002:float"

The tag `!!float` for float values.

Definition at line 673 of file yaml.h.

#define YAML_INT_TAG "tag:yaml.org,2002:int"

The tag `!!int` for integer values.

Definition at line 671 of file yaml.h.

#define YAML_MAP_TAG "tag:yaml.org,2002:map"

The tag `!!map` is used to denote mapping.

Definition at line 680 of file yaml.h.

#define YAML_NULL_TAG "tag:yaml.org,2002:null"

The tag `!!null` with the only possible value: `null`.

Definition at line 665 of file yaml.h.

#define YAML_SEQ_TAG "tag:yaml.org,2002:seq"

The tag `!!seq` is used to denote sequences.

Definition at line 678 of file yaml.h.

#define YAML_STR_TAG "tag:yaml.org,2002:str"

The tag `!!str` for string values.

Definition at line 669 of file yaml.h.

#define YAML_TIMESTAMP_TAG "tag:yaml.org,2002:timestamp"

The tag `!!timestamp` for date and time values.

Definition at line 675 of file yaml.h.

## Typedef Documentation

typedef struct yaml_document_s yaml_document_t

The document structure.

typedef int yaml_node_item_t

An element of a sequence node.

Definition at line 706 of file yaml.h.

typedef struct yaml_node_pair_s yaml_node_pair_t

An element of a mapping node.

typedef struct yaml_node_s yaml_node_t

The forward definition of a document node structure.

Definition at line 703 of file yaml.h.

typedef enum yaml_node_type_e yaml_node_type_t

Node types.

## Enumeration Type Documentation

enum yaml_node_type_e

Node types.

Enumerator
YAML_NO_NODE | An empty node.
YAML_SCALAR_NODE | A scalar node.
YAML_SEQUENCE_NODE | A sequence node.
YAML_MAPPING_NODE | A mapping node.

Definition at line 690 of file yaml.h.

## Function Documentation

yaml_document_add_mapping | ( | yaml_document_t * | document,
|  | yaml_char_t * | tag,
|  | yaml_mapping_style_t | style
| ) |  |

Create a MAPPING node and attach it to the document.

The style argument may be ignored by the emitter.

Parameters

  [in,out] | document | A document object.
  [in] | tag | The sequence tag.
  [in] | style | The sequence style.

Returns
  the node id or `0` on error.

Definition at line 1289 of file api.c.

References assert, end, INITIAL_STACK_SIZE, MAPPING_NODE_INIT, mark(), NULL, PUSH, STACK_DEL, STACK_INIT, yaml_node_s::start, strlen(), top, yaml_check_utf8(), YAML_DEFAULT_MAPPING_TAG, yaml_free(), and yaml_strdup().

yaml_document_add_scalar | ( | yaml_document_t * | document,
|  | yaml_char_t * | tag,
|  | yaml_char_t * | value,
|  | int | length,
|  | yaml_scalar_style_t | style
| ) |  |

Create a SCALAR node and attach it to the document.

The style argument may be ignored by the emitter.

Parameters

  [in,out] | document | A document object.
  [in] | tag | The scalar tag.
  [in] | value | The scalar value.
  [in] | length | The length of the scalar value.
  [in] | style | The scalar style.

Returns
  the node id or `0` on error.

Definition at line 1194 of file api.c.

References assert, length, mark(), memcpy(), NULL, PUSH, SCALAR_NODE_INIT, strlen(), yaml_check_utf8(), YAML_DEFAULT_SCALAR_TAG, yaml_free(), yaml_malloc(), and yaml_strdup().

yaml_document_add_sequence | ( | yaml_document_t * | document,
|  | yaml_char_t * | tag,
|  | yaml_sequence_style_t | style
| ) |  |

Create a SEQUENCE node and attach it to the document.

The style argument may be ignored by the emitter.

Parameters

  [in,out] | document | A document object.
  [in] | tag | The sequence tag.
  [in] | style | The sequence style.

Returns
  the node id or `0` on error.

Definition at line 1244 of file api.c.

References assert, end, INITIAL_STACK_SIZE, mark(), NULL, PUSH, SEQUENCE_NODE_INIT, STACK_DEL, STACK_INIT, yaml_node_s::start, strlen(), top, yaml_check_utf8(), YAML_DEFAULT_SEQUENCE_TAG, yaml_free(), and yaml_strdup().

yaml_document_append_mapping_pair | ( | yaml_document_t * | document,
|  | int | mapping,
|  | int | key,
|  | int | value
| ) |  |

Add a pair of a key and a value to a MAPPING node.

Parameters

  [in,out] | document | A document object.
  [in] | mapping | The mapping node id.
  [in] | key | The key node id.
  [in] | value | The value node id.

Returns
  `1` if the function succeeded, `0` on error.

Definition at line 1362 of file api.c.

References assert, key, yaml_node_pair_s::key, pair, PUSH, yaml_node_pair_s::value, value, and YAML_MAPPING_NODE.

yaml_document_append_sequence_item | ( | yaml_document_t * | document,
|  | int | sequence,
|  | int | item
| ) |  |

Add an item to a SEQUENCE node.

Parameters

  [in,out] | document | A document object.
  [in] | sequence | The sequence node id.
  [in] | item | The item node id.

Returns
  `1` if the function succeeded, `0` on error.

Definition at line 1334 of file api.c.

References assert, PUSH, and YAML_SEQUENCE_NODE.

yaml_document_delete | ( | yaml_document_t * | document | ) |

Delete a YAML document and all its nodes.

Parameters

  [in,out] | document | A document object.

Definition at line 1117 of file api.c.

References assert, yaml_node_s::data, yaml_tag_directive_s::handle, yaml_node_s::mapping, memset(), POP, yaml_tag_directive_s::prefix, yaml_node_s::scalar, yaml_node_s::sequence, STACK_DEL, STACK_EMPTY, yaml_node_s::tag, yaml_node_s::type, yaml_free(), YAML_MAPPING_NODE, YAML_NO_ERROR, YAML_SCALAR_NODE, and YAML_SEQUENCE_NODE.

Referenced by yaml_emitter_delete_document_and_anchors(), and yaml_parser_load().

yaml_document_get_node | ( | yaml_document_t * | document,
|  | int | index
| ) |  |

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.

Parameters

  [in] | document | A document object.
  [in] | index | The node id.

Returns
  the node objct or `NULL` if `node_id` is out of range.

Get a node of a YAML document.

Definition at line 1164 of file api.c.

References assert, and NULL.

yaml_document_get_root_node | ( | yaml_document_t * | document | ) |

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.

Parameters

  [in] | document | A document object.

Returns
  the node object or `NULL` if the document is empty.

Get the root of a YAML document node.

Definition at line 1179 of file api.c.

References assert, and NULL.

yaml_document_initialize | ( | yaml_document_t * | document,
|  | yaml_version_directive_t * | version_directive,
|  | yaml_tag_directive_t * | tag_directives_start,
|  | yaml_tag_directive_t * | tag_directives_end,
|  | int | start_implicit,
|  | int | end_implicit
| ) |  |

Create a YAML document.

Parameters

  [out] | document | An empty document object.
  [in] | version_directive | The YAML directive value or `NULL`.
  [in] | tag_directives_start | The beginning of the TAG directives list.
  [in] | tag_directives_end | The end of the TAG directives list.
  [in] | start_implicit | If the document start indicator is implicit.
  [in] | end_implicit | If the document end indicator is implicit.

Returns
  `1` if the function succeeded, `0` on error.

Definition at line 1030 of file api.c.

References assert, DOCUMENT_INIT, end, yaml_tag_directive_s::handle, INITIAL_STACK_SIZE, yaml_version_directive_s::major, mark(), yaml_version_directive_s::minor, NULL, POP, yaml_tag_directive_s::prefix, PUSH, STACK_DEL, STACK_EMPTY, STACK_INIT, strlen(), top, value, yaml_check_utf8(), yaml_free(), yaml_malloc(), and yaml_strdup().