Function yaml_document_append_sequence_item

Synopsis

#include <include/yaml.h>

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

Description

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.

Return
1 if the function succeeded, 0 on error.
Append an item to a sequence node.

Source

Lines 1334-1356 in src/api.c. Line 945 in include/yaml.h.

YAML_DECLARE(int)
yaml_document_append_sequence_item(yaml_document_t *document,
        int sequence, int item)
{
    struct {
        yaml_error_type_t error;
    } context;

    assert(document);       /* Non-NULL document is required. */
    assert(sequence > 0
            && document->nodes.start + sequence <= document->nodes.top);
                            /* Valid sequence id is required. */
    assert(document->nodes.start[sequence-1].type == YAML_SEQUENCE_NODE);
                            /* A sequence node is required. */
    assert(item > 0 && document->nodes.start + item <= document->nodes.top);
                            /* Valid item id is required. */

    if (!PUSH(&context,
                document->nodes.start[sequence-1].data.sequence.items, item))
        return 0;

    return 1;
}





Add Discussion as Guest

Log in to DocsForge