rapidyaml  0.13.0
parse and emit YAML, and do it fast
c4::yml::as_yaml Struct Reference

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

#include <emit.hpp>

Public Member Functions

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

Public Attributes

Tree const * tree
 
id_type node
 
EmitOptions options
 

Detailed Description

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_json(t); // emits JSON
std::cout << as_json(t, EmitOptions().max_depth(10)); // emits JSON with a max tree depth
void parse_in_arena(Parser *parser, csubstr filename, csubstr yaml, Tree *t, 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:92
See also
operator<<

Definition at line 572 of file emit.hpp.


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