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

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

#include <emit_ostream.hpp>

Public Member Functions

 as_json (Tree const &t, EmitOptions const &opts={}) noexcept
 
 as_json (Tree const &t, id_type id, EmitOptions const &opts={}) noexcept
 
 as_json (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<<, with options.

For example:

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

Definition at line 43 of file emit_ostream.hpp.

Constructor & Destructor Documentation

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

Definition at line 48 of file emit_ostream.hpp.

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

Definition at line 49 of file emit_ostream.hpp.

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

Definition at line 50 of file emit_ostream.hpp.

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

Member Data Documentation

Tree const* c4::yml::as_json::tree

Definition at line 45 of file emit_ostream.hpp.

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

id_type c4::yml::as_json::node

Definition at line 46 of file emit_ostream.hpp.

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

EmitOptions c4::yml::as_json::options

Definition at line 47 of file emit_ostream.hpp.

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


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