rapidyaml  0.16.0
parseandemitYAML,anddoitfast

Functions

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

Detailed Description

Function Documentation

substr c4::yml::emit_yaml ( Tree const &  t,
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; will be emitted from the root node.
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. For example usage, see emitrs_yaml() .

Definition at line 28 of file emit_buf.cpp.

Referenced by c4::yml::emitrs_yaml(), sample_emit_to_container(), sample_emit_to_file(), sample_lightning_overview(), and sample_quick_overview().

29 {
30  EmitterBuf em(opts, buf);
31  em.emit_as(EMIT_YAML, &t);
32  return em.get_result(error_on_excess);
33 }
Emitter< WriterBuf > EmitterBuf
Definition: emit_buf.hpp:26
substr c4::yml::emit_yaml ( Tree const &  t,
substr  buf,
bool  error_on_excess 
)

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

Definition at line 35 of file emit_buf.cpp.

36 {
37  EmitterBuf em(EmitOptions{}, buf);
38  em.emit_as(EMIT_YAML, &t);
39  return em.get_result(error_on_excess);
40 }
Emitter< WriterBuf > EmitterBuf
Definition: emit_buf.hpp:26
substr c4::yml::emit_json ( Tree const &  t,
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; will be emitted from the root node.
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 42 of file emit_buf.cpp.

Referenced by c4::yml::emitrs_json().

43 {
44  EmitterBuf em(opts, buf);
45  em.emit_as(EMIT_JSON, &t);
46  return em.get_result(error_on_excess);
47 }
Emitter< WriterBuf > EmitterBuf
Definition: emit_buf.hpp:26
substr c4::yml::emit_json ( Tree const &  t,
substr  buf,
bool  error_on_excess 
)

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

Definition at line 49 of file emit_buf.cpp.

50 {
51  EmitterBuf em(EmitOptions{}, buf);
52  em.emit_as(EMIT_JSON, &t);
53  return em.get_result(error_on_excess);
54 }
Emitter< WriterBuf > EmitterBuf
Definition: emit_buf.hpp:26