Function yaml_emitter_close

Synopsis

#include <include/yaml.h>

int yaml_emitter_close(yaml_emitter_t *emitter)

Description

Finish a YAML stream.

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

Parameters:

[ in,out ] emitter - An emitter object.

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

Source

Lines 85-105 in src/dumper.c. Line 1948 in include/yaml.h.

YAML_DECLARE(int)
yaml_emitter_close(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 be opened. */

    if (emitter->closed) return 1;

    STREAM_END_EVENT_INIT(event, mark, mark);

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

    emitter->closed = 1;

    return 1;
}





Add Discussion as Guest

Log in to DocsForge