rapidyaml 0.14.0
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
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.
size_t c4::yml::emit_yaml (Tree const &t, id_type id, FILE *f)
 (2) like (1), but use default emit options
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.
size_t c4::yml::emit_json (Tree const &t, id_type id, FILE *f)
 (2) like (1), but use default emit options
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.
size_t c4::yml::emit_yaml (Tree const &t, FILE *f=nullptr)
 (2) like (1), but use default emit options
size_t c4::yml::emit_json (Tree const &t, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit JSON to the given file.
size_t c4::yml::emit_json (Tree const &t, FILE *f=nullptr)
 (2) like (1), but use default emit options
size_t c4::yml::emit_yaml (ConstNodeRef const &r, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit YAML to the given file.
size_t c4::yml::emit_yaml (ConstNodeRef const &r, FILE *f=nullptr)
 (2) like (1), but use default emit options
size_t c4::yml::emit_json (ConstNodeRef const &r, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit JSON to the given file.
size_t c4::yml::emit_json (ConstNodeRef const &r, FILE *f=nullptr)
 (2) like (1), but use default emit options

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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