Public API

Export Definitions


The public API declaration.

Version Information

yaml_get_version_stringGet the library version as a string.
yaml_get_versionGet the library version numbers.

Basic Types

typedef unsigned char yaml_char_t

The character type (UTF-8 octet).

yaml_version_directive_tThe version directive data.
yaml_tag_directive_tThe tag directive data.
yaml_encoding_tThe stream encoding.
yaml_break_tLine break types.
yaml_error_type_tMany bad things could happen with the parser and emitter.
yaml_mark_tThe pointer position.

Node Styles

yaml_scalar_style_tScalar styles.
yaml_sequence_style_tSequence styles.
yaml_mapping_style_tMapping styles.


yaml_token_type_tToken types.
yaml_token_tThe token structure.
yaml_token_deleteFree any memory allocated for a token object.


yaml_event_type_tEvent types.
yaml_event_tThe event structure.
yaml_stream_start_event_initializeCreate the STREAM-START event.
yaml_stream_end_event_initializeCreate the STREAM-END event.
yaml_document_start_event_initializeCreate the DOCUMENT-START event.
yaml_document_end_event_initializeCreate the DOCUMENT-END event.
yaml_alias_event_initializeCreate an ALIAS event.
yaml_scalar_event_initializeCreate a SCALAR event.
yaml_sequence_start_event_initializeCreate a SEQUENCE-START event.
yaml_sequence_end_event_initializeCreate a SEQUENCE-END event.
yaml_mapping_start_event_initializeCreate a MAPPING-START event.
yaml_mapping_end_event_initializeCreate a MAPPING-END event.
yaml_event_deleteFree any memory allocated for an event object.


YAML_NULL_TAG ",2002:null"

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

YAML_BOOL_TAG ",2002:bool"

The tag !!bool with the values: true and false.

YAML_STR_TAG ",2002:str"

The tag !!str for string values.

YAML_INT_TAG ",2002:int"

The tag !!int for integer values.

YAML_FLOAT_TAG ",2002:float"

The tag !!float for float values.

YAML_TIMESTAMP_TAG ",2002:timestamp"

The tag !!timestamp for date and time values.

YAML_SEQ_TAG ",2002:seq"

The tag !!seq is used to denote sequences.

YAML_MAP_TAG ",2002:map"

The tag !!map is used to denote mapping.


The default scalar tag is !!str.


The default sequence tag is !!seq.


The default mapping tag is !!map.

yaml_node_type_tNode types.

typedef int yaml_node_item_t

An element of a sequence node.

yaml_node_pair_tAn element of a mapping node.
yaml_node_sThe node structure.
yaml_document_tThe document structure.
yaml_document_initializeCreate a YAML document.
yaml_document_deleteDelete a YAML document and all its nodes.
yaml_document_get_nodeGet a node of a YAML document.
yaml_document_get_root_nodeGet the root of a YAML document node.
yaml_document_add_scalarCreate a SCALAR node and attach it to the document.
yaml_document_add_sequenceCreate a SEQUENCE node and attach it to the document.
yaml_document_add_mappingCreate a MAPPING node and attach it to the document.
yaml_document_append_sequence_itemAdd an item to a SEQUENCE node.
yaml_document_append_mapping_pairAdd a pair of a key and a value to a MAPPING node.

Parser Definitions

typedef int yaml_read_handler_t(void *data, unsigned char *buffer, size_t size, size_t *size_read)

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.


[ in,out ] data - A pointer to an application data specified by yaml_parser_set_input().

[ out ] buffer - The buffer to write the data from the source.

[ in ] size - The size of the buffer.

[ out ] size_read - The actual number of bytes read from the source.

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.
yaml_simple_key_tThis structure holds information about a potential simple key.
yaml_parser_state_tThe states of the parser.
yaml_alias_data_tThis structure holds aliases data.
yaml_parser_tThe parser structure.
yaml_parser_initializeInitialize a parser.
yaml_parser_deleteDestroy a parser.
yaml_parser_set_input_stringSet a string input.
yaml_parser_set_input_fileSet a file input.
yaml_parser_set_inputSet a generic input handler.
yaml_parser_set_encodingSet the source encoding.
yaml_parser_scanScan the input stream and produce the next token.
yaml_parser_parseParse the input stream and produce the next parsing event.
yaml_parser_loadParse the input stream and produce the next YAML document.

Emitter Definitions

typedef int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size)

The prototype of a write handler.

The write handler is called when the emitter needs to flush the accumulated characters to the output. The handler should write size bytes of the buffer to the output.


[ in,out ] data - A pointer to an application data specified by yaml_emitter_set_output().

[ in ] buffer - The buffer with bytes to be written.

[ in ] size - The size of the buffer.

On success, the handler should return 1. If the handler failed, the returned value should be 0.
yaml_emitter_state_tThe emitter states.
yaml_anchors_tThis is needed for C++
yaml_emitter_tThe emitter structure.
yaml_emitter_initializeInitialize an emitter.
yaml_emitter_deleteDestroy an emitter.
yaml_emitter_set_output_stringSet a string output.
yaml_emitter_set_output_fileSet a file output.
yaml_emitter_set_outputSet a generic output handler.
yaml_emitter_set_encodingSet the output encoding.
yaml_emitter_set_canonicalSet if the output should be in the "canonical" format as in the YAML specification.
yaml_emitter_set_indentSet the indentation increment.
yaml_emitter_set_widthSet the preferred line width
yaml_emitter_set_unicodeSet if unescaped non-ASCII characters are allowed.
yaml_emitter_set_breakSet the preferred line break.
yaml_emitter_emitEmit an event.
yaml_emitter_openStart a YAML stream.
yaml_emitter_closeFinish a YAML stream.
yaml_emitter_dumpEmit a YAML document.
yaml_emitter_flushFlush the accumulated characters to the output.

Add Discussion as Guest

Log in