rapidyaml 0.15.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 522 of file emit.hpp.

523{
524 EmitterFile em(opts, f);
525 return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
526}
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 528 of file emit.hpp.

529{
530 EmitterFile em(f);
531 return em.emit_as(EMIT_YAML, t, id, /*error_on_excess*/true).len;
532}

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

536{
537 EmitterFile em(opts, f);
538 return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
539}
@ 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 541 of file emit.hpp.

542{
543 EmitterFile em(f);
544 return em.emit_as(EMIT_JSON, t, id, /*error_on_excess*/true).len;
545}

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

553{
554 EmitterFile em(opts, f);
555 return em.emit_as(EMIT_YAML, t, /*error_on_excess*/true).len;
556}

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

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

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

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

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

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

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

583{
584 if(!r.readable())
585 return {};
586 EmitterFile em(opts, f);
587 return em.emit_as(EMIT_YAML, r, /*error_on_excess*/true).len;
588}

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

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

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

600{
601 if(!r.readable())
602 return {};
603 EmitterFile em(opts, f);
604 return em.emit_as(EMIT_JSON, r, /*error_on_excess*/true).len;
605}

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

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