Function yaml_emitter_open

Synopsis

#include <include/yaml.h>

int yaml_emitter_open(yaml_emitter_t *emitter)

Description

Start a YAML stream.

This function should be used before yaml_emitter_dump() is called.

Parameters:

[ in,out ] emitter - An emitter object.

Return
1 if the function succeeded, 0 on error.
Issue a STREAM-START event.

API functions.

Issue a STREAM-START event.

Source

Lines 61-79 in src/dumper.c. Line 1935 in include/yaml.h.

YAML_DECLARE(int)
yaml_emitter_open(yaml_emitter_t *emitter)
{
    yaml_event_t event;
    yaml_mark_t mark = { 0, 0, 0 };

    assert(emitter);            /* Non-NULL emitter object is required. */
    assert(!emitter->opened);   /* Emitter should not be opened yet. */

    STREAM_START_EVENT_INIT(event, YAML_ANY_ENCODING, mark, mark);

    if (!yaml_emitter_emit(emitter, &event)) {
        return 0;
    }

    emitter->opened = 1;

    return 1;
}





Add Discussion as Guest

Log in to DocsForge