rapidyaml 0.15.2
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
Emit from nested node id

Functions

substr c4::yml::emit_yaml (Tree const &t, id_type id, EmitOptions const &opts, substr buf, bool error_on_excess=true)
 (1) emit YAML to the given buffer.
substr c4::yml::emit_yaml (Tree const &t, id_type id, substr buf, bool error_on_excess=true)
 (2) like (1), but use default emit options
substr c4::yml::emit_json (Tree const &t, id_type id, EmitOptions const &opts, substr buf, bool error_on_excess=true)
 (1) emit JSON to the given buffer.
substr c4::yml::emit_json (Tree const &t, id_type id, substr buf, bool error_on_excess=true)
 (2) like (1), but use default emit options

Detailed Description

Function Documentation

◆ emit_yaml() [1/2]

substr c4::yml::emit_yaml ( Tree const & t,
id_type id,
EmitOptions const & opts,
substr buf,
bool error_on_excess = true )

(1) emit YAML to the given buffer.

Return a substr trimmed to the emitted YAML.

Parameters
tthe tree to emit.
idthe node where to start emitting.
optsemit options.
bufthe output buffer.
error_on_excessRaise an error if the space in the buffer is insufficient.
Returns
a substr trimmed to the result in the output buffer. If the buffer is insufficient (when error_on_excess is false), the string pointer of the result will be set to null, and the length will report the required buffer size.

Definition at line 59 of file emit_buf.cpp.

60{
61 EmitterBuf em(opts, buf);
62 em.emit_as(EMIT_YAML, &t, id);
63 return em.get_result(error_on_excess);
64}
Emitter< WriterBuf > EmitterBuf
Definition emit_buf.hpp:26

◆ emit_yaml() [2/2]

substr c4::yml::emit_yaml ( Tree const & t,
id_type id,
substr buf,
bool error_on_excess )

(2) like (1), but use default emit options

Definition at line 66 of file emit_buf.cpp.

67{
68 EmitterBuf em(EmitOptions{}, buf);
69 em.emit_as(EMIT_YAML, &t, id);
70 return em.get_result(error_on_excess);
71}
A lightweight object containing options to be used when emitting.

◆ emit_json() [1/2]

substr c4::yml::emit_json ( Tree const & t,
id_type id,
EmitOptions const & opts,
substr buf,
bool error_on_excess = true )

(1) emit JSON to the given buffer.

Return a substr trimmed to the emitted JSON.

Parameters
tthe tree to emit.
idthe node where to start emitting.
optsemit options.
bufthe output buffer.
error_on_excessRaise an error if the space in the buffer is insufficient.
Returns
a substr trimmed to the result in the output buffer. If the buffer is insufficient (when error_on_excess is false), the string pointer of the result will be set to null, and the length will report the required buffer size.

Definition at line 73 of file emit_buf.cpp.

74{
75 EmitterBuf em(opts, buf);
76 em.emit_as(EMIT_JSON, &t, id);
77 return em.get_result(error_on_excess);
78}

◆ emit_json() [2/2]

substr c4::yml::emit_json ( Tree const & t,
id_type id,
substr buf,
bool error_on_excess )

(2) like (1), but use default emit options

Definition at line 80 of file emit_buf.cpp.

81{
82 EmitterBuf em(EmitOptions{}, buf);
83 em.emit_as(EMIT_JSON, &t, id);
84 return em.get_result(error_on_excess);
85}