rapidyaml  0.10.0
parse and emit YAML, and do it fast
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 More...
 
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. More...
 
template<class OStream >
OStream & c4::yml::operator<< (OStream &s, as_json const &j)
 emit json to an STL-like stream More...
 
template<class OStream >
OStream & c4::yml::operator<< (OStream &s, as_yaml const &y)
 emit yaml to an STL-like stream More...
 

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

363 {
364  EmitterOStream<OStream> em(s);
365  em.emit_as(EMIT_YAML, t);
366  return s;
367 }
@ EMIT_YAML
emit YAML
Definition: emit.hpp:52

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

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

373 {
374  if(!detail::is_set_(n))
375  return s;
376  EmitterOStream<OStream> em(s);
377  em.emit_as(EMIT_YAML, n);
378  return s;
379 }
bool is_set_(ConstNodeRef n)
Definition: emit.hpp:42

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

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

426 {
427  if(!j.tree || j.node == NONE)
428  return s;
429  EmitterOStream<OStream> em(j.options, s);
430  em.emit_as(EMIT_JSON, *j.tree, j.node, true);
431  return s;
432 }
@ EMIT_JSON
emit JSON
Definition: emit.hpp:53
@ NONE
an index to none
Definition: common.hpp:260

References c4::yml::Emitter< Writer >::emit_as(), c4::yml::EMIT_JSON, c4::yml::as_json::node, c4::yml::NONE, c4::yml::as_json::options, and c4::yml::as_json::tree.

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

437 {
438  if(!y.tree || y.node == NONE)
439  return s;
440  EmitterOStream<OStream> em(y.options, s);
441  em.emit_as(EMIT_YAML, *y.tree, y.node, true);
442  return s;
443 }

References c4::yml::Emitter< Writer >::emit_as(), c4::yml::EMIT_YAML, c4::yml::as_yaml::node, c4::yml::NONE, c4::yml::as_yaml::options, and c4::yml::as_yaml::tree.