rapidyaml  0.11.1
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 415 of file emit.hpp.

416 {
417  EmitterFile em(opts, f);
418  return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
419 }
Emitter< WriterFile > EmitterFile
Definition: emit.hpp:38
@ EMIT_YAML
emit YAML
Definition: emit.hpp:48

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

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

422 {
423  EmitterFile em(f);
424  return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
425 }

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

429 {
430  EmitterFile em(opts, f);
431  return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
432 }
@ EMIT_JSON
emit JSON
Definition: emit.hpp:49

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

435 {
436  EmitterFile em(f);
437  return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
438 }

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

446 {
447  EmitterFile em(opts, f);
448  return em.emit_as(EMIT_YAML, t, /*error_on_excess*/true).len;
449 }

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

452 {
453  EmitterFile em(f);
454  return em.emit_as(EMIT_YAML, t, /*error_on_excess*/true).len;
455 }

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

459 {
460  EmitterFile em(opts, f);
461  return em.emit_as(EMIT_JSON, t, /*error_on_excess*/true).len;
462 }

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

465 {
466  EmitterFile em(f);
467  return em.emit_as(EMIT_JSON, t, /*error_on_excess*/true).len;
468 }

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

476 {
477  if(!r.readable())
478  return {};
479  EmitterFile em(opts, f);
480  return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
481 }

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

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

484 {
485  if(!r.readable())
486  return {};
487  EmitterFile em(f);
488  return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
489 }

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

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

493 {
494  if(!r.readable())
495  return {};
496  EmitterFile em(opts, f);
497  return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
498 }

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

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

501 {
502  if(!r.readable())
503  return {};
504  EmitterFile em(f);
505  return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
506 }

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