rapidyaml  0.7.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 270 of file emit.hpp.

271 {
272  EmitterFile em(opts, f);
273  return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
274 }
Emitter< WriterFile > EmitterFile
Definition: emit.hpp:51
@ EMIT_YAML
emit YAML
Definition: emit.hpp:65

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 276 of file emit.hpp.

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

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 283 of file emit.hpp.

284 {
285  EmitterFile em(opts, f);
286  return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
287 }
@ EMIT_JSON
emit JSON
Definition: emit.hpp:66

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 289 of file emit.hpp.

290 {
291  EmitterFile em(f);
292  return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
293 }

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 300 of file emit.hpp.

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

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 306 of file emit.hpp.

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

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 313 of file emit.hpp.

314 {
315  EmitterFile em(opts, f);
316  return em.emit_as(EMIT_JSON, t, /*error_on_excess*/true).len;
317 }

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 319 of file emit.hpp.

320 {
321  EmitterFile em(f);
322  return em.emit_as(EMIT_JSON, t, /*error_on_excess*/true).len;
323 }

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 330 of file emit.hpp.

331 {
332  if(!detail::is_set_(r))
333  return {};
334  EmitterFile em(opts, f);
335  return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
336 }
bool is_set_(ConstNodeRef n)
Definition: emit.hpp:55

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 338 of file emit.hpp.

339 {
340  if(!detail::is_set_(r))
341  return {};
342  EmitterFile em(f);
343  return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
344 }

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 347 of file emit.hpp.

348 {
349  if(!detail::is_set_(r))
350  return {};
351  EmitterFile em(opts, f);
352  return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
353 }

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 355 of file emit.hpp.

356 {
357  if(!detail::is_set_(r))
358  return {};
359  EmitterFile em(f);
360  return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
361 }

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