rapidyaml 0.15.1
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 528 of file emit.hpp.

529{
530 EmitterFile em(opts, f);
531 return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
532}
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 534 of file emit.hpp.

535{
536 EmitterFile em(f);
537 return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
538}

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

542{
543 EmitterFile em(opts, f);
544 return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
545}
@ 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 547 of file emit.hpp.

548{
549 EmitterFile em(f);
550 return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
551}

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

559{
560 EmitterFile em(opts, f);
561 return em.emit_as(EMIT_YAML, t, /*error_on_excess*/true).len;
562}

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

565{
566 EmitterFile em(f);
567 return em.emit_as(EMIT_YAML, t, /*error_on_excess*/true).len;
568}

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

572{
573 EmitterFile em(opts, f);
574 return em.emit_as(EMIT_JSON, t, /*error_on_excess*/true).len;
575}

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

578{
579 EmitterFile em(f);
580 return em.emit_as(EMIT_JSON, t, /*error_on_excess*/true).len;
581}

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

589{
590 if(!r.readable())
591 return {};
592 EmitterFile em(opts, f);
593 return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
594}

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

597{
598 if(!r.readable())
599 return {};
600 EmitterFile em(f);
601 return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
602}

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

606{
607 if(!r.readable())
608 return {};
609 EmitterFile em(opts, f);
610 return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
611}

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

614{
615 if(!r.readable())
616 return {};
617 EmitterFile em(f);
618 return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
619}