Ruby
2.0.0p247(2013-06-27revision41674)
|
typedef enum yaml_emitter_state_e yaml_emitter_state_t |
The emitter states.
typedef struct yaml_emitter_s yaml_emitter_t |
The emitter structure.
All members are internal. Manage the structure using the yaml_emitter_
family of functions.
typedef int yaml_write_handler_t(void *data, unsigned char *buffer, size_t size) |
The prototype of a write handler.
The write handler is called when the emitter needs to flush the accumulated characters to the output. The handler should write size bytes of the buffer to the output.
[in,out] | data | A pointer to an application data specified by yaml_emitter_set_output(). |
[in] | buffer | The buffer with bytes to be written. |
[in] | size | The size of the buffer. |
1
. If the handler failed, the returned value should be 0
. enum yaml_emitter_state_e |
The emitter states.
yaml_emitter_close | ( | yaml_emitter_t * | emitter | ) |
Finish a YAML stream.
This function should be used after yaml_emitter_dump() is called.
[in,out] | emitter | An emitter object. |
1
if the function succeeded, 0
on error. Definition at line 86 of file dumper.c.
References assert, mark(), STREAM_END_EVENT_INIT, and yaml_emitter_emit().
Referenced by yaml_emitter_dump().
yaml_emitter_delete | ( | yaml_emitter_t * | emitter | ) |
Destroy an emitter.
[in,out] | emitter | An emitter object. |
Definition at line 386 of file api.c.
References assert, BUFFER_DEL, DEQUEUE, yaml_tag_directive_s::handle, POP, yaml_tag_directive_s::prefix, QUEUE_DEL, QUEUE_EMPTY, STACK_DEL, STACK_EMPTY, yaml_event_delete(), and yaml_free().
Referenced by dealloc().
yaml_emitter_dump | ( | yaml_emitter_t * | emitter, |
yaml_document_t * | document | ||
) |
Emit a YAML document.
The documen object may be generated using the yaml_parser_load() function or the yaml_document_initialize() function. The emitter takes the responsibility for the document object and destoys its content after it is emitted. The document object is destroyedeven if the function fails.
[in,out] | emitter | An emitter object. |
[in,out] | document | A document object. |
1
if the function succeeded, 0
on error. Definition at line 112 of file dumper.c.
References assert, DOCUMENT_END_EVENT_INIT, DOCUMENT_START_EVENT_INIT, mark(), STACK_EMPTY, yaml_event_s::version_directive, yaml_emitter_anchor_node(), yaml_emitter_close(), yaml_emitter_delete_document_and_anchors(), yaml_emitter_dump_node(), yaml_emitter_emit(), yaml_emitter_open(), and yaml_malloc().
yaml_emitter_emit | ( | yaml_emitter_t * | emitter, |
yaml_event_t * | event | ||
) |
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.
[in,out] | emitter | An emitter object. |
[in,out] | event | An event object. |
1
if the function succeeded, 0
on error. Definition at line 281 of file emitter.c.
References DEQUEUE, ENQUEUE, yaml_emitter_analyze_event(), yaml_emitter_need_more_events(), yaml_emitter_state_machine(), and yaml_event_delete().
Referenced by emit(), yaml_emitter_close(), yaml_emitter_dump(), yaml_emitter_dump_alias(), yaml_emitter_dump_mapping(), yaml_emitter_dump_scalar(), yaml_emitter_dump_sequence(), and yaml_emitter_open().
yaml_emitter_flush | ( | yaml_emitter_t * | emitter | ) |
Flush the accumulated characters to the output.
[in,out] | emitter | An emitter object. |
1
if the function succeeded, 0
on error. Definition at line 32 of file writer.c.
References assert, yaml_emitter_set_writer_error(), YAML_UTF16LE_ENCODING, and YAML_UTF8_ENCODING.
Referenced by yaml_emitter_emit_document_end(), and yaml_emitter_emit_document_start().
yaml_emitter_initialize | ( | yaml_emitter_t * | emitter | ) |
Initialize an emitter.
This function creates a new emitter object. An application is responsible for destroying the object using the yaml_emitter_delete() function.
[out] | emitter | An empty parser object. |
1
if the function succeeded, 0
on error. Definition at line 349 of file api.c.
References assert, BUFFER_DEL, BUFFER_INIT, INITIAL_QUEUE_SIZE, INITIAL_STACK_SIZE, OUTPUT_BUFFER_SIZE, OUTPUT_RAW_BUFFER_SIZE, QUEUE_DEL, QUEUE_INIT, STACK_DEL, and STACK_INIT.
Referenced by allocate().
yaml_emitter_open | ( | yaml_emitter_t * | emitter | ) |
Start a YAML stream.
This function should be used before yaml_emitter_dump() is called.
[in,out] | emitter | An emitter object. |
1
if the function succeeded, 0
on error. Definition at line 62 of file dumper.c.
References assert, mark(), STREAM_START_EVENT_INIT, YAML_ANY_ENCODING, and yaml_emitter_emit().
Referenced by yaml_emitter_dump().
yaml_emitter_set_break | ( | yaml_emitter_t * | emitter, |
yaml_break_t | line_break | ||
) |
yaml_emitter_set_canonical | ( | yaml_emitter_t * | emitter, |
int | canonical | ||
) |
Set if the output should be in the "canonical" format as in the YAML specification.
[in,out] | emitter | An emitter object. |
[in] | canonical | If the output is canonical. |
Definition at line 518 of file api.c.
References assert.
Referenced by initialize(), and set_canonical().
yaml_emitter_set_encoding | ( | yaml_emitter_t * | emitter, |
yaml_encoding_t | encoding | ||
) |
yaml_emitter_set_indent | ( | yaml_emitter_t * | emitter, |
int | indent | ||
) |
Set the intendation increment.
[in,out] | emitter | An emitter object. |
[in] | indent | The indentation increment (1 < . < 10). |
Definition at line 530 of file api.c.
References assert.
Referenced by allocate(), initialize(), and set_indentation().
yaml_emitter_set_output | ( | yaml_emitter_t * | emitter, |
yaml_write_handler_t * | handler, | ||
void * | data | ||
) |
Set a generic output handler.
[in,out] | emitter | An emitter object. |
[in] | handler | A write handler. |
[in] | data | Any application data for passing to the write handler. |
Definition at line 489 of file api.c.
References assert.
Referenced by initialize().
yaml_emitter_set_output_file | ( | yaml_emitter_t * | emitter, |
FILE * | file | ||
) |
Set a file output.
file should be a file object open for writing. The application is responsible for closing the file.
[in,out] | emitter | An emitter object. |
[in] | file | An open file. |
Definition at line 472 of file api.c.
References assert, and yaml_file_write_handler().
yaml_emitter_set_output_string | ( | yaml_emitter_t * | emitter, |
unsigned char * | output, | ||
size_t | size, | ||
size_t * | size_written | ||
) |
Set a string output.
The emitter will write the output characters to the output buffer of the size size. The emitter will set size_written to the number of written bytes. If the buffer is smaller than required, the emitter produces the YAML_WRITE_ERROR error.
[in,out] | emitter | An emitter object. |
[in] | output | An output buffer. |
[in] | size | The buffer size. |
[in] | size_written | The pointer to save the number of written bytes. |
Definition at line 451 of file api.c.
References assert, output, size, and yaml_string_write_handler().
yaml_emitter_set_unicode | ( | yaml_emitter_t * | emitter, |
int | unicode | ||
) |
Set if unescaped non-ASCII characters are allowed.
[in,out] | emitter | An emitter object. |
[in] | unicode | If unescaped Unicode characters are allowed. |
Definition at line 554 of file api.c.
References assert.
Referenced by allocate().
yaml_emitter_set_width | ( | yaml_emitter_t * | emitter, |
int | width | ||
) |
Set the preferred line width.
-1
means unlimited.
[in,out] | emitter | An emitter object. |
[in] | width | The preferred line width. |
Definition at line 542 of file api.c.
References assert.
Referenced by initialize(), and set_line_width().