rapidyaml  0.16.0
parseandemitYAML,anddoitfast
Emit to an STL-like ostream

Classes

struct  c4::yml::as_json
 tag type to mark a tree or node to be emitted as yaml when using operator<<, with options. More...
 
struct  c4::yml::as_yaml
 tag type to mark a tree or node to be emitted as yaml when using operator<< . More...
 
struct  c4::yml::WriterOStream< OStream >
 A writer that outputs to an STL-like ostream. More...
 

Typedefs

template<class OStream >
using c4::yml::EmitterOStream = Emitter< WriterOStream< OStream >>
 

Functions

template<class OStream >
OStream & c4::yml::operator<< (OStream &stream, Tree const &tree)
 emit YAML to an STL-like ostream More...
 
template<class OStream >
OStream & c4::yml::operator<< (OStream &stream, ConstNodeRef const &node)
 emit YAML to an STL-like ostream More...
 
template<class OStream >
OStream & c4::yml::operator<< (OStream &stream, as_json const &json_spec)
 emit JSON to an STL-like ostream More...
 
template<class OStream >
OStream & c4::yml::operator<< (OStream &stream, as_yaml const &yaml_spec)
 emit YAML to an STL-like ostream More...
 

Detailed Description

Typedef Documentation

template<class OStream >
using c4::yml::EmitterOStream = typedef Emitter<WriterOStream<OStream>>

Definition at line 30 of file emit_ostream.hpp.

Function Documentation

template<class OStream >
OStream& c4::yml::operator<< ( OStream &  stream,
Tree const &  tree 
)

emit YAML to an STL-like ostream

Definition at line 78 of file emit_ostream.hpp.

79 {
80  EmitterOStream<OStream> em(EmitOptions{}, &stream);
81  em.emit_as(EMIT_YAML, &tree);
82  return stream;
83 }
template<class OStream >
OStream& c4::yml::operator<< ( OStream &  stream,
ConstNodeRef const &  node 
)

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 89 of file emit_ostream.hpp.

90 {
91  EmitterOStream<OStream> em(EmitOptions{}, &stream);
92  em.emit_as(EMIT_YAML, node.tree(), node.id());
93  return stream;
94 }
template<class OStream >
OStream& c4::yml::operator<< ( OStream &  stream,
as_json const &  json_spec 
)

emit JSON to an STL-like ostream

Definition at line 99 of file emit_ostream.hpp.

100 {
101  if(json_spec.tree && !json_spec.tree->empty())
102  {
103  EmitterOStream<OStream> em(json_spec.options, &stream);
104  id_type node_id = json_spec.node != NONE ? json_spec.node : json_spec.tree->root_id();
105  em.emit_as(EMIT_JSON, json_spec.tree, node_id);
106  }
107  return stream;
108 }
an index to none
Definition: common.hpp:131
RYML_ID_TYPE id_type
The type of a node id in the YAML tree; to override the default type, define the macro RYML_ID_TYPE t...
Definition: common.hpp:124
template<class OStream >
OStream& c4::yml::operator<< ( OStream &  stream,
as_yaml const &  yaml_spec 
)

emit YAML to an STL-like ostream

Definition at line 113 of file emit_ostream.hpp.

114 {
115  if(yaml_spec.tree && !yaml_spec.tree->empty())
116  {
117  EmitterOStream<OStream> em(yaml_spec.options, &stream);
118  id_type node_id = yaml_spec.node != NONE ? yaml_spec.node : yaml_spec.tree->root_id();
119  em.emit_as(EMIT_YAML, yaml_spec.tree, node_id);
120  }
121  return stream;
122 }
an index to none
Definition: common.hpp:131
RYML_ID_TYPE id_type
The type of a node id in the YAML tree; to override the default type, define the macro RYML_ID_TYPE t...
Definition: common.hpp:124