Function yaml_emitter_emit

Synopsis

#include <include/yaml.h>

int yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event)

Description

Emit an event.

The event object may be generated using the yaml_parser_parse() function. The emitter takes the responsibility for the event object and destroys its content after it is emitted. The event object is destroyed even if the function fails.

Parameters:

[ in,out ] emitter - An emitter object.

[ in,out ] event - An event object.

Return
1 if the function succeeded, 0 on error.
Emit an event.

API functions.

Emit an event.

Mentioned in

Source

Lines 280-297 in src/emitter.c. Line 1922 in include/yaml.h.

YAML_DECLARE(int)
yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event)
{
    if (!ENQUEUE(emitter, emitter->events, *event)) {
        yaml_event_delete(event);
        return 0;
    }

    while (!yaml_emitter_need_more_events(emitter)) {
        if (!yaml_emitter_analyze_event(emitter, emitter->events.head))
            return 0;
        if (!yaml_emitter_state_machine(emitter, emitter->events.head))
            return 0;
        yaml_event_delete(&DEQUEUE(emitter, emitter->events));
    }

    return 1;
}





Add Discussion as Guest

Log in to DocsForge