rapidyaml 0.15.2
parse and emit YAML, and do it fast
Loading...
Searching...
No Matches
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:

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
void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, Tree *tree, id_type node_id)
(1) parse YAML into an existing tree node. The filename will be used in any error messages arising du...
Definition parse.cpp:209
A lightweight object containing options to be used when emitting.
tag type to mark a tree or node to be emitted as yaml when using operator<<, with options.
as_yaml(Tree const &t, EmitOptions const &opts={}) noexcept

Definition at line 65 of file emit_ostream.hpp.

Constructor & Destructor Documentation

◆ as_yaml() [1/3]

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) {}
Tree const * tree
EmitOptions options

◆ as_yaml() [2/3]

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) {}

◆ as_yaml() [3/3]

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) {}

Member Data Documentation

◆ tree

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

Definition at line 67 of file emit_ostream.hpp.

◆ node

id_type c4::yml::as_yaml::node

Definition at line 68 of file emit_ostream.hpp.

◆ options

EmitOptions c4::yml::as_yaml::options

Definition at line 69 of file emit_ostream.hpp.


The documentation for this struct was generated from the following file:
  • /home/docs/checkouts/readthedocs.org/user_builds/rapidyaml/checkouts/latest/src/c4/yml/emit_ostream.hpp