rapidyaml 0.15.2
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
Emit to an STL-like ostream

Classes

struct  c4::yml::as_json
 mark a tree or node to be emitted as yaml when using operator<<, with options. More...
struct  c4::yml::as_yaml
 mark a tree or node to be emitted as yaml when using operator<< . More...

Functions

template<class OStream>
OStream & c4::yml::operator<< (OStream &s, Tree const &t)
 emit YAML to an STL-like ostream
template<class OStream>
OStream & c4::yml::operator<< (OStream &s, ConstNodeRef const &n)
 emit YAML to an STL-like ostream This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class OStream>
OStream & c4::yml::operator<< (OStream &s, as_json const &j)
 emit json to an STL-like stream
template<class OStream>
OStream & c4::yml::operator<< (OStream &s, as_yaml const &y)
 emit yaml to an STL-like stream

Detailed Description

Function Documentation

◆ operator<<() [1/4]

template<class OStream>
OStream & c4::yml::operator<< ( OStream & s,
Tree const & t )
inline

emit YAML to an STL-like ostream

Definition at line 633 of file emit.hpp.

634{
636 em.emit_as(EMIT_YAML, t);
637 return s;
638}
Emitter< WriterOStream< OStream > > EmitterOStream
Definition emit.hpp:38
@ EMIT_YAML
emit YAML
Definition emit.hpp:49

◆ operator<<() [2/4]

template<class OStream>
OStream & c4::yml::operator<< ( OStream & s,
ConstNodeRef const & n )
inline

emit YAML to an STL-like ostream This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 643 of file emit.hpp.

644{
645 if(!n.readable())
646 return s;
648 em.emit_as(EMIT_YAML, n);
649 return s;
650}

◆ operator<<() [3/4]

template<class OStream>
OStream & c4::yml::operator<< ( OStream & s,
as_json const & j )
inline

emit json to an STL-like stream

Definition at line 696 of file emit.hpp.

697{
698 if(!j.tree || j.tree->empty())
699 return s;
700 EmitterOStream<OStream> em(j.options, s);
701 em.emit_as(EMIT_JSON, *j.tree, j.node != NONE ? j.node : j.tree->root_id(), true);
702 return s;
703}
@ EMIT_JSON
emit JSON
Definition emit.hpp:50
@ NONE
an index to none
Definition common.hpp:263

◆ operator<<() [4/4]

template<class OStream>
OStream & c4::yml::operator<< ( OStream & s,
as_yaml const & y )
inline

emit yaml to an STL-like stream

Definition at line 707 of file emit.hpp.

708{
709 if(!y.tree || y.tree->empty())
710 return s;
711 EmitterOStream<OStream> em(y.options, s);
712 em.emit_as(EMIT_YAML, *y.tree, y.node != NONE ? y.node : y.tree->root_id(), true);
713 return s;
714}