rapidyaml  0.9.0
parse and emit YAML, and do it fast
Emit to file

Functions

size_t c4::yml::emit_yaml (Tree const &t, id_type id, EmitOptions const &opts, FILE *f)
 (1) emit YAML to the given file, starting at the given node. More...
 
size_t c4::yml::emit_yaml (Tree const &t, id_type id, FILE *f)
 (2) like (1), but use default emit options More...
 
size_t c4::yml::emit_json (Tree const &t, id_type id, EmitOptions const &opts, FILE *f)
 (1) emit JSON to the given file, starting at the given node. More...
 
size_t c4::yml::emit_json (Tree const &t, id_type id, FILE *f)
 (2) like (1), but use default emit options More...
 
size_t c4::yml::emit_yaml (Tree const &t, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit YAML to the given file, starting at the root node. More...
 
size_t c4::yml::emit_yaml (Tree const &t, FILE *f=nullptr)
 (2) like (1), but use default emit options More...
 
size_t c4::yml::emit_json (Tree const &t, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit JSON to the given file. More...
 
size_t c4::yml::emit_json (Tree const &t, FILE *f=nullptr)
 (2) like (1), but use default emit options More...
 
size_t c4::yml::emit_yaml (ConstNodeRef const &r, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit YAML to the given file. More...
 
size_t c4::yml::emit_yaml (ConstNodeRef const &r, FILE *f=nullptr)
 (2) like (1), but use default emit options More...
 
size_t c4::yml::emit_json (ConstNodeRef const &r, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit JSON to the given file. More...
 
size_t c4::yml::emit_json (ConstNodeRef const &r, FILE *f=nullptr)
 (2) like (1), but use default emit options More...
 

Detailed Description

Function Documentation

◆ emit_yaml() [1/6]

size_t c4::yml::emit_yaml ( Tree const &  t,
id_type  id,
EmitOptions const &  opts,
FILE *  f 
)
inline

(1) emit YAML to the given file, starting at the given node.

A null file defaults to stdout. Return the number of bytes written.

Definition at line 257 of file emit.hpp.

258 {
259  EmitterFile em(opts, f);
260  return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
261 }
Emitter< WriterFile > EmitterFile
Definition: emit.hpp:38
@ EMIT_YAML
emit YAML
Definition: emit.hpp:52

References c4::yml::Emitter< Writer >::emit_as(), and c4::yml::EMIT_YAML.

Referenced by sample::sample_emit_to_container(), sample::sample_emit_to_file(), sample::sample_lightning_overview(), and sample::sample_quick_overview().

◆ emit_yaml() [2/6]

size_t c4::yml::emit_yaml ( Tree const &  t,
id_type  id,
FILE *  f 
)
inline

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

Definition at line 263 of file emit.hpp.

264 {
265  EmitterFile em(f);
266  return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
267 }

References c4::yml::Emitter< Writer >::emit_as(), and c4::yml::EMIT_YAML.

◆ emit_json() [1/6]

size_t c4::yml::emit_json ( Tree const &  t,
id_type  id,
EmitOptions const &  opts,
FILE *  f 
)
inline

(1) emit JSON to the given file, starting at the given node.

A null file defaults to stdout. Return the number of bytes written.

Definition at line 270 of file emit.hpp.

271 {
272  EmitterFile em(opts, f);
273  return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
274 }
@ EMIT_JSON
emit JSON
Definition: emit.hpp:53

References c4::yml::Emitter< Writer >::emit_as(), and c4::yml::EMIT_JSON.

◆ emit_json() [2/6]

size_t c4::yml::emit_json ( Tree const &  t,
id_type  id,
FILE *  f 
)
inline

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

Definition at line 276 of file emit.hpp.

277 {
278  EmitterFile em(f);
279  return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
280 }

References c4::yml::Emitter< Writer >::emit_as(), and c4::yml::EMIT_JSON.

◆ emit_yaml() [3/6]

size_t c4::yml::emit_yaml ( Tree const &  t,
EmitOptions const &  opts,
FILE *  f = nullptr 
)
inline

(1) emit YAML to the given file, starting at the root node.

A null file defaults to stdout. Return the number of bytes written.

Definition at line 287 of file emit.hpp.

288 {
289  EmitterFile em(opts, f);
290  return em.emit_as(EMIT_YAML, t, /*error_on_excess*/true).len;
291 }

References c4::yml::Emitter< Writer >::emit_as(), and c4::yml::EMIT_YAML.

◆ emit_yaml() [4/6]

size_t c4::yml::emit_yaml ( Tree const &  t,
FILE *  f = nullptr 
)
inline

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

Definition at line 293 of file emit.hpp.

294 {
295  EmitterFile em(f);
296  return em.emit_as(EMIT_YAML, t, /*error_on_excess*/true).len;
297 }

References c4::yml::Emitter< Writer >::emit_as(), and c4::yml::EMIT_YAML.

◆ emit_json() [3/6]

size_t c4::yml::emit_json ( Tree const &  t,
EmitOptions const &  opts,
FILE *  f = nullptr 
)
inline

(1) emit JSON to the given file.

A null file defaults to stdout. Return the number of bytes written.

Definition at line 300 of file emit.hpp.

301 {
302  EmitterFile em(opts, f);
303  return em.emit_as(EMIT_JSON, t, /*error_on_excess*/true).len;
304 }

References c4::yml::Emitter< Writer >::emit_as(), and c4::yml::EMIT_JSON.

◆ emit_json() [4/6]

size_t c4::yml::emit_json ( Tree const &  t,
FILE *  f = nullptr 
)
inline

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

Definition at line 306 of file emit.hpp.

307 {
308  EmitterFile em(f);
309  return em.emit_as(EMIT_JSON, t, /*error_on_excess*/true).len;
310 }

References c4::yml::Emitter< Writer >::emit_as(), and c4::yml::EMIT_JSON.

◆ emit_yaml() [5/6]

size_t c4::yml::emit_yaml ( ConstNodeRef const &  r,
EmitOptions const &  opts,
FILE *  f = nullptr 
)
inline

(1) emit YAML to the given file.

A null file defaults to stdout. Return the number of bytes written.

Definition at line 317 of file emit.hpp.

318 {
319  if(!detail::is_set_(r))
320  return {};
321  EmitterFile em(opts, f);
322  return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
323 }
bool is_set_(ConstNodeRef n)
Definition: emit.hpp:42

References c4::yml::Emitter< Writer >::emit_as(), c4::yml::EMIT_YAML, and c4::yml::detail::is_set_().

◆ emit_yaml() [6/6]

size_t c4::yml::emit_yaml ( ConstNodeRef const &  r,
FILE *  f = nullptr 
)
inline

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

Definition at line 325 of file emit.hpp.

326 {
327  if(!detail::is_set_(r))
328  return {};
329  EmitterFile em(f);
330  return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
331 }

References c4::yml::Emitter< Writer >::emit_as(), c4::yml::EMIT_YAML, and c4::yml::detail::is_set_().

◆ emit_json() [5/6]

size_t c4::yml::emit_json ( ConstNodeRef const &  r,
EmitOptions const &  opts,
FILE *  f = nullptr 
)
inline

(1) emit JSON to the given file.

A null file defaults to stdout. Return the number of bytes written.

Definition at line 334 of file emit.hpp.

335 {
336  if(!detail::is_set_(r))
337  return {};
338  EmitterFile em(opts, f);
339  return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
340 }

References c4::yml::Emitter< Writer >::emit_as(), c4::yml::EMIT_JSON, and c4::yml::detail::is_set_().

◆ emit_json() [6/6]

size_t c4::yml::emit_json ( ConstNodeRef const &  r,
FILE *  f = nullptr 
)
inline

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

Definition at line 342 of file emit.hpp.

343 {
344  if(!detail::is_set_(r))
345  return {};
346  EmitterFile em(f);
347  return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
348 }

References c4::yml::Emitter< Writer >::emit_as(), c4::yml::EMIT_JSON, and c4::yml::detail::is_set_().