Function yaml_document_get_root_node

Synopsis

#include <include/yaml.h>

yaml_node_t * yaml_document_get_root_node(yaml_document_t *document)

Description

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.

Return
the node object or NULL if the document is empty.
Get the root object.

Source

Lines 1179-1188 in src/api.c. Line 881 in include/yaml.h.

YAML_DECLARE(yaml_node_t *)
yaml_document_get_root_node(yaml_document_t *document)
{
    assert(document);   /* Non-NULL document object is expected. */

    if (document->nodes.top != document->nodes.start) {
        return document->nodes.start;
    }
    return NULL;
}





Add Discussion as Guest

Log in to DocsForge