rapidyaml  0.16.0
parseandemitYAML,anddoitfast
c4::yml::as_yaml Struct Reference

tag type to mark a tree or node to be emitted as yaml when using operator<< . More...

#include <emit_ostream.hpp>

Public Member Functions

 as_yaml (Tree const &t, EmitOptions const &opts={}) noexcept
 
 as_yaml (Tree const &t, id_type id, EmitOptions const &opts={}) noexcept
 
 as_yaml (ConstNodeRef const &n, EmitOptions const &opts={}) noexcept
 

Public Attributes

Tree const * tree
 
id_type node
 
EmitOptions options
 

Detailed Description

tag type to mark a tree or node to be emitted as yaml when using operator<< .

For example:

  • ```cpp Tree t = parse_in_arena("{foo: bar}"); std::cout << t; // emits YAML std::cout << as_yaml(t); // emits JSON std::cout << as_yaml(t, id); // emits JSON from nested node std::cout << as_json(t, EmitOptions{}.flow_spc(true)); // emits JSON forcing spaces after commas
  • ```

Definition at line 65 of file emit_ostream.hpp.

Constructor & Destructor Documentation

c4::yml::as_yaml::as_yaml ( Tree const &  t,
EmitOptions const &  opts = {} 
)
inlinenoexcept

Definition at line 70 of file emit_ostream.hpp.

70 {}) noexcept : tree(&t), node(t.root_id_maybe()), options(opts) {}
EmitOptions options
Tree const * tree
c4::yml::as_yaml::as_yaml ( Tree const &  t,
id_type  id,
EmitOptions const &  opts = {} 
)
inlinenoexcept

Definition at line 71 of file emit_ostream.hpp.

71 {}) noexcept : tree(&t), node(id), options(opts) {}
EmitOptions options
Tree const * tree
c4::yml::as_yaml::as_yaml ( ConstNodeRef const &  n,
EmitOptions const &  opts = {} 
)
inlinenoexcept

Definition at line 72 of file emit_ostream.hpp.

72 {}) noexcept : tree(n.tree()), node(n.id()), options(opts) {}
EmitOptions options
Tree const * tree

Member Data Documentation

Tree const* c4::yml::as_yaml::tree

Definition at line 67 of file emit_ostream.hpp.

Referenced by c4::yml::operator<<().

id_type c4::yml::as_yaml::node

Definition at line 68 of file emit_ostream.hpp.

Referenced by c4::yml::operator<<().

EmitOptions c4::yml::as_yaml::options

Definition at line 69 of file emit_ostream.hpp.

Referenced by c4::yml::operator<<().


The documentation for this struct was generated from the following file: