|
rapidyaml 0.16.0
parse and emit YAML, and do it fast
|
#include <tree.hpp>
Classes | |
| struct | lookup_result |
Public Member Functions | |
construction and assignment | |
| Tree () | |
| Tree (Callbacks const &cb) | |
| Tree (id_type node_capacity, size_t arena_capacity=RYML_DEFAULT_TREE_ARENA_CAPACITY) | |
| Tree (id_type node_capacity, size_t arena_capacity, Callbacks const &cb) | |
| ~Tree () noexcept | |
| Tree (Tree const &that) | |
| Tree (Tree &&that) noexcept | |
| Tree & | operator= (Tree const &that) |
| Tree & | operator= (Tree &&that) noexcept |
memory and sizing | |
| void | reserve (id_type node_capacity=RYML_DEFAULT_TREE_CAPACITY) |
| void | clear () |
| clear the tree | |
| void | clear_arena () |
| bool | empty () const |
| Query for zero size. | |
| id_type | size () const |
| Get the number of existing nodes. | |
| id_type | capacity () const |
| id_type | slack () const |
| Callbacks const & | callbacks () const |
| void | callbacks (Callbacks const &cb) |
node getters | |
| NodeData * | get (id_type node) |
| get a pointer to a node's NodeData. node can be NONE, in which case a nullptr is returned | |
| NodeData const * | get (id_type node) const |
| get a pointer to a node's NodeData. node can be NONE, in which case a nullptr is returned. | |
| NodeData * | _p (id_type node) |
| An if-less form of get() that demands a valid node index. This function is implementation only; use at your own risk. | |
| NodeData const * | _p (id_type node) const |
| An if-less form of get() that demands a valid node index. This function is implementation only; use at your own risk. | |
| 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 with explicitly zero-capacity. | |
| id_type | root_id_maybe () const |
| Get the id of the root node, or NONE if the tree is empty. | |
| id_type | id (NodeData const *n) const |
get the id of a node belonging to this tree. n can be nullptr, in which case NONE is returned n must belong to this tree | |
NodeRef helpers | |
| NodeRef | ref (id_type node) |
| Get a NodeRef of a node by id. | |
| ConstNodeRef | ref (id_type node) const |
| Get a NodeRef of a node by id. | |
| ConstNodeRef | cref (id_type node) const |
| Get a NodeRef of a node by id. | |
| NodeRef | rootref () |
| Get the root as a NodeRef . Note that a non-const Tree implicitly converts to NodeRef. | |
| ConstNodeRef | rootref () const |
| Get the root as a ConstNodeRef . Note that Tree implicitly converts to ConstNodeRef. | |
| ConstNodeRef | crootref () const |
| Get the root as a ConstNodeRef . Note that Tree implicitly converts to ConstNodeRef. | |
| NodeRef | docref (id_type i) |
| get the i-th document of the stream | |
| ConstNodeRef | docref (id_type i) const |
| get the i-th document of the stream | |
| ConstNodeRef | cdocref (id_type i) const |
| get the i-th document of the stream | |
| NodeRef | operator[] (csubstr key) |
| find a root child (ie child of root) by name, return it as a NodeRef | |
| ConstNodeRef | operator[] (csubstr key) const |
| find a root child (ie child of root) by name, return it as a NodeRef | |
| NodeRef | operator[] (id_type i) |
find a root child (ie child of root) by index: return the root node's i-th child as a NodeRef | |
| ConstNodeRef | operator[] (id_type i) const |
find a root child (ie child of root) by index: return the root node's i-th child as a NodeRef | |
node property getters | |
| NodeType | type (id_type node) const |
| csubstr const & | key (id_type node) const |
| csubstr const & | key_tag (id_type node) const |
| csubstr const & | key_ref (id_type node) const |
| csubstr const & | key_anchor (id_type node) const |
| NodeScalar const & | keysc (id_type node) const |
| csubstr const & | val (id_type node) const |
| csubstr const & | val_tag (id_type node) const |
| csubstr const & | val_ref (id_type node) const |
| csubstr const & | val_anchor (id_type node) const |
| NodeScalar const & | valsc (id_type node) const |
node type predicates | |
| bool | type_has_any (id_type node, type_bits bits) const |
| bool | type_has_all (id_type node, type_bits bits) const |
| bool | type_has_none (id_type node, type_bits bits) const |
| bool | is_stream (id_type node) const |
| bool | is_doc (id_type node) const |
| bool | is_container (id_type node) const |
| bool | is_map (id_type node) const |
| bool | is_seq (id_type node) const |
| bool | has_key (id_type node) const |
| bool | has_val (id_type node) const |
| bool | is_val (id_type node) const |
| bool | is_keyval (id_type node) const |
| bool | has_key_tag (id_type node) const |
| bool | has_val_tag (id_type node) const |
| bool | has_key_anchor (id_type node) const |
| bool | has_val_anchor (id_type node) const |
| bool | has_anchor (id_type node) const |
| bool | is_key_ref (id_type node) const |
| bool | is_val_ref (id_type node) const |
| bool | is_ref (id_type node) const |
| bool | parent_is_seq (id_type node) const |
| bool | parent_is_map (id_type node) const |
| bool | has_anchor (id_type node, csubstr a) const |
| true when the node has an anchor named a | |
| bool | key_is_null (id_type node) const |
| true if the node key is empty, or its scalar verifies scalar_is_null(). | |
| bool | val_is_null (id_type node) const |
| true if the node val is empty, or its scalar verifies scalar_is_null(). | |
| bool | is_key_unfiltered (id_type node) const |
| true if the key was a scalar requiring filtering and was left unfiltered during the parsing (see ParserOptions) | |
| bool | is_val_unfiltered (id_type node) const |
| true if the val was a scalar requiring filtering and was left unfiltered during the parsing (see ParserOptions) | |
| bool | is_key_anchor (id_type node) const |
| bool | is_val_anchor (id_type node) const |
| bool | is_anchor (id_type node) const |
| bool | is_anchor_or_ref (id_type node) const |
hierarchy predicates | |
| bool | is_root (id_type node) const |
| bool | has_parent (id_type node) const |
| bool | is_ancestor (id_type node, id_type ancestor) const |
| true when ancestor is parent or parent of a parent of node | |
| bool | empty (id_type node) const |
| true when key and val are empty, and has no children | |
| bool | has_child (id_type node, id_type ch) const |
true if node has a child with id ch | |
| bool | has_child (id_type node, csubstr key) const |
true if node has a child with key key | |
| bool | has_children (id_type node) const |
true if node has any children | |
| bool | has_sibling (id_type node, id_type sib) const |
true if node has a sibling with id sib | |
| bool | has_sibling (id_type node, csubstr key) const |
| true if one of the node's siblings has the given key | |
| bool | has_other_siblings (id_type node) const |
| true if node is not a single child | |
hierarchy getters | |
| id_type | parent (id_type node) const |
| id_type | prev_sibling (id_type node) const |
| id_type | next_sibling (id_type node) const |
| id_type | num_children (id_type node) const |
| O(num_children). | |
| id_type | child_pos (id_type node, id_type ch) const |
| id_type | first_child (id_type node) const |
| id_type | last_child (id_type node) const |
| id_type | child (id_type node, id_type pos) const |
| find child by position, or NONE if there are less than pos children posi | |
| 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 | |
| ReadResult | child_r (id_type node, id_type pos, id_type *child_id) const |
| ReadResult | find_child_r (id_type node, csubstr const &key, id_type *child_id) const |
| like Tree::find_child(), but return a ReadResult with the status | |
| id_type | num_siblings (id_type node) const |
| O(num_siblings). | |
| id_type | num_other_siblings (id_type node) const |
| does not count with this | |
| id_type | sibling_pos (id_type node, id_type sib) const |
| id_type | first_sibling (id_type node) const |
| id_type | last_sibling (id_type node) const |
| id_type | sibling (id_type node, id_type pos) const |
| id_type | find_sibling (id_type node, csubstr const &key) const |
| ReadResult | sibling_r (id_type node, id_type pos, id_type *sibling_id) const |
| like Tree::sibling(), but return a ReadResult with the status | |
| ReadResult | find_sibling_r (id_type node, csubstr const &key, id_type *sibling_id) const |
| like Tree::find_sibling(), but return a ReadResult if with the status | |
| id_type | depth_asc (id_type node) const |
| O(log(num_tree_nodes)) get the ascending depth of the node: number of levels between root and node. | |
| id_type | depth_desc (id_type node) const |
| O(num_tree_nodes) get the descending depth of the node: number of levels between node and deepest child. | |
| id_type | doc (id_type i) const |
gets the i document node index. | |
| id_type | ancestor_doc (id_type node) const |
| get the document which is a parent document of node i, or the root if the tree is not a stream | |
node style predicates and modifiers. see the corresponding predicate in NodeType | |
| bool | is_container_styled (id_type node) const |
| bool | is_block (id_type node) const |
| bool | is_flow_sl (id_type node) const |
| bool | is_flow_ml (id_type node) const |
| bool | is_flow_ml1 (id_type node) const |
| bool | is_flow_mln (id_type node) const |
| bool | is_flow_mlx (id_type node) const |
| bool | is_flow (id_type node) const |
| bool | has_flow_space (id_type node) const |
| bool | is_key_styled (id_type node) const |
| bool | is_val_styled (id_type node) const |
| bool | is_key_literal (id_type node) const |
| bool | is_val_literal (id_type node) const |
| bool | is_key_folded (id_type node) const |
| bool | is_val_folded (id_type node) const |
| bool | is_key_squo (id_type node) const |
| bool | is_val_squo (id_type node) const |
| bool | is_key_dquo (id_type node) const |
| bool | is_val_dquo (id_type node) const |
| bool | is_key_plain (id_type node) const |
| bool | is_val_plain (id_type node) const |
| bool | is_key_quoted (id_type node) const |
| bool | is_val_quoted (id_type node) const |
| bool | is_quoted (id_type node) const |
| NodeType | key_style (id_type node) const |
| NodeType | val_style (id_type node) const |
| void | set_container_style (id_type node, type_bits style) |
| void | set_key_style (id_type node, type_bits style) |
| void | set_val_style (id_type node, type_bits style) |
| void | clear_style (id_type node, bool recurse=false) |
| void | set_style_conditionally (id_type node, NodeType type_mask, NodeType rem_style_flags, NodeType add_style_flags, bool recurse=false) |
node type modifiers | |
| void | set_stream (id_type node) |
| void | set_doc (id_type node) |
| void | set_val (id_type node, csubstr val) RYML_NOEXCEPT |
| void | set_val (id_type node, csubstr val, NodeType more_flags) RYML_NOEXCEPT |
| void | set_key (id_type node, csubstr key) RYML_NOEXCEPT |
| void | set_key (id_type node, csubstr key, NodeType more_flags) RYML_NOEXCEPT |
| void | set_seq (id_type node) RYML_NOEXCEPT |
| void | set_seq (id_type node, NodeType more_flags) RYML_NOEXCEPT |
| void | set_map (id_type node) RYML_NOEXCEPT |
| void | set_map (id_type node, NodeType more_flags) RYML_NOEXCEPT |
| void | set_key_tag (id_type node, csubstr tag) |
| void | set_val_tag (id_type node, csubstr tag) |
| void | set_key_anchor (id_type node, csubstr anchor) |
| void | set_val_anchor (id_type node, csubstr anchor) |
| void | set_key_ref (id_type node, csubstr ref) |
| void | set_val_ref (id_type node, csubstr ref) |
| void | rem_key_anchor (id_type node) |
| void | rem_val_anchor (id_type node) |
| void | rem_key_ref (id_type node) |
| void | rem_val_ref (id_type node) |
| void | rem_anchor_ref (id_type node) |
serialization - checked | |
| template<class T> | |
| void | save (id_type node, T const &val) |
| template<class T> | |
| void | save (id_type node, T const &val, NodeType more_flags) |
| template<class T> | |
| void | save_key (id_type node, T const &key) |
| template<class T> | |
| void | save_key (id_type node, T const &key, NodeType more_flags) |
serialization - asserted | |
| template<class T> | |
| void | set_serialized (id_type node, T const &val) RYML_NOEXCEPT |
| template<class T> | |
| void | set_serialized (id_type node, T const &val, NodeType more_flags) RYML_NOEXCEPT |
| template<class T> | |
| void | set_key_serialized (id_type node, T const &key) RYML_NOEXCEPT |
| template<class T> | |
| void | set_key_serialized (id_type node, T const &key, NodeType more_flags) RYML_NOEXCEPT |
deserialization - asserted preconditions | |
| template<class T> | |
| ReadResult | deserialize (id_type node, T *v) const |
| (1) deserialize a node's contents to a variable | |
| template<class Wrapper> | |
| ReadResult | deserialize (id_type node, Wrapper const &w) const |
| (2) like (1), but for a wrapper type like those used in tag functions | |
| template<class T> | |
| ReadResult | deserialize_key (id_type node, T *v) const |
| (1) deserialize a node's key to a variable | |
| template<class Wrapper> | |
| ReadResult | deserialize_key (id_type node, Wrapper const &w) const |
| (2) like (1), but for a wrapper type like those used in tag functions | |
lookup and deserialize | |
| template<class T> | |
| ReadResult | deserialize_child (id_type node, csubstr child_key, T *v) const |
| (1) find a child by name and deserialize its contents to the given variable (ie call .deserialize() on the child if it exists). | |
| template<class T> | |
| ReadResult | deserialize_child (id_type node, csubstr child_key, T *v, T const &fallback) const |
| (2) like (1), but assign from fallback if no such child exists. | |
| template<class Wrapper> | |
| ReadResult | deserialize_child (id_type node, csubstr child_key, Wrapper const &wrapper) const |
| (3) like (1), but for wrapper tag types such as c4::fmt::base64() | |
| template<class T> | |
| ReadResult | deserialize_child (id_type node, id_type child_pos, T *v) const |
| (1) find a child by position and deserialize its contents to the given variable (ie call .deserialize() on the child if it exists). | |
| template<class T> | |
| ReadResult | deserialize_child (id_type node, id_type child_pos, T *v, T const &fallback) const |
| (2) like (1), but assign from fallback if no such child exists | |
| template<class Wrapper> | |
| ReadResult | deserialize_child (id_type node, id_type child_pos, Wrapper const &wrapper) const |
| (3) like (1), but for wrapper tag types such as c4::fmt::base64() | |
tree modifiers | |
| void | reorder () |
| reorder the tree in memory so that all the nodes are stored in a linear sequence when visited in depth-first order. | |
anchors and references/aliases | |
| void | resolve (ReferenceResolver *rr, ResolveOptions const &opts={}) |
| Resolve references (aliases <- anchors), by forwarding to ReferenceResolver::resolve(). | |
| void | resolve (ResolveOptions const &opts={}) |
| Resolve references (aliases <- anchors), by forwarding to ReferenceResolver::resolve(). | |
tags and tag directives | |
| void | resolve_tags (TagCache &cache, bool all=true) |
Resolve tags in the tree such as "!!str" -> "<tag:yaml.org,2002:str>", "!foo" -> "<!foo>" and custom tags as well, ie tags of the form "!handle!tag" for which there is a corresponding "%TAG" directive. | |
| void | normalize_tags () |
| void | normalize_tags_long () |
| id_type | num_tag_directives () const |
| void | add_tag_directive (csubstr handle, csubstr prefix, id_type id) |
| void | clear_tag_directives () |
| size_t | resolve_tag (substr output, csubstr tag, id_type node_id) const |
| resolve the given tag, appearing at node_id. | |
| csubstr | resolve_tag_sub (substr output, csubstr tag, id_type node_id) const |
| Wrapper for Tree::resolve_tag(), returning a substring. | |
| c4::yml::TagDirectiveRange | tag_directives () const |
modifying hierarchy | |
| id_type | insert_child (id_type parent, id_type after) |
create and insert a new child of parent. | |
| id_type | prepend_child (id_type parent) |
create and insert a node as the first child of parent | |
| id_type | append_child (id_type parent) |
create and insert a node as the last child of parent | |
| id_type | _append_child__unprotected (id_type parent) |
| id_type | insert_sibling (id_type node, id_type after) |
| create and insert a new sibling of n. insert after "after" | |
| id_type | prepend_sibling (id_type node) |
create and insert a node as the first node of parent | |
| id_type | append_sibling (id_type node) |
| void | remove (id_type node) |
| remove an entire branch at once: ie remove the children and the node itself | |
| void | remove_children (id_type node) |
| remove all the node's children, but keep the node itself | |
| void | move (id_type node, id_type after) |
| change the node's position in the parent | |
| void | move (id_type node, id_type new_parent, id_type after) |
| change the node's parent and position | |
| id_type | move (Tree *src, id_type node, id_type new_parent, id_type after) |
| change the node's parent and position to a different tree | |
| void | set_root_as_stream () |
| ensure the first node is a stream. | |
| bool | change_type (id_type node, NodeType type) |
| bool | change_type (id_type node, type_bits type) |
| id_type | duplicate (id_type node, id_type new_parent, id_type after) |
| recursively duplicate a node from this tree into a new parent, placing it after one of its children | |
| id_type | duplicate (Tree const *src, id_type node, id_type new_parent, id_type after) |
| recursively duplicate a node from a different tree into a new parent, placing it after one of its children | |
| id_type | duplicate_children (id_type node, id_type parent, id_type after) |
| recursively duplicate the node's children (but not the node) | |
| id_type | duplicate_children (Tree const *src, id_type node, id_type parent, id_type after) |
| recursively duplicate the node's children (but not the node), where the node is from a different tree | |
| id_type | duplicate_children_no_rep (id_type node, id_type parent, id_type after) |
| duplicate the node's children (but not the node) in a new parent, but omit repetitions where a duplicated node has the same key (in maps) or value (in seqs). | |
| id_type | duplicate_children_no_rep (Tree const *src, id_type node, id_type parent, id_type after) |
| void | duplicate_contents (id_type node, id_type where) |
| void | duplicate_contents (Tree const *src, id_type node, id_type where) |
| void | merge_with (Tree const *src, id_type src_node=NONE, id_type dst_root=NONE) |
internal string arena | |
| size_t | arena_size () const |
| get the current size of the tree's internal arena | |
| size_t | arena_capacity () const |
| get the current capacity of the tree's internal arena | |
| size_t | arena_slack () const |
| get the current slack of the tree's internal arena | |
| size_t | arena_pos () const |
| csubstr | arena () const |
| get the current arena | |
| substr | arena () |
| get the current arena | |
| csubstr | arena_rem () const |
| get the free space at the end of the arena | |
| substr | arena_rem () |
| get the free space at the end of the arena | |
| bool | in_arena (csubstr s) const |
| return true if the given substring is part of the tree's string arena | |
| template<class T> | |
| csubstr | to_arena (T const &a) |
| serialize the given variable to the tree's arena, growing it as needed to accomodate the serialization. | |
| substr | copy_to_arena (csubstr s) |
| copy the given string to the tree's arena, growing the arena by the required size. | |
| substr | alloc_arena (size_t sz) |
| grow the tree's string arena by the given size and return a substr of the added portion | |
| void | reserve_arena (size_t arena_cap=RYML_DEFAULT_TREE_ARENA_CAPACITY) |
| ensure the tree's internal string arena is at least the given capacity | |
lookup | |
| lookup_result | lookup_path (csubstr path, id_type start=NONE) const |
| for example foo.bar[0].baz | |
| id_type | lookup_path_or_modify (csubstr default_value, csubstr path, id_type start=NONE) |
defaulted lookup: lookup path; if the lookup fails, recursively modify the tree so that the corresponding lookup_path() would return the default value. | |
| id_type | lookup_path_or_modify (Tree const *src, id_type src_node, csubstr path, id_type start=NONE) |
defaulted lookup: lookup path; if the lookup fails, recursively modify the tree so that the corresponding lookup_path() would return the branch src_node (from the tree src). | |
Public Attributes | |
| NodeData * | m_buf |
| id_type | m_cap |
| id_type | m_size |
| id_type | m_free_head |
| id_type | m_free_tail |
| id_type | m_first_unused |
| substr | m_arena |
| size_t | m_arena_pos |
| Callbacks | m_callbacks |
| TagDirectives | m_tag_directives |
deserialization - checked | |
These methods raise an error if the deserialization failed or optionally if the node is not readable. | |
| template<class T> | |
| void | load (id_type node, T *v, bool check_readable=true) const |
| (1) deserialize the node's contents (val or container) to the given variable, forwarding to the user-overrideable read() function (see Read from Tree). | |
| template<class Wrapper> | |
| void | load (id_type node, Wrapper const &w, bool check_readable=true) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() | |
| template<class T> | |
| void | load_key (id_type node, T *k, bool check_readable=true) const |
| (1) deserialize the node's key (necessarily a scalar) to the given variable, forwarding to the user-overrideable read_key() function (see Read from ConstNodeRef). | |
| template<class Wrapper> | |
| void | load_key (id_type node, Wrapper const &w, bool check_readable=true) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() | |
| static ReadResult | to_result_ (bool, id_type node) noexcept |
| static ReadResult | to_result_ (ReadResult notlegacy, id_type) noexcept |
locations | |
| Location | location (Parser const &p, id_type node) const |
| Get the location of a node from the parse used to parse this tree. | |
|
inline |
Definition at line 317 of file tree.hpp.
Referenced by Tree(), Tree(), Tree(), Tree(), Tree(), duplicate(), duplicate_children(), duplicate_children_no_rep(), duplicate_contents(), lookup_path_or_modify(), merge_with(), move(), operator=(), and operator=().
| c4::yml::Tree::Tree | ( | Callbacks const & | cb | ) |
Definition at line 119 of file tree.cpp.
|
inline |
Definition at line 319 of file tree.hpp.
Definition at line 124 of file tree.cpp.
| c4::yml::Tree::Tree | ( | Tree const & | that | ) |
|
noexcept |
Definition at line 160 of file tree.cpp.
Definition at line 171 of file tree.cpp.
| void c4::yml::Tree::reserve | ( | id_type | node_capacity = RYML_DEFAULT_TREE_CAPACITY | ) |
Definition at line 296 of file tree.cpp.
Referenced by Tree(), sample_global_allocator(), sample_parse_reuse_tree(), and sample_parse_reuse_tree_and_parser().
| void c4::yml::Tree::clear | ( | ) |
clear the tree
Definition at line 315 of file tree.cpp.
Referenced by sample_empty_null_values(), sample_parse_reuse_tree(), and sample_parse_reuse_tree_and_parser().
|
inline |
Definition at line 343 of file tree.hpp.
Referenced by clear_arena(), sample_empty_null_values(), and sample_parse_reuse_tree().
|
inline |
Query for zero size.
The tree can be empty only when constructed with explicitly zero-capacity.
Definition at line 346 of file tree.hpp.
Referenced by c4::yml::Emitter< Writer >::emit_as(), normalize_tags(), normalize_tags_long(), c4::yml::operator<<(), c4::yml::operator<<(), and resolve_tags().
|
inline |
Get the number of existing nodes.
Definition at line 349 of file tree.hpp.
Referenced by sample_quick_overview().
|
inline |
|
inline |
|
inline |
Definition at line 353 of file tree.hpp.
Referenced by c4::yml::Emitter< Writer >::emit_as(), c4::yml::EventHandlerTree::reset(), resolve_tag(), resolve_tags(), sample_docs(), sample_error_visit_location(), and sample_quick_overview().
|
inline |
Definition at line 354 of file tree.hpp.
get a pointer to a node's NodeData. node can be NONE, in which case a nullptr is returned
Definition at line 365 of file tree.hpp.
Referenced by remove_children().
An if-less form of get() that demands a valid node index. This function is implementation only; use at your own risk.
Definition at line 384 of file tree.hpp.
Referenced by _append_child__unprotected(), ancestor_doc(), append_child(), append_sibling(), change_type(), clear_style(), deserialize(), deserialize(), empty(), find_child(), find_sibling(), find_sibling_r(), first_child(), first_sibling(), has_anchor(), has_anchor(), has_child(), has_children(), has_flow_space(), has_key(), has_key_anchor(), has_key_tag(), has_other_siblings(), has_parent(), has_sibling(), has_val(), has_val_anchor(), has_val_tag(), insert_child(), insert_sibling(), is_anchor(), is_anchor_or_ref(), is_block(), is_container(), is_container_styled(), is_doc(), is_flow(), is_flow_ml(), is_flow_ml1(), is_flow_mln(), is_flow_mlx(), is_flow_sl(), is_key_anchor(), is_key_dquo(), is_key_folded(), is_key_literal(), is_key_plain(), is_key_quoted(), is_key_ref(), is_key_squo(), is_key_styled(), is_key_unfiltered(), is_keyval(), is_map(), is_quoted(), is_ref(), is_root(), is_seq(), is_stream(), is_val(), is_val_anchor(), is_val_dquo(), is_val_folded(), is_val_literal(), is_val_plain(), is_val_quoted(), is_val_ref(), is_val_squo(), is_val_styled(), is_val_unfiltered(), key(), key_anchor(), key_is_null(), key_ref(), key_style(), key_tag(), keysc(), last_child(), last_sibling(), load(), load(), load_key(), load_key(), merge_with(), next_sibling(), num_siblings(), parent(), parent_is_map(), parent_is_seq(), prepend_sibling(), prev_sibling(), c4::yml::read(), c4::yml::read(), c4::yml::read_key(), c4::yml::read_key(), rem_anchor_ref(), rem_key_anchor(), rem_key_ref(), rem_val_anchor(), rem_val_ref(), save(), save_key(), set_container_style(), set_doc(), set_key(), set_key(), set_key_anchor(), set_key_ref(), set_key_serialized(), set_key_style(), set_key_tag(), set_map(), set_map(), set_root_as_stream(), set_seq(), set_seq(), set_serialized(), set_stream(), set_style_conditionally(), set_val(), set_val(), set_val_anchor(), set_val_ref(), set_val_style(), set_val_tag(), sibling(), sibling_pos(), sibling_r(), type(), type_has_all(), type_has_any(), type_has_none(), val(), val_anchor(), val_is_null(), val_ref(), val_style(), val_tag(), and valsc().
An if-less form of get() that demands a valid node index. This function is implementation only; use at your own risk.
Definition at line 387 of file tree.hpp.
|
inline |
Get the id of the root node. The tree must not be empty. The tree can be empty only when constructed with explicitly zero-capacity.
Definition at line 390 of file tree.hpp.
Referenced by crootref(), doc(), c4::yml::Emitter< Writer >::emit_as(), lookup_path(), merge_with(), normalize_tags(), normalize_tags_long(), c4::yml::operator<<(), c4::yml::operator<<(), c4::yml::parse_in_arena(), c4::yml::parse_in_arena(), c4::yml::parse_in_arena(), c4::yml::parse_in_arena(), c4::yml::parse_in_arena(), c4::yml::parse_in_arena(), c4::yml::parse_in_arena(), c4::yml::parse_in_arena(), c4::yml::parse_in_place(), c4::yml::parse_in_place(), c4::yml::parse_in_place(), c4::yml::parse_in_place(), c4::yml::parse_in_place(), c4::yml::parse_in_place(), c4::yml::parse_in_place(), c4::yml::parse_in_place(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_place(), c4::yml::parse_json_in_place(), c4::yml::parse_json_in_place(), c4::yml::parse_json_in_place(), c4::yml::parse_json_in_place(), c4::yml::parse_json_in_place(), c4::yml::parse_json_in_place(), c4::yml::parse_json_in_place(), reorder(), rootref(), rootref(), sample_docs(), sample_emit_to_container(), sample_emit_to_file(), sample_quick_overview(), sample_user_container_types(), set_root_as_stream(), and sibling_pos().
|
inline |
Get the id of the root node, or NONE if the tree is empty.
Definition at line 392 of file tree.hpp.
Referenced by c4::yml::emitrs_json(), c4::yml::emitrs_json(), c4::yml::emitrs_yaml(), and c4::yml::emitrs_yaml().
get the id of a node belonging to this tree. n can be nullptr, in which case NONE is returned n must belong to this tree
Definition at line 396 of file tree.hpp.
Referenced by sample_deserialize_error(), sample_error_visit(), sample_error_visit_location(), sample_serialize_basic(), and set_root_as_stream().
Get a NodeRef of a node by id.
Definition at line 70 of file tree.cpp.
Referenced by docref(), ref(), ref(), set_key_ref(), and set_val_ref().
| ConstNodeRef c4::yml::Tree::ref | ( | id_type | node | ) | const |
| ConstNodeRef c4::yml::Tree::cref | ( | id_type | node | ) | const |
| NodeRef c4::yml::Tree::rootref | ( | ) |
Get the root as a NodeRef . Note that a non-const Tree implicitly converts to NodeRef.
Definition at line 56 of file tree.cpp.
Referenced by operator[](), operator[](), rootref(), rootref(), sample_anchors_and_aliases_create(), sample_base64(), sample_create_tree(), sample_docs(), sample_empty_null_values(), sample_float_precision(), sample_json(), sample_location_tracking(), sample_parse_reuse_tree(), sample_parse_style(), sample_quick_overview(), sample_std_types(), sample_style(), sample_style_flow_formatting(), sample_style_flow_ml_indent(), sample_tags(), and sample_tree_arena().
| ConstNodeRef c4::yml::Tree::rootref | ( | ) | const |
Get the root as a ConstNodeRef . Note that Tree implicitly converts to ConstNodeRef.
| ConstNodeRef c4::yml::Tree::crootref | ( | ) | const |
Get the root as a ConstNodeRef . Note that Tree implicitly converts to ConstNodeRef.
Definition at line 65 of file tree.cpp.
Referenced by crootref(), operator[](), operator[](), sample_iterate_tree(), sample_parse_in_arena(), sample_parse_in_place(), and sample_parse_reuse_tree().
get the i-th document of the stream
i is NOT the node id, but the doc position within the stream Definition at line 104 of file tree.cpp.
Referenced by docref(), docref(), and sample_docs().
| ConstNodeRef c4::yml::Tree::docref | ( | id_type | i | ) | const |
| ConstNodeRef c4::yml::Tree::cdocref | ( | id_type | i | ) | const |
find a root child (ie child of root) by name, return it as a NodeRef
Definition at line 86 of file tree.cpp.
| ConstNodeRef c4::yml::Tree::operator[] | ( | csubstr | key | ) | const |
find a root child (ie child of root) by name, return it as a NodeRef
Definition at line 90 of file tree.cpp.
| ConstNodeRef c4::yml::Tree::operator[] | ( | id_type | i | ) | const |
Definition at line 456 of file tree.hpp.
Referenced by change_type(), change_type(), duplicate_children_no_rep(), merge_with(), and set_root_as_stream().
Definition at line 458 of file tree.hpp.
Referenced by duplicate_children_no_rep(), find_child_r(), find_sibling(), find_sibling_r(), has_child(), has_sibling(), merge_with(), operator[](), operator[](), sample_quick_overview(), sample_tree_arena(), save_key(), save_key(), set_key(), set_key(), set_key_serialized(), and set_key_serialized().
Definition at line 459 of file tree.hpp.
Definition at line 460 of file tree.hpp.
Definition at line 461 of file tree.hpp.
|
inline |
Definition at line 464 of file tree.hpp.
Referenced by c4::yml::read(), sample_base64(), sample_deserialize_error(), sample_docs(), sample_tree_arena(), save(), save(), set_serialized(), set_serialized(), set_val(), and set_val().
Definition at line 465 of file tree.hpp.
Definition at line 466 of file tree.hpp.
Definition at line 467 of file tree.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 483 of file tree.hpp.
Referenced by deserialize_child(), deserialize_child(), deserialize_child(), insert_child(), set_container_style(), and set_val_tag().
|
inline |
Definition at line 484 of file tree.hpp.
Referenced by parent_is_map(), c4::yml::read(), read(), read(), c4::yml::EventHandlerTree::reset(), sample_docs(), and sample_quick_overview().
|
inline |
Definition at line 485 of file tree.hpp.
Referenced by parent_is_seq(), c4::yml::read(), c4::yml::read(), read(), sample_docs(), and sample_quick_overview().
|
inline |
Definition at line 486 of file tree.hpp.
Referenced by deserialize_key(), deserialize_key(), key(), key_is_null(), key_style(), keysc(), merge_with(), c4::yml::EventHandlerTree::reset(), set_key_style(), and set_key_tag().
|
inline |
Definition at line 487 of file tree.hpp.
Referenced by set_val_style(), set_val_tag(), val(), val_is_null(), val_style(), and valsc().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 499 of file tree.hpp.
|
inline |
Definition at line 500 of file tree.hpp.
|
inline |
true if the node key is empty, or its scalar verifies scalar_is_null().
Definition at line 508 of file tree.hpp.
|
inline |
true if the node val is empty, or its scalar verifies scalar_is_null().
Definition at line 512 of file tree.hpp.
|
inline |
true if the key was a scalar requiring filtering and was left unfiltered during the parsing (see ParserOptions)
Definition at line 516 of file tree.hpp.
|
inline |
true if the val was a scalar requiring filtering and was left unfiltered during the parsing (see ParserOptions)
Definition at line 519 of file tree.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 524 of file tree.hpp.
Referenced by is_anchor_or_ref().
|
inline |
Definition at line 533 of file tree.hpp.
Referenced by depth_asc(), duplicate(), first_sibling(), insert_child(), last_sibling(), move(), move(), num_siblings(), c4::yml::EventHandlerTree::reset(), sample_docs(), set_doc(), set_stream(), sibling_pos(), and val_style().
|
inline |
Definition at line 535 of file tree.hpp.
Referenced by parent_is_map(), and parent_is_seq().
true when ancestor is parent or parent of a parent of node
Definition at line 1273 of file tree.cpp.
Referenced by duplicate_children_no_rep().
|
inline |
true when key and val are empty, and has no children
Definition at line 541 of file tree.hpp.
true if node has a child with id ch
Definition at line 544 of file tree.hpp.
Referenced by duplicate_children(), and duplicate_children_no_rep().
true if node has a child with key key
Definition at line 546 of file tree.hpp.
|
inline |
true if node has any children
Definition at line 548 of file tree.hpp.
Referenced by empty(), merge_with(), and set_root_as_stream().
true if one of the node's siblings has the given key
Definition at line 553 of file tree.hpp.
|
inline |
Definition at line 573 of file tree.hpp.
Referenced by _append_child__unprotected(), append_child(), depth_asc(), duplicate(), duplicate(), duplicate_children(), duplicate_children(), duplicate_children_no_rep(), duplicate_children_no_rep(), insert_child(), is_ancestor(), move(), prepend_child(), c4::yml::EventHandlerTree::reset(), set_doc(), set_key(), set_key(), set_val(), and set_val().
Definition at line 576 of file tree.hpp.
Referenced by child(), child_pos(), clear_style(), duplicate_children(), duplicate_children_no_rep(), find_child(), merge_with(), num_children(), c4::yml::read(), c4::yml::read(), c4::yml::read(), read(), read(), sample_docs(), sample_quick_overview(), set_root_as_stream(), and set_style_conditionally().
O(num_children).
Definition at line 1185 of file tree.cpp.
Referenced by num_siblings(), sample_docs(), and sample_user_container_types().
Definition at line 1193 of file tree.cpp.
Referenced by deserialize_child(), deserialize_child(), deserialize_child(), and sibling_pos().
Definition at line 581 of file tree.hpp.
Referenced by child(), child_pos(), duplicate_children(), duplicate_children_no_rep(), find_child(), merge_with(), num_children(), c4::yml::read(), c4::yml::read(), c4::yml::read(), read(), read(), sample_docs(), sample_quick_overview(), and set_root_as_stream().
find child by position, or NONE if there are less than pos children posi
Definition at line 1206 of file tree.cpp.
Referenced by _append_child__unprotected(), child_r(), clear_style(), doc(), insert_child(), sample_docs(), set_style_conditionally(), and sibling().
find child by name, or NONE if no child is found with this key like Tree::child(), but return a ReadResult with the status
Definition at line 1218 of file tree.cpp.
Referenced by find_child_r(), find_sibling(), has_child(), merge_with(), sample_docs(), and sample_quick_overview().
|
inline |
Definition at line 586 of file tree.hpp.
Referenced by deserialize_child(), deserialize_child(), deserialize_child(), and sibling_r().
|
inline |
like Tree::find_child(), but return a ReadResult with the status
Definition at line 588 of file tree.hpp.
Referenced by deserialize_child(), deserialize_child(), deserialize_child(), and find_sibling_r().
O(num_siblings).
counts with this
Definition at line 592 of file tree.hpp.
Referenced by num_other_siblings().
does not count with this
Definition at line 594 of file tree.hpp.
|
inline |
like Tree::sibling(), but return a ReadResult with the status
Definition at line 601 of file tree.hpp.
|
inline |
like Tree::find_sibling(), but return a ReadResult if with the status
Definition at line 603 of file tree.hpp.
get the document which is a parent document of node i, or the root if the tree is not a stream
Definition at line 612 of file tree.hpp.
Referenced by c4::yml::EventHandlerTree::reset().
|
inline |
Definition at line 632 of file tree.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 662 of file tree.hpp.
Referenced by sample_style_flow_ml_indent().
Definition at line 663 of file tree.hpp.
Definition at line 664 of file tree.hpp.
| void c4::yml::Tree::clear_style | ( | id_type | node, |
| bool | recurse = false ) |
Definition at line 1373 of file tree.cpp.
Referenced by clear_style(), and sample_style().
| void c4::yml::Tree::set_style_conditionally | ( | id_type | node, |
| NodeType | type_mask, | ||
| NodeType | rem_style_flags, | ||
| NodeType | add_style_flags, | ||
| bool | recurse = false ) |
Definition at line 1383 of file tree.cpp.
Referenced by sample_style(), and set_style_conditionally().
|
inline |
|
inline |
Definition at line 692 of file tree.hpp.
Referenced by lookup_path_or_modify(), sample_anchors_and_aliases_create(), sample_lightning_overview(), sample_tree_arena(), c4::yml::write(), and write().
Definition at line 709 of file tree.hpp.
Referenced by merge_with(), write(), and c4::yml::write_key().
|
inline |
|
inline |
Definition at line 735 of file tree.hpp.
Referenced by merge_with(), c4::yml::write(), write(), and write().
Definition at line 746 of file tree.hpp.
Referenced by sample_serialize_basic().
Definition at line 747 of file tree.hpp.
Referenced by sample_serialize_basic().
Definition at line 749 of file tree.hpp.
Referenced by sample_anchors_and_aliases_create(), and sample_serialize_basic().
Definition at line 750 of file tree.hpp.
Referenced by sample_anchors_and_aliases_create(), and sample_serialize_basic().
Definition at line 751 of file tree.hpp.
Definition at line 752 of file tree.hpp.
Referenced by sample_anchors_and_aliases_create().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 776 of file tree.hpp.
Referenced by sample_serialize_basic(), and sample_user_container_types().
|
inline |
Definition at line 798 of file tree.hpp.
Referenced by sample_serialize_basic().
|
inline |
Definition at line 827 of file tree.hpp.
Referenced by sample_base64(), sample_empty_null_values(), sample_serialize_basic(), c4::yml::write(), c4::yml::write(), write(), write(), and write().
|
inline |
Definition at line 841 of file tree.hpp.
Referenced by sample_serialize_basic(), c4::yml::write(), write(), and c4::yml::write_key().
|
inlinestaticnoexcept |
|
inlinestaticnoexcept |
|
inline |
(1) deserialize the node's contents (val or container) to the given variable, forwarding to the user-overrideable read() function (see Read from Tree).
This function differs from Tree::deserialize() in that here the error callback is called if the deserialization failed, or (optionally) the node is not readable.
Definition at line 875 of file tree.hpp.
Referenced by sample_base64(), sample_error_visit(), sample_error_visit_location(), sample_fundamental_types(), sample_serialize_basic(), and sample_user_container_types().
|
inline |
(2) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 892 of file tree.hpp.
|
inline |
(1) deserialize the node's key (necessarily a scalar) to the given variable, forwarding to the user-overrideable read_key() function (see Read from ConstNodeRef).
This function differs from Tree::deserialize_key() in that here the error callback is called if the deserialization failed, or (optionally) the node is not readable.
Definition at line 916 of file tree.hpp.
Referenced by sample_base64(), and sample_serialize_basic().
|
inline |
(2) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 933 of file tree.hpp.
|
inline |
(1) deserialize a node's contents to a variable
Definition at line 958 of file tree.hpp.
Referenced by deserialize_child(), deserialize_child(), deserialize_child(), deserialize_child(), deserialize_child(), deserialize_child(), c4::yml::read(), c4::yml::read(), read(), read(), sample_base64(), and sample_serialize_basic().
|
inline |
|
inline |
(1) deserialize a node's key to a variable
Definition at line 979 of file tree.hpp.
Referenced by c4::yml::read(), read(), and sample_serialize_basic().
|
inline |
|
inline |
(1) find a child by name and deserialize its contents to the given variable (ie call .deserialize() on the child if it exists).
Otherwise, the variable is kept unchanged.
Definition at line 1015 of file tree.hpp.
Referenced by read().
|
inline |
|
inline |
(3) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 1035 of file tree.hpp.
|
inline |
(1) find a child by position and deserialize its contents to the given variable (ie call .deserialize() on the child if it exists).
Otherwise, the variable is kept unchanged.
Definition at line 1054 of file tree.hpp.
|
inline |
(2) like (1), but assign from fallback if no such child exists
Definition at line 1065 of file tree.hpp.
|
inline |
(3) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 1077 of file tree.hpp.
| void c4::yml::Tree::reorder | ( | ) |
reorder the tree in memory so that all the nodes are stored in a linear sequence when visited in depth-first order.
This will invalidate existing ids, since the node id is its position in the tree's node array.
| void c4::yml::Tree::resolve | ( | ReferenceResolver * | rr, |
| ResolveOptions const & | opts = {} ) |
Resolve references (aliases <- anchors), by forwarding to ReferenceResolver::resolve().
Definition at line 1175 of file tree.cpp.
Referenced by resolve(), sample_anchors_and_aliases(), and sample_anchors_and_aliases_create().
| void c4::yml::Tree::resolve | ( | ResolveOptions const & | opts = {} | ) |
Resolve references (aliases <- anchors), by forwarding to ReferenceResolver::resolve().
This overload uses a throwaway resolver object.
Definition at line 1167 of file tree.cpp.
| void c4::yml::Tree::resolve_tags | ( | TagCache & | cache, |
| bool | all = true ) |
Resolve tags in the tree such as "!!str" -> "<tag:yaml.org,2002:str>", "!foo" -> "<!foo>" and custom tags as well, ie tags of the form "!handle!tag" for which there is a corresponding "%TAG" directive.
| cache | an object of type TagCache to minimize memory usage by avoiding repeated instantiation of the resolved tags in the tree's arena. |
| all | if true, resolve all tags; if false resolve only custom tags, ie those that have a prefix such as "!m!tag" with a matching "\%TAG" directive |
Definition at line 1522 of file tree.cpp.
Referenced by sample_tag_directives().
| void c4::yml::Tree::normalize_tags | ( | ) |
Definition at line 1540 of file tree.cpp.
Referenced by sample_tags().
| void c4::yml::Tree::normalize_tags_long | ( | ) |
Definition at line 1547 of file tree.cpp.
Referenced by sample_tags().
| id_type c4::yml::Tree::num_tag_directives | ( | ) | const |
Definition at line 1413 of file tree.cpp.
Referenced by sample_error_basic().
| void c4::yml::Tree::clear_tag_directives | ( | ) |
resolve the given tag, appearing at node_id.
Write the result into output.
Definition at line 1425 of file tree.cpp.
Referenced by resolve_tag_sub().
Wrapper for Tree::resolve_tag(), returning a substring.
Definition at line 1159 of file tree.hpp.
|
inline |
create and insert a new child of parent.
insert after the (to-be) sibling after, which must be a child of parent. To insert as the first child, set after to NONE
Definition at line 1182 of file tree.hpp.
Referenced by append_child(), insert_child(), insert_sibling(), and prepend_child().
create and insert a node as the first child of parent
Definition at line 1192 of file tree.hpp.
Referenced by prepend_sibling().
create and insert a node as the last child of parent
Definition at line 1194 of file tree.hpp.
Referenced by append_sibling(), merge_with(), set_root_as_stream(), c4::yml::write(), write(), write(), write(), and write().
create and insert a new sibling of n. insert after "after"
create and insert a node as the first node of parent
Definition at line 1210 of file tree.hpp.
Definition at line 1211 of file tree.hpp.
|
inline |
remove an entire branch at once: ie remove the children and the node itself
Definition at line 1216 of file tree.hpp.
Referenced by duplicate_children_no_rep(), and move().
| void c4::yml::Tree::remove_children | ( | id_type | node | ) |
remove all the node's children, but keep the node itself
Definition at line 886 of file tree.cpp.
Referenced by change_type(), merge_with(), remove(), and remove_children().
change the node's position in the parent
Definition at line 786 of file tree.cpp.
Referenced by duplicate_children_no_rep(), and set_root_as_stream().
change the node's parent and position to a different tree
Definition at line 812 of file tree.cpp.
| void c4::yml::Tree::set_root_as_stream | ( | ) |
ensure the first node is a stream.
Eg, change this tree
DOCMAP MAP KEYVAL KEYVAL SEQ VAL
to
STREAM DOCMAP MAP KEYVAL KEYVAL SEQ VAL
If the root is already a stream, this is a no-op.
Definition at line 824 of file tree.cpp.
Definition at line 909 of file tree.cpp.
Referenced by change_type().
recursively duplicate a node from this tree into a new parent, placing it after one of its children
Definition at line 929 of file tree.cpp.
Referenced by duplicate(), duplicate_children(), duplicate_children_no_rep(), and move().
| id_type c4::yml::Tree::duplicate | ( | Tree const * | src, |
| id_type | node, | ||
| id_type | new_parent, | ||
| id_type | after ) |
recursively duplicate a node from a different tree into a new parent, placing it after one of its children
Definition at line 934 of file tree.cpp.
recursively duplicate the node's children (but not the node)
Definition at line 952 of file tree.cpp.
Referenced by duplicate(), duplicate_children(), and duplicate_contents().
| id_type c4::yml::Tree::duplicate_children | ( | Tree const * | src, |
| id_type | node, | ||
| id_type | parent, | ||
| id_type | after ) |
recursively duplicate the node's children (but not the node), where the node is from a different tree
Definition at line 957 of file tree.cpp.
duplicate the node's children (but not the node) in a new parent, but omit repetitions where a duplicated node has the same key (in maps) or value (in seqs).
If one of the duplicated children has the same key (in maps) or value (in seqs) as one of the parent's children, the one that is placed closest to the end will prevail.
Definition at line 989 of file tree.cpp.
Referenced by duplicate_children_no_rep().
| id_type c4::yml::Tree::duplicate_children_no_rep | ( | Tree const * | src, |
| id_type | node, | ||
| id_type | parent, | ||
| id_type | after ) |
Definition at line 994 of file tree.cpp.
Definition at line 974 of file tree.cpp.
Referenced by duplicate_contents().
| void c4::yml::Tree::merge_with | ( | Tree const * | src, |
| id_type | src_node = NONE, | ||
| id_type | dst_root = NONE ) |
Definition at line 1090 of file tree.cpp.
Referenced by lookup_path_or_modify(), and merge_with().
Get the location of a node from the parse used to parse this tree.
Definition at line 1882 of file tree.cpp.
Referenced by sample_deserialize_error(), sample_error_visit_location(), and sample_location_tracking().
|
inline |
|
inline |
|
inline |
get the current slack of the tree's internal arena
Definition at line 1327 of file tree.hpp.
Referenced by alloc_arena().
|
inline |
|
inline |
get the current arena
Definition at line 1331 of file tree.hpp.
Referenced by sample_empty_null_values(), sample_fundamental_types(), sample_quick_overview(), sample_tree_arena(), and sample_user_container_types().
|
inline |
|
inline |
get the free space at the end of the arena
Definition at line 1336 of file tree.hpp.
Referenced by c4::yml::serialize_to_arena_scalar().
|
inline |
|
inline |
return true if the given substring is part of the tree's string arena
Definition at line 1341 of file tree.hpp.
Referenced by sample_quick_overview().
|
inline |
serialize the given variable to the tree's arena, growing it as needed to accomodate the serialization.
Definition at line 1363 of file tree.hpp.
Referenced by sample_fundamental_types(), and sample_tree_arena().
copy the given string to the tree's arena, growing the arena by the required size.
Definition at line 1384 of file tree.hpp.
Referenced by sample_tree_arena().
|
inline |
grow the tree's string arena by the given size and return a substr of the added portion
Definition at line 1411 of file tree.hpp.
Referenced by copy_to_arena(), and sample_tree_arena().
|
inline |
ensure the tree's internal string arena is at least the given capacity
Definition at line 1423 of file tree.hpp.
Referenced by Tree(), sample_global_allocator(), sample_parse_reuse_tree(), and sample_tree_arena().
| Tree::lookup_result c4::yml::Tree::lookup_path | ( | csubstr | path, |
| id_type | start = NONE ) const |
for example foo.bar[0].baz
Definition at line 1577 of file tree.cpp.
| id_type c4::yml::Tree::lookup_path_or_modify | ( | csubstr | default_value, |
| csubstr | path, | ||
| id_type | start = NONE ) |
defaulted lookup: lookup path; if the lookup fails, recursively modify the tree so that the corresponding lookup_path() would return the default value.
| id_type c4::yml::Tree::lookup_path_or_modify | ( | Tree const * | src, |
| id_type | src_node, | ||
| csubstr | path, | ||
| id_type | start = NONE ) |
defaulted lookup: lookup path; if the lookup fails, recursively modify the tree so that the corresponding lookup_path() would return the branch src_node (from the tree src).
Definition at line 1597 of file tree.cpp.
| NodeData* c4::yml::Tree::m_buf |
| id_type c4::yml::Tree::m_cap |
Definition at line 1689 of file tree.hpp.
Referenced by Tree(), capacity(), clear(), cref(), deserialize(), deserialize(), deserialize_key(), deserialize_key(), get(), get(), id(), ref(), ref(), reserve(), set_key_serialized(), set_key_serialized(), set_serialized(), set_serialized(), and slack().
| id_type c4::yml::Tree::m_size |
| id_type c4::yml::Tree::m_free_head |
Definition at line 1692 of file tree.hpp.
Referenced by Tree(), clear(), and set_root_as_stream().
| id_type c4::yml::Tree::m_free_tail |
| id_type c4::yml::Tree::m_first_unused |
| substr c4::yml::Tree::m_arena |
Definition at line 1696 of file tree.hpp.
Referenced by Tree(), arena(), arena(), arena_capacity(), arena_rem(), arena_rem(), arena_slack(), copy_to_arena(), in_arena(), reserve_arena(), resolve_tags(), and c4::yml::serialize_to_arena_str().
| size_t c4::yml::Tree::m_arena_pos |
Definition at line 1697 of file tree.hpp.
Referenced by Tree(), arena(), arena(), arena_pos(), arena_rem(), arena_rem(), arena_size(), arena_slack(), clear_arena(), and c4::yml::serialize_to_arena_scalar().
| Callbacks c4::yml::Tree::m_callbacks |
Definition at line 1699 of file tree.hpp.
Referenced by Tree(), Tree(), Tree(), _p(), _p(), add_tag_directive(), arena_slack(), callbacks(), callbacks(), change_type(), child(), child_pos(), clear(), copy_to_arena(), cref(), depth_asc(), depth_desc(), deserialize(), deserialize(), deserialize_child(), deserialize_child(), deserialize_child(), deserialize_key(), deserialize_key(), doc(), duplicate(), duplicate_children(), duplicate_children_no_rep(), duplicate_contents(), c4::yml::detail::RoNodeMethods< NodeRef, ConstNodeRef >::err_visit_(), find_child(), get(), get(), id(), insert_child(), is_ancestor(), is_root(), key(), key_anchor(), key_is_null(), key_ref(), key_style(), key_tag(), keysc(), load(), load(), load_key(), load_key(), merge_with(), move(), move(), move(), num_other_siblings(), operator=(), operator=(), parent_is_map(), parent_is_seq(), ref(), ref(), remove_children(), reserve(), reserve_arena(), root_id(), set_container_style(), set_doc(), set_key(), set_key(), set_key_anchor(), set_key_ref(), set_key_serialized(), set_key_serialized(), set_key_style(), set_key_tag(), set_map(), set_map(), set_root_as_stream(), set_seq(), set_seq(), set_serialized(), set_serialized(), set_stream(), set_val(), set_val(), set_val_anchor(), set_val_ref(), set_val_style(), set_val_tag(), sibling_pos(), val(), val_anchor(), val_is_null(), val_ref(), val_style(), val_tag(), and valsc().
| TagDirectives c4::yml::Tree::m_tag_directives |
Definition at line 1701 of file tree.hpp.
Referenced by Tree(), add_tag_directive(), clear(), clear_tag_directives(), num_tag_directives(), resolve_tag(), set_root_as_stream(), and tag_directives().