rapidyaml  0.12.0
parse and emit YAML, and do it fast
emit.hpp File Reference

Utilities to emit YAML and JSON. More...

#include "./writer.hpp"
#include "./tree.hpp"
#include "./node.hpp"
#include "c4/yml/emit.def.hpp"

Go to the source code of this file.

Classes

struct  c4::yml::EmitOptions
 A lightweight object containing options to be used when emitting. More...
 
class  c4::yml::Emitter< Writer >
 A stateful emitter, for use with a writer such as WriterBuf, WriterFile, or WriterOStream. More...
 
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...
 

Namespaces

 c4
 (Undefined by default) Use shorter error message from checks/asserts: do not show the check condition in the error message.
 
 c4::yml
 

Typedefs

template<class OStream >
using c4::yml::EmitterOStream = Emitter< WriterOStream< OStream > >
 
using c4::yml::EmitterFile = Emitter< WriterFile >
 
using c4::yml::EmitterBuf = Emitter< WriterBuf >
 

Enumerations

enum  c4::yml::EmitType_e { c4::yml::EMIT_YAML = 0 , c4::yml::EMIT_JSON = 1 }
 Specifies the type of content to emit. More...
 

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. More...
 
size_t c4::yml::emit_yaml (Tree const &t, id_type id, FILE *f)
 (2) like (1), but use default emit options More...
 
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. More...
 
size_t c4::yml::emit_json (Tree const &t, id_type id, FILE *f)
 (2) like (1), but use default emit options More...
 
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. More...
 
size_t c4::yml::emit_yaml (Tree const &t, FILE *f=nullptr)
 (2) like (1), but use default emit options More...
 
size_t c4::yml::emit_json (Tree const &t, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit JSON to the given file. More...
 
size_t c4::yml::emit_json (Tree const &t, FILE *f=nullptr)
 (2) like (1), but use default emit options More...
 
size_t c4::yml::emit_yaml (ConstNodeRef const &r, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit YAML to the given file. More...
 
size_t c4::yml::emit_yaml (ConstNodeRef const &r, FILE *f=nullptr)
 (2) like (1), but use default emit options More...
 
size_t c4::yml::emit_json (ConstNodeRef const &r, EmitOptions const &opts, FILE *f=nullptr)
 (1) emit JSON to the given file. More...
 
size_t c4::yml::emit_json (ConstNodeRef const &r, FILE *f=nullptr)
 (2) like (1), but use default emit options More...
 
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...
 
substr c4::yml::emit_yaml (Tree const &t, id_type id, EmitOptions const &opts, substr buf, bool error_on_excess=true)
 (1) emit YAML to the given buffer. More...
 
substr c4::yml::emit_yaml (Tree const &t, id_type id, substr buf, bool error_on_excess=true)
 (2) like (1), but use default emit options More...
 
substr c4::yml::emit_json (Tree const &t, id_type id, EmitOptions const &opts, substr buf, bool error_on_excess=true)
 (1) emit JSON to the given buffer. More...
 
substr c4::yml::emit_json (Tree const &t, id_type id, substr buf, bool error_on_excess=true)
 (2) like (1), but use default emit options More...
 
substr c4::yml::emit_yaml (Tree const &t, EmitOptions const &opts, substr buf, bool error_on_excess=true)
 (1) emit YAML to the given buffer. More...
 
substr c4::yml::emit_yaml (Tree const &t, substr buf, bool error_on_excess=true)
 (2) like (1), but use default emit options More...
 
substr c4::yml::emit_json (Tree const &t, EmitOptions const &opts, substr buf, bool error_on_excess=true)
 (1) emit JSON to the given buffer. More...
 
substr c4::yml::emit_json (Tree const &t, substr buf, bool error_on_excess=true)
 (2) like (1), but use default emit options More...
 
substr c4::yml::emit_yaml (ConstNodeRef const &r, EmitOptions const &opts, substr buf, bool error_on_excess=true)
 (1) emit YAML to the given buffer. More...
 
substr c4::yml::emit_yaml (ConstNodeRef const &r, substr buf, bool error_on_excess=true)
 (2) like (1), but use default emit options More...
 
substr c4::yml::emit_json (ConstNodeRef const &r, EmitOptions const &opts, substr buf, bool error_on_excess=true)
 (1) emit JSON to the given buffer. More...
 
substr c4::yml::emit_json (ConstNodeRef const &r, substr buf, bool error_on_excess=true)
 (2) like (1), but use default emit options More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_yaml (Tree const &t, id_type id, EmitOptions const &opts, CharOwningContainer *cont, bool append=false)
 (1) emit+resize: emit YAML to the given std::string/std::vector-like container, resizing it as needed to fit the emitted YAML. More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_yaml (Tree const &t, id_type id, CharOwningContainer *cont, bool append=false)
 (2) like (1), but use default emit options More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_json (Tree const &t, id_type id, EmitOptions const &opts, CharOwningContainer *cont, bool append=false)
 (1) emit+resize: emit JSON to the given std::string/std::vector-like container, resizing it as needed to fit the emitted JSON. More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_json (Tree const &t, id_type id, CharOwningContainer *cont, bool append=false)
 (2) like (1), but use default emit options More...
 
template<class CharOwningContainer >
CharOwningContainer c4::yml::emitrs_yaml (Tree const &t, id_type id, EmitOptions const &opts={})
 (3) emit+resize: YAML to a newly-created std::string/std::vector-like container. More...
 
template<class CharOwningContainer >
CharOwningContainer c4::yml::emitrs_json (Tree const &t, id_type id, EmitOptions const &opts={})
 (3) emit+resize: JSON to a newly-created std::string/std::vector-like container. More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_yaml (Tree const &t, EmitOptions const &opts, CharOwningContainer *cont, bool append=false)
 (1) emit+resize: YAML to the given std::string/std::vector-like container, resizing it as needed to fit the emitted YAML. More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_yaml (Tree const &t, CharOwningContainer *cont, bool append=false)
 (2) like (1), but use default emit options More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_json (Tree const &t, EmitOptions const &opts, CharOwningContainer *cont, bool append=false)
 (1) emit+resize: JSON to the given std::string/std::vector-like container, resizing it as needed to fit the emitted JSON. More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_json (Tree const &t, CharOwningContainer *cont, bool append=false)
 (2) like (1), but use default emit options More...
 
template<class CharOwningContainer >
CharOwningContainer c4::yml::emitrs_yaml (Tree const &t, EmitOptions const &opts={})
 (3) emit+resize: YAML to a newly-created std::string/std::vector-like container. More...
 
template<class CharOwningContainer >
CharOwningContainer c4::yml::emitrs_json (Tree const &t, EmitOptions const &opts={})
 (3) emit+resize: JSON to a newly-created std::string/std::vector-like container. More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_yaml (ConstNodeRef const &n, EmitOptions const &opts, CharOwningContainer *cont, bool append=false)
 (1) emit+resize: YAML to the given std::string/std::vector-like container, resizing it as needed to fit the emitted YAML. More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_yaml (ConstNodeRef const &n, CharOwningContainer *cont, bool append=false)
 (2) like (1), but use default emit options More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_json (ConstNodeRef const &n, EmitOptions const &opts, CharOwningContainer *cont, bool append=false)
 (1) emit+resize: JSON to the given std::string/std::vector-like container, resizing it as needed to fit the emitted JSON. More...
 
template<class CharOwningContainer >
substr c4::yml::emitrs_json (ConstNodeRef const &n, CharOwningContainer *cont, bool append=false)
 (2) like (1), but use default emit options More...
 
template<class CharOwningContainer >
CharOwningContainer c4::yml::emitrs_yaml (ConstNodeRef const &n, EmitOptions const &opts={})
 (3) emit+resize: YAML to a newly-created std::string/std::vector-like container. More...
 
template<class CharOwningContainer >
CharOwningContainer c4::yml::emitrs_json (ConstNodeRef const &n, EmitOptions const &opts={})
 (3) emit+resize: JSON to a newly-created std::string/std::vector-like container. More...
 

Detailed Description

Utilities to emit YAML and JSON.

Definition in file emit.hpp.