rapidyaml  0.16.0
parseandemitYAML,anddoitfast
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. More...
 
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 More...
 
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. More...
 
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 More...
 

Detailed Description

Function Documentation

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
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 }
Emitter< WriterBuf > EmitterBuf
Definition: emit_buf.hpp:26
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 }
Emitter< WriterBuf > EmitterBuf
Definition: emit_buf.hpp:26
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 }
Emitter< WriterBuf > EmitterBuf
Definition: emit_buf.hpp:26