6291 CHECK(ryml::emitrs_yaml<std::string>(tree) == yml);
6302 CHECK(doc.is_doc());
6321 CHECK(stream[0].is_doc());
6322 CHECK(stream[0].is_map());
6323 CHECK(stream[0][
"a"].val() ==
"0");
6324 CHECK(stream[0][
"b"].val() ==
"1");
6333 CHECK(stream[1].is_doc());
6334 CHECK(stream[1].is_map());
6335 CHECK(stream[1][
"c"].val() ==
"2");
6336 CHECK(stream[1][
"d"].val() ==
"3");
6345 CHECK(stream[2].is_doc());
6346 CHECK(stream[2].is_seq());
6347 CHECK(stream[2][0].val() ==
"4");
6348 CHECK(stream[2][1].val() ==
"5");
6349 CHECK(stream[2][2].val() ==
"6");
6350 CHECK(stream[2][3].val() ==
"7");
6362 CHECK(ryml::emitrs_json<std::string>(tree) ==
6388 return ryml::emitrs_json<std::string>(err_tree, err_opts);
6392 const std::string expected_json[] = {
6414 CHECK(ryml::emitrs_json<std::string>(doc, err_opts) == expected_json[count++]);
csubstr const & val(id_type node) const
bool is_doc(id_type node) const
id_type first_child(id_type node) const
bool is_stream(id_type node) const
ryml::Callbacks callbacks()
a helper to create the Callbacks object for the custom error handler
bool is_root() const RYML_NOEXCEPT
Forward to Tree::is_root().
Shows how to create a scoped error handler.
id_type id() const noexcept
bool is_doc() const RYML_NOEXCEPT
Forward to Tree::is_doc().
bool is_map(id_type node) const
id_type doc(id_type i) const
gets the i document node index.
id_type num_children() const RYML_NOEXCEPT
O(num_children).
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...
id_type root_id() const
Get the id of the root node. The tree must not be empty. The tree can be empty only when constructed ...
RYML_ID_TYPE id_type
The type of a node id in the YAML tree; to override the default type, define the macro RYML_ID_TYPE t...
id_type num_children(id_type node) const
O(num_children)
bool is_seq(id_type node) const
Callbacks const & callbacks() const
id_type id() const noexcept
bool is_stream() const RYML_NOEXCEPT
Forward to Tree::is_stream().
#define CHECK(predicate)
a testing assertion, used only in this quickstart
id_type child(id_type node, id_type pos) const
find child by position, or NONE if there are less than pos children posi
Holds a pointer to an existing tree, and a node id.
id_type next_sibling(id_type node) const
ConstNodeRef child(id_type pos) const RYML_NOEXCEPT
Forward to Tree::child().
NodeRef rootref()
Get the root as a NodeRef . Note that a non-const Tree implicitly converts to NodeRef.
A lightweight object containing options to be used when emitting.
bool check_error_occurs(Fn &&fn)
checking that an error occurs while calling fn
NodeRef docref(id_type i)
get the i-th document of the stream
const_children_view children() const RYML_NOEXCEPT
get an iterable view over children
bool is_root(id_type node) const
EmitOptions & json_err_on_stream(bool enabled) noexcept
Whether to trigger an error (or emit as seq) when finding a stream in json mode.
id_type find_child(id_type node, csubstr const &key) const
find child by name, or NONE if no child is found with this key like Tree::child(), but return a ReadResult with the status