|
rapidyaml 0.15.2
parse and emit YAML, and do it fast
|
A reference to a node in an existing yaml tree, offering a more convenient API than the index-based API used in the tree. More...
#include <node.hpp>
Public Types | |
| using | tree_type = Tree |
| using | base_type = detail::RoNodeMethods<NodeRef, ConstNodeRef> |
Public Member Functions | |
construction | |
| NodeRef () noexcept | |
| NodeRef (Tree &t) noexcept | |
| NodeRef (Tree *t) noexcept | |
| NodeRef (Tree *t, id_type id) noexcept | |
| NodeRef (Tree *t, id_type id, id_type seed_pos) noexcept | |
| NodeRef (Tree *t, id_type id, csubstr seed_key) noexcept | |
assignment | |
| NodeRef (NodeRef const &) noexcept=default | |
| NodeRef (NodeRef &&) noexcept=default | |
| NodeRef & | operator= (NodeRef const &) noexcept=default |
| NodeRef & | operator= (NodeRef &&) noexcept=default |
state_queries | |
| bool | invalid () const noexcept |
| true if the object is not referring to any existing or seed node. | |
| bool | is_seed () const noexcept |
| true if the object is not invalid and in seed state. | |
| bool | readable () const noexcept |
| true if the object is not invalid and not in seed state. | |
comparisons | |
| bool | operator== (NodeRef const &that) const |
| bool | operator!= (NodeRef const &that) const |
| bool | operator== (ConstNodeRef const &that) const |
| bool | operator!= (ConstNodeRef const &that) const |
node_property_getters | |
| id_type | id () const noexcept |
| Tree const * | tree () const noexcept |
| Tree * | tree () noexcept |
| NodeData const * | get () const RYML_NOEXCEPT |
| Forward to Tree::type(). | |
| NodeData * | get () RYML_NOEXCEPT |
| Forward to Tree::type(). | |
node_setters | |
| void | create () |
| if this node is in seed state, create the node in the tree | |
| void | set_stream () |
| void | set_doc () |
| void | set_key (csubstr key) |
| void | set_key (csubstr key, NodeType more_flags) |
| void | set_val (csubstr val) |
| void | set_val (csubstr val, NodeType more_flags) |
| void | set_seq () |
| void | set_seq (NodeType more_flags) |
| void | set_map () |
| void | set_map (NodeType more_flags) |
| void | set_key_tag (csubstr key_tag) |
| void | set_val_tag (csubstr val_tag) |
| void | set_key_anchor (csubstr key_anchor) |
| void | set_val_anchor (csubstr val_anchor) |
| void | set_key_ref (csubstr key_ref) |
| void | set_val_ref (csubstr val_ref) |
| void | set_container_style (type_bits style) |
| void | set_key_style (type_bits style) |
| void | set_val_style (type_bits style) |
node_modifiers | |
| void | change_type (NodeType t) |
| void | clear_key () |
| remove the KEY (flags included) from a scalar | |
| void | clear_val () |
| remove the VAL (flags included) from a scalar | |
| void | clear_children () |
| remove the children from a scalar | |
| void | clear_style (bool recurse=false) |
| void | set_style_conditionally (NodeType type_mask, NodeType rem_style_flags, NodeType add_style_flags, bool recurse=false) |
serialization | |
| template<class T> | |
| csubstr | to_arena (T const &s) |
| forward to Tree::to_arena() . | |
| template<class T> | |
| void | save (T const &k) |
| template<class T> | |
| void | save (T const &k, NodeType style_flags) |
| template<class T> | |
| void | save_key (T const &k) |
| template<class T> | |
| void | save_key (T const &k, NodeType style_flags) |
| template<class T> | |
| void | set_serialized (T const &v) |
| serialize a variable to this node. | |
| template<class T> | |
| void | set_serialized (T const &v, NodeType style_flags) |
| template<class T> | |
| void | set_key_serialized (T const &k) |
| serialize a variable, then assign the result to the node's key | |
| template<class T> | |
| void | set_key_serialized (T const &k, NodeType style_flags) |
hierarchy getters | |
| NodeRef | parent () RYML_NOEXCEPT |
| Forward to Tree::parent(). | |
| ConstNodeRef | parent () const RYML_NOEXCEPT |
| Forward to Tree::parent(). | |
| NodeRef | first_child () RYML_NOEXCEPT |
| Forward to Tree::first_child(). | |
| ConstNodeRef | first_child () const RYML_NOEXCEPT |
| Forward to Tree::first_child(). | |
| NodeRef | last_child () RYML_NOEXCEPT |
| Forward to Tree::last_child(). | |
| ConstNodeRef | last_child () const RYML_NOEXCEPT |
| Forward to Tree::last_child(). | |
| NodeRef | child (id_type pos) RYML_NOEXCEPT |
| Forward to Tree::child(). | |
| ConstNodeRef | child (id_type pos) const RYML_NOEXCEPT |
| Forward to Tree::child(). | |
| ReadResult | child_r (id_type pos, NodeRef *child) RYML_NOEXCEPT |
| ReadResult | child_r (id_type pos, ConstNodeRef *child) const RYML_NOEXCEPT |
| Forward to Tree::child_r(). | |
| NodeRef | find_child (csubstr name) RYML_NOEXCEPT |
| Forward to Tree::child_r(). | |
| ConstNodeRef | find_child (csubstr name) const RYML_NOEXCEPT |
| Forward to Tree::find_child(). | |
| ReadResult | find_child_r (csubstr name, NodeRef *child) RYML_NOEXCEPT |
| ReadResult | find_child_r (csubstr name, ConstNodeRef *child) const RYML_NOEXCEPT |
| Forward to Tree::find_child_r(). | |
| NodeRef | prev_sibling () RYML_NOEXCEPT |
| Forward to Tree::find_child_r(). | |
| ConstNodeRef | prev_sibling () const RYML_NOEXCEPT |
| Forward to Tree::prev_sibling(). | |
| NodeRef | next_sibling () RYML_NOEXCEPT |
| Forward to Tree::next_sibling(). | |
| ConstNodeRef | next_sibling () const RYML_NOEXCEPT |
| Forward to Tree::next_sibling(). | |
| NodeRef | first_sibling () RYML_NOEXCEPT |
| Forward to Tree::first_sibling(). | |
| ConstNodeRef | first_sibling () const RYML_NOEXCEPT |
| Forward to Tree::first_sibling(). | |
| NodeRef | last_sibling () RYML_NOEXCEPT |
| Forward to Tree::last_sibling(). | |
| ConstNodeRef | last_sibling () const RYML_NOEXCEPT |
| Forward to Tree::last_sibling(). | |
| NodeRef | sibling (id_type pos) RYML_NOEXCEPT |
| Forward to Tree::sibling(). | |
| ConstNodeRef | sibling (id_type pos) const RYML_NOEXCEPT |
| Forward to Tree::sibling(). | |
| ReadResult | sibling_r (id_type pos, NodeRef *sibling) RYML_NOEXCEPT |
| ReadResult | sibling_r (id_type pos, ConstNodeRef *sibling) const RYML_NOEXCEPT |
| Forward to Tree::sibling_r(). | |
| NodeRef | find_sibling (csubstr name) RYML_NOEXCEPT |
| Forward to Tree::sibling_r(). | |
| ConstNodeRef | find_sibling (csubstr name) const RYML_NOEXCEPT |
| Forward to Tree::find_sibling(). | |
| ReadResult | find_sibling_r (csubstr name, NodeRef *sibling) RYML_NOEXCEPT |
| ReadResult | find_sibling_r (csubstr name, ConstNodeRef *sibling) const RYML_NOEXCEPT |
| Forward to Tree::find_sibling_r(). | |
| NodeRef | ancestor_doc () RYML_NOEXCEPT |
| Forward to Tree::find_sibling_r(). | |
| ConstNodeRef | ancestor_doc () const RYML_NOEXCEPT |
| Forward to Tree::ancestor_doc(). | |
| NodeRef | doc (id_type i) RYML_NOEXCEPT |
| Forward to Tree::doc(). | |
| ConstNodeRef | doc (id_type i) const RYML_NOEXCEPT |
| Forward to Tree::doc(). | |
square_brackets | |
operator[] | |
| NodeRef | operator[] (csubstr key) RYML_NOEXCEPT |
| Find child by key; complexity is O(num_children). | |
| NodeRef | operator[] (id_type pos) RYML_NOEXCEPT |
| Find child by position; complexity is O(pos). | |
| ConstNodeRef | operator[] (csubstr key) const RYML_NOEXCEPT |
| Find a child by key; complexity is O(num_children). | |
| ConstNodeRef | operator[] (id_type pos) const RYML_NOEXCEPT |
| Find a child by position; complexity is O(pos). | |
at | |
These functions are the analogue to operator[], with the difference that they emit an error instead of an assertion. That is, if any of the pre or post conditions is violated, an error is always emitted (resulting in a call to the error callback). | |
| NodeRef | at (csubstr key) |
| Find child by key; complexity is O(num_children). | |
| NodeRef | at (id_type pos) |
| Find child by position; complexity is O(pos). | |
| ConstNodeRef | at (csubstr key) const |
| Get a child by name, with error checking; complexity is O(num_children). | |
| ConstNodeRef | at (id_type pos) const |
| Get a child by position, with error checking; complexity is O(pos). | |
modification of hierarchy | |
| NodeRef | insert_child (NodeRef after) |
| NodeRef | prepend_child () |
| NodeRef | append_child () |
| NodeRef | insert_sibling (ConstNodeRef const &after) |
| NodeRef | prepend_sibling () |
| NodeRef | append_sibling () |
| void | remove_child (NodeRef &child) |
| void | remove_child (id_type pos) |
| remove the nth child of this node | |
| void | remove_child (csubstr key) |
| remove a child by name | |
| void | move (NodeRef const &parent, ConstNodeRef const &after) |
move the node to a different parent (which may belong to a different tree), placing it after after. | |
| NodeRef | duplicate (NodeRef const &parent, ConstNodeRef const &after) const |
duplicate the current node somewhere into a different parent (possibly from a different tree), and place it after the node after. | |
| NodeRef | duplicate_children (NodeRef const &parent, ConstNodeRef const &after) const |
legacy operators | |
get an iterable view over all siblings (including the calling node) these methods will be removed in future releases. If you disagree with a particular function being deprecated, let us know by opening a new issue at https://github.com/biojppm/rapidyaml/issues | |
| void | operator= (type_bits t) |
| void | operator|= (type_bits t) |
| NodeRef & | operator= (csubstr v) |
| template<size_t N> | |
| NodeRef & | operator= (const char(&v)[N]) |
| NodeRef & | operator= (std::nullptr_t) |
| template<class T> | |
| NodeRef & | operator= (Key< T > const &v) |
| template<class T> | |
| NodeRef & | operator<< (T const &v) |
| NodeRef & | operator<< (csubstr v) |
| template<class T> | |
| NodeRef & | operator<< (Key< T > const &v) |
node property getters | |
| NodeType | type () const RYML_NOEXCEPT |
| Forward to Tree::type(). | |
| csubstr | key () const RYML_NOEXCEPT |
| Forward to Tree::key(). | |
| csubstr | key_tag () const RYML_NOEXCEPT |
| Forward to Tree::key_tag(). | |
| csubstr | key_ref () const RYML_NOEXCEPT |
| Forward to Tree::key_ref(). | |
| csubstr | key_anchor () const RYML_NOEXCEPT |
| Forward to Tree::key_anchor(). | |
| csubstr | val () const RYML_NOEXCEPT |
| Forward to Tree::val(). | |
| csubstr | val_tag () const RYML_NOEXCEPT |
| Forward to Tree::val_tag(). | |
| csubstr | val_ref () const RYML_NOEXCEPT |
| Forward to Tree::val_ref(). | |
| csubstr | val_anchor () const RYML_NOEXCEPT |
| Forward to Tree::val_anchor(). | |
| NodeScalar const & | keysc () const RYML_NOEXCEPT |
| Forward to Tree::keysc(). | |
| NodeScalar const & | valsc () const RYML_NOEXCEPT |
| Forward to Tree::valsc(). | |
| bool | key_is_null () const RYML_NOEXCEPT |
| Forward to Tree::key_is_null(). | |
| bool | val_is_null () const RYML_NOEXCEPT |
| Forward to Tree::val_is_null(). | |
| bool | is_key_unfiltered () const noexcept |
| Forward to Tree::is_key_unfiltered(). | |
| bool | is_val_unfiltered () const noexcept |
| Forward to Tree::is_val_unfiltered(). | |
node type predicates | |
| bool | empty () const RYML_NOEXCEPT |
| Forward to Tree::empty(). | |
| bool | is_stream () const RYML_NOEXCEPT |
| Forward to Tree::is_stream(). | |
| bool | is_doc () const RYML_NOEXCEPT |
| Forward to Tree::is_doc(). | |
| bool | is_container () const RYML_NOEXCEPT |
| Forward to Tree::is_container(). | |
| bool | is_map () const RYML_NOEXCEPT |
| Forward to Tree::is_map(). | |
| bool | is_seq () const RYML_NOEXCEPT |
| Forward to Tree::is_seq(). | |
| bool | has_val () const RYML_NOEXCEPT |
| Forward to Tree::has_val(). | |
| bool | has_key () const RYML_NOEXCEPT |
| Forward to Tree::has_key(). | |
| bool | is_val () const RYML_NOEXCEPT |
| Forward to Tree::is_val(). | |
| bool | is_keyval () const RYML_NOEXCEPT |
| Forward to Tree::is_keyval(). | |
| bool | has_key_tag () const RYML_NOEXCEPT |
| Forward to Tree::has_key_tag(). | |
| bool | has_val_tag () const RYML_NOEXCEPT |
| Forward to Tree::has_val_tag(). | |
| bool | has_key_anchor () const RYML_NOEXCEPT |
| Forward to Tree::has_key_anchor(). | |
| bool | has_val_anchor () const RYML_NOEXCEPT |
| Forward to Tree::has_val_anchor(). | |
| bool | has_anchor () const RYML_NOEXCEPT |
| Forward to Tree::has_anchor(). | |
| bool | is_key_ref () const RYML_NOEXCEPT |
| Forward to Tree::is_key_ref(). | |
| bool | is_val_ref () const RYML_NOEXCEPT |
| Forward to Tree::is_val_ref(). | |
| bool | is_ref () const RYML_NOEXCEPT |
| Forward to Tree::is_ref(). | |
| bool | parent_is_seq () const RYML_NOEXCEPT |
| Forward to Tree::parent_is_seq(). | |
| bool | parent_is_map () const RYML_NOEXCEPT |
| Forward to Tree::parent_is_map(). | |
style predicates | |
| bool | type_has_any (type_bits bits) const RYML_NOEXCEPT |
| Forward to Tree::type_has_any(). | |
| bool | type_has_all (type_bits bits) const RYML_NOEXCEPT |
| Forward to Tree::type_has_all(). | |
| bool | type_has_none (type_bits bits) const RYML_NOEXCEPT |
| Forward to Tree::type_has_none(). | |
| NodeType | key_style () const RYML_NOEXCEPT |
| Forward to Tree::key_style(). | |
| NodeType | val_style () const RYML_NOEXCEPT |
| Forward to Tree::val_style(). | |
| bool | is_container_styled () const RYML_NOEXCEPT |
| Forward to Tree::is_container_styled(). | |
| bool | is_block () const RYML_NOEXCEPT |
| Forward to Tree::is_block(). | |
| bool | is_flow () const RYML_NOEXCEPT |
| Forward to Tree::is_flow(). | |
| bool | is_flow_sl () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_sl(). | |
| bool | is_flow_ml () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_ml1(). | |
| bool | is_flow_ml1 () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_ml1(). | |
| bool | is_flow_mln () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_mln(). | |
| bool | is_flow_mlx () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_mlx(). | |
| bool | has_flow_space () const RYML_NOEXCEPT |
| Forward to Tree::has_flow_space(). | |
| bool | is_key_styled () const RYML_NOEXCEPT |
| Forward to Tree::is_key_styled(). | |
| bool | is_val_styled () const RYML_NOEXCEPT |
| Forward to Tree::is_val_styled(). | |
| bool | is_key_literal () const RYML_NOEXCEPT |
| Forward to Tree::is_key_literal(). | |
| bool | is_val_literal () const RYML_NOEXCEPT |
| Forward to Tree::is_val_literal(). | |
| bool | is_key_folded () const RYML_NOEXCEPT |
| Forward to Tree::is_key_folded(). | |
| bool | is_val_folded () const RYML_NOEXCEPT |
| Forward to Tree::is_val_folded(). | |
| bool | is_key_squo () const RYML_NOEXCEPT |
| Forward to Tree::is_key_squo(). | |
| bool | is_val_squo () const RYML_NOEXCEPT |
| Forward to Tree::is_val_squo(). | |
| bool | is_key_dquo () const RYML_NOEXCEPT |
| Forward to Tree::is_key_dquo(). | |
| bool | is_val_dquo () const RYML_NOEXCEPT |
| Forward to Tree::is_val_dquo(). | |
| bool | is_key_plain () const RYML_NOEXCEPT |
| Forward to Tree::is_key_plain(). | |
| bool | is_val_plain () const RYML_NOEXCEPT |
| Forward to Tree::is_val_plain(). | |
| bool | is_key_quoted () const RYML_NOEXCEPT |
| Forward to Tree::is_key_quoted(). | |
| bool | is_val_quoted () const RYML_NOEXCEPT |
| Forward to Tree::is_val_quoted(). | |
| bool | is_quoted () const RYML_NOEXCEPT |
| Forward to Tree::is_quoted(). | |
hierarchy predicates | |
| bool | is_root () const RYML_NOEXCEPT |
| Forward to Tree::is_root(). | |
| bool | has_parent () const RYML_NOEXCEPT |
| Forward to Tree::has_parent() Node must be readable. | |
| bool | is_ancestor (ConstNodeRef const &ancestor) const RYML_NOEXCEPT |
| Forward to Tree::is_ancestor() Node must be readable. | |
| bool | has_child (ConstNodeRef const &n) const RYML_NOEXCEPT |
| Forward to Tree::has_child(). | |
| bool | has_child (id_type node) const RYML_NOEXCEPT |
| Forward to Tree::has_child(). | |
| bool | has_child (csubstr name) const RYML_NOEXCEPT |
| Forward to Tree::has_child(). | |
| bool | has_children () const RYML_NOEXCEPT |
| Forward to Tree::has_children(). | |
| bool | has_sibling (ConstNodeRef const &n) const RYML_NOEXCEPT |
| Forward to Tree::has_sibling(). | |
| bool | has_sibling (id_type node) const RYML_NOEXCEPT |
| Forward to Tree::has_sibling(). | |
| bool | has_sibling (csubstr name) const RYML_NOEXCEPT |
| Forward to Tree::has_sibling(). | |
| bool | has_other_siblings () const RYML_NOEXCEPT |
| Forward to Tree::has_other_siblings(). | |
hierarchy getters | |
| id_type | num_children () const RYML_NOEXCEPT |
| O(num_children). | |
| id_type | num_siblings () const RYML_NOEXCEPT |
| O(num_children). | |
| id_type | num_other_siblings () const RYML_NOEXCEPT |
| O(num_siblings). | |
| id_type | child_pos (ConstNodeRef const &n) const RYML_NOEXCEPT |
| O(num_children). | |
| id_type | sibling_pos (ConstNodeRef const &n) const RYML_NOEXCEPT |
| O(num_siblings). | |
| id_type | depth_asc () const RYML_NOEXCEPT |
| id_type | depth_desc () const RYML_NOEXCEPT |
| O(log(num_nodes)). | |
locations | |
O(num_nodes). Forward to Tree::depth_desc(). Node must be readable. | |
| Location | location (Parser const &parser) const |
deserialization: fully checked for lazy code | |
These methods raise an error if the deserialization failed or optionally if the node is not readable. | |
| void | load (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, which can be for ConstNodeRef (see Read from ConstNodeRef) or for tree+id (see Read from Tree). | |
| void | load (Wrapper const &wrapper, bool check_readable=true) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() | |
| void | load_key (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, which can be for ConstNodeRef (see Read from ConstNodeRef) or for tree+id (see Read from Tree). | |
| void | load_key (Wrapper const &wrapper, bool check_readable=true) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() | |
deserialization: asserts node readability, returns success status | |
| ReadResult | deserialize (T *v) const |
| (1) deserialize the node's contents (val or container) to the given variable, forwarding to the user-overrideable read() function (see Read from ConstNodeRef). | |
| ReadResult | deserialize (Wrapper const &wrapper) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() | |
| ReadResult | deserialize_key (T *v) 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). | |
| ReadResult | deserialize_key (Wrapper const &wrapper) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() | |
lookup and deserialize | |
| ReadResult | deserialize_child (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). | |
| ReadResult | deserialize_child (csubstr child_key, T *v, T const &fallback) const |
| (2) like (1), but assign from fallback if no such child exists. | |
| ReadResult | deserialize_child (csubstr child_key, Wrapper const &v) const |
| (3) like (1), but for wrapper tag types such as c4::fmt::base64() | |
| ReadResult | deserialize_child (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). | |
| ReadResult | deserialize_child (id_type child_pos, T *v, T const &fallback) const |
| (2) like (1), but assign from fallback if no such child exists | |
| ReadResult | deserialize_child (id_type child_pos, Wrapper const &wrapper) const |
| (3) like (1), but for wrapper tag types such as c4::fmt::base64() | |
legacy operators | |
| NodeRef const & | operator>> (T &v) const |
| NodeRef const & | operator>> (T const &wrapper) const |
| NodeRef const & | operator>> (Key< T > const &v) const |
Protected Member Functions | |
| void | check_val_ () const |
| void | check_key_ () const |
| void | assert_val_ () const noexcept |
| void | assert_key_ () const noexcept |
Static Protected Member Functions | |
| static void | err_basic_ (const char *msg) |
| static void | err_visit_ (Tree const *tree, id_type id, const char *msg) |
Friends | |
| struct | detail::RoNodeMethods< NodeRef, ConstNodeRef > |
iteration | |
| using | iterator = detail::child_iterator<NodeRef> |
| using | const_iterator = detail::child_iterator<ConstNodeRef> |
| using | children_view = detail::children_view<NodeRef> |
| using | const_children_view = detail::children_view<ConstNodeRef> |
| iterator | begin () RYML_NOEXCEPT |
| get a mutable iterator to the first child. | |
| const_iterator | begin () const RYML_NOEXCEPT |
| get an iterator to the first child | |
| const_iterator | cbegin () const RYML_NOEXCEPT |
| get an iterator to the first child | |
| iterator | end () RYML_NOEXCEPT |
| get an iterator to after the last child. | |
| const_iterator | end () const RYML_NOEXCEPT |
| get an iterator to after the last child | |
| const_iterator | cend () const RYML_NOEXCEPT |
| get an iterator to after the last child | |
| children_view | children () RYML_NOEXCEPT |
| get an iterable view over children | |
| const_children_view | children () const RYML_NOEXCEPT |
| get an iterable view over children | |
| const_children_view | cchildren () const RYML_NOEXCEPT |
| get an iterable view over children | |
| children_view | siblings () RYML_NOEXCEPT |
| const_children_view | siblings () const RYML_NOEXCEPT |
| get an iterable view over all siblings (including the calling node) | |
| const_children_view | csiblings () const RYML_NOEXCEPT |
| get an iterable view over all siblings (including the calling node) | |
A reference to a node in an existing yaml tree, offering a more convenient API than the index-based API used in the tree.
Unlike its imutable ConstNodeRef peer, a NodeRef can be used to mutate the tree, both by writing to existing nodes and by creating new nodes to subsequently write to. Semantically, a NodeRef object can be in one of three states:
So both readable and seed are states where the node is also valid.
When the object is in seed state, using it to read from the tree is UB. The seed node can be used to write to the tree, provided that its create() method is called prior to writing, which happens in most modifying methods in NodeRef.
It is the owners's responsibility to verify that an existing node is readable before subsequently using it to read from the tree.
| using c4::yml::NodeRef::tree_type = Tree |
| using c4::yml::NodeRef::base_type = detail::RoNodeMethods<NodeRef, ConstNodeRef> |
| using c4::yml::NodeRef::iterator = detail::child_iterator<NodeRef> |
| using c4::yml::NodeRef::const_iterator = detail::child_iterator<ConstNodeRef> |
| using c4::yml::NodeRef::children_view = detail::children_view<NodeRef> |
| using c4::yml::NodeRef::const_children_view = detail::children_view<ConstNodeRef> |
|
inlinenoexcept |
Definition at line 1106 of file node.hpp.
Referenced by NodeRef(), NodeRef(), ancestor_doc(), append_child(), append_sibling(), at(), at(), child(), child_r(), detail::RoNodeMethods< NodeRef, ConstNodeRef >, doc(), duplicate(), duplicate_children(), find_child(), find_child_r(), find_sibling(), find_sibling_r(), first_child(), first_sibling(), insert_child(), insert_sibling(), last_child(), last_sibling(), move(), next_sibling(), operator!=(), operator<<(), operator<<(), operator<<(), operator=(), operator=(), operator=(), operator=(), operator=(), operator=(), operator==(), operator[](), operator[](), parent(), prepend_child(), prepend_sibling(), prev_sibling(), remove_child(), sibling(), and sibling_r().
|
inlinenoexcept |
|
inlinenoexcept |
|
defaultnoexcept |
|
defaultnoexcept |
|
inlinenoexcept |
true if the object is not referring to any existing or seed node.
Definition at line 1134 of file node.hpp.
Referenced by invalid(), sample_create_tree(), and sample_quick_overview().
|
inlinenoexcept |
true if the object is not invalid and in seed state.
Definition at line 1136 of file node.hpp.
Referenced by operator==(), operator==(), sample_create_tree(), and sample_quick_overview().
|
inlinenoexcept |
|
inline |
Definition at line 1178 of file node.hpp.
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
Definition at line 1208 of file node.hpp.
Referenced by 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_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(), sample_docs(), c4::yml::write(), and c4::yml::write_key().
|
inlinenoexcept |
Definition at line 1210 of file node.hpp.
Referenced by 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_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::write(), and c4::yml::write_key().
|
inlinenoexcept |
|
inline |
|
inline |
|
inline |
if this node is in seed state, create the node in the tree
Definition at line 1225 of file node.hpp.
Referenced by operator=(), operator|=(), save(), save(), save_key(), save_key(), 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_seq(), set_seq(), set_serialized(), set_serialized(), set_stream(), set_val(), set_val(), set_val_anchor(), set_val_ref(), set_val_style(), and set_val_tag().
|
inline |
Definition at line 1245 of file node.hpp.
|
inline |
|
inline |
Definition at line 1248 of file node.hpp.
Referenced by operator=().
|
inline |
Definition at line 1251 of file node.hpp.
Referenced by operator=(), operator=(), operator=(), sample_create_tree(), sample_create_tree_style(), and sample_quick_overview().
|
inline |
Definition at line 1254 of file node.hpp.
Referenced by sample_anchors_and_aliases_create(), sample_create_tree(), sample_create_tree_style(), sample_float_precision(), sample_parse_reuse_tree(), sample_quick_overview(), and c4::yml::write().
|
inline |
|
inline |
Definition at line 1257 of file node.hpp.
Referenced by sample_anchors_and_aliases_create(), sample_base64(), sample_create_tree(), sample_create_tree_style(), sample_empty_null_values(), sample_parse_reuse_tree(), sample_quick_overview(), sample_user_scalar_types(), and c4::yml::write().
|
inline |
|
inline |
Definition at line 1260 of file node.hpp.
|
inline |
Definition at line 1261 of file node.hpp.
|
inline |
Definition at line 1262 of file node.hpp.
|
inline |
Definition at line 1263 of file node.hpp.
|
inline |
Definition at line 1264 of file node.hpp.
|
inline |
Definition at line 1265 of file node.hpp.
Referenced by sample_anchors_and_aliases_create().
|
inline |
Definition at line 1267 of file node.hpp.
Referenced by sample_style(), and sample_style_flow_ml_indent().
|
inline |
Definition at line 1268 of file node.hpp.
Referenced by sample_style().
|
inline |
Definition at line 1269 of file node.hpp.
Referenced by sample_style().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 1305 of file node.hpp.
Referenced by sample_json(), and sample_style().
|
inline |
Definition at line 1311 of file node.hpp.
Referenced by sample_style().
|
inline |
forward to Tree::to_arena() .
Serializes a scalar type to the tree's arena. The type must be serializeable as a scalar.
Definition at line 1330 of file node.hpp.
|
inline |
Definition at line 1337 of file node.hpp.
Referenced by operator<<(), operator<<(), sample_float_precision(), sample_lightning_overview(), sample_std_types(), and sample_user_container_types().
|
inline |
Definition at line 1344 of file node.hpp.
|
inline |
Definition at line 1354 of file node.hpp.
Referenced by operator<<().
|
inline |
|
inline |
serialize a variable to this node.
If the variable is a scalar, it is first serialized to the arena, and then assigned to the node's val. Otherwise, the node will be made a container, and its contents populated from the variable.
Definition at line 1375 of file node.hpp.
Referenced by sample_base64(), sample_create_tree(), sample_create_tree_style(), sample_quick_overview(), sample_tree_arena(), and c4::yml::write().
|
inline |
|
inline |
serialize a variable, then assign the result to the node's key
Definition at line 1396 of file node.hpp.
Referenced by sample_base64(), sample_create_tree_style(), sample_quick_overview(), and c4::yml::write().
|
inline |
|
inline |
Forward to Tree::parent().
Node must be readable.
Definition at line 1422 of file node.hpp.
Referenced by duplicate(), duplicate_children(), and move().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Forward to Tree::child().
Node must be readable.
Definition at line 1431 of file node.hpp.
Referenced by child_r(), child_r(), find_child_r(), find_child_r(), remove_child(), remove_child(), and remove_child().
|
inline |
|
inline |
Definition at line 1434 of file node.hpp.
|
inline |
Forward to Tree::child_r().
Node must be readable.
Forward to Tree::child_r().
Node must be readable. Forward to Tree::find_child(). Node must be readable.
|
inline |
|
inline |
|
inline |
Forward to Tree::find_child_r().
Node must be readable.
|
inline |
Forward to Tree::find_child_r().
Node must be readable. Forward to Tree::prev_sibling(). Node must be readable.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Forward to Tree::sibling().
Node must be readable.
Definition at line 1455 of file node.hpp.
Referenced by find_sibling_r(), find_sibling_r(), sibling_r(), and sibling_r().
|
inline |
|
inline |
Definition at line 1458 of file node.hpp.
|
inline |
Forward to Tree::sibling_r().
Node must be readable.
Forward to Tree::sibling_r().
Node must be readable. Forward to Tree::find_sibling(). Node must be readable.
|
inline |
|
inline |
|
inline |
Forward to Tree::find_sibling_r().
Node must be readable.
|
inline |
Forward to Tree::find_sibling_r().
Node must be readable. Forward to Tree::ancestor_doc(). Node must be readable.
|
inline |
|
inline |
Forward to Tree::doc().
Node must be readable. succeeds even when the node may have invalid or seed id
Find child by key; complexity is O(num_children).
Returns the requested node, or an object in seed state if no such child is found (see NodeRef for an explanation of what is seed state). When the object is in seed state, using it to read from the tree is UB. The seed node can be used to write to the tree provided that its create() method is called prior to writing, which happens in most modifying methods in NodeRef. It is the caller's responsibility to verify that the returned node is readable before subsequently using it to read from the tree.
Definition at line 1499 of file node.hpp.
Find child by position; complexity is O(pos).
Returns the requested node, or an object in seed state if no such child is found (see NodeRef for an explanation of what is seed state). When the object is in seed state, using it to read from the tree is UB. The seed node can be used to write to the tree provided that its create() method is called prior to writing, which happens in most modifying methods in NodeRef. It is the caller's responsibility to verify that the returned node is readable before subsequently using it to read from the tree.
|
inline |
Find a child by key; complexity is O(num_children).
Behaves similar to the non-const overload, but further asserts that the returned node is readable (because it can never be in a seed state). The assertion is performed only if RYML_USE_ASSERT is set to true. As with the non-const overload, it is UB to use the return value if it is not valid.
|
inline |
Find a child by position; complexity is O(pos).
Behaves similar to the non-const overload, but further asserts that the returned node is readable (because it can never be in a seed state). This assertion is performed only if RYML_USE_ASSERT is set to true. As with the non-const overload, it is UB to use the return value if it is not valid.
Find child by key; complexity is O(num_children).
Returns the requested node, or an object in seed state if no such child is found (see NodeRef for an explanation of what is seed state). When the object is in seed state, using it to read from the tree is UB. The seed node can be subsequently used to write to the tree provided that its create() method is called prior to writing, which happens inside most mutating methods in NodeRef. It is the caller's responsibility to verify that the returned node is readable before subsequently using it to read from the tree.
Definition at line 1604 of file node.hpp.
Find child by position; complexity is O(pos).
Returns the requested node, or an object in seed state if no such child is found (see NodeRef for an explanation of what is seed state). When the object is in seed state, using it to read from the tree is UB. The seed node can be used to write to the tree provided that its create() method is called prior to writing, which happens in most modifying methods in NodeRef. It is the caller's responsibility to verify that the returned node is readable before subsequently using it to read from the tree.
Definition at line 1639 of file node.hpp.
|
inline |
Get a child by name, with error checking; complexity is O(num_children).
Behaves as operator[](csubstr) const, but always raises an error (even when RYML_USE_ASSERT is set to false) when the returned node does not exist, or when this node is not readable, or when it is not a map. This behaviour is similar to std::vector::at(), but the error consists in calling the error callback instead of directly raising an exception.
Definition at line 1660 of file node.hpp.
|
inline |
Get a child by position, with error checking; complexity is O(pos).
Behaves as operator[](id_type) const, but always raises an error (even when RYML_USE_ASSERT is set to false) when the returned node does not exist, or when this node is not readable, or when it is not a container. This behaviour is similar to std::vector::at(), but the error consists in calling the error callback instead of directly raising an exception.
Definition at line 1680 of file node.hpp.
|
inline |
|
inline |
Definition at line 1715 of file node.hpp.
Referenced by sample_anchors_and_aliases_create(), sample_base64(), sample_create_tree(), sample_create_tree_style(), sample_float_precision(), sample_lightning_overview(), sample_parse_reuse_tree(), sample_quick_overview(), c4::yml::write(), and c4::yml::write().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 1746 of file node.hpp.
|
inline |
remove the nth child of this node
Definition at line 1756 of file node.hpp.
|
inline |
|
inline |
move the node to a different parent (which may belong to a different tree), placing it after after.
When the destination parent is in a new tree, then this node's tree pointer is reset to the tree of the parent node.
Definition at line 1780 of file node.hpp.
|
inline |
duplicate the current node somewhere into a different parent (possibly from a different tree), and place it after the node after.
To place into the first position of the parent, simply pass an empty or default-constructed reference like this: n.move({}).
|
inline |
|
inline |
get a mutable iterator to the first child.
NOT AVAILABLE for ConstNodeRef.
|
inline |
|
inline |
|
inline |
get an iterator to after the last child.
NOT AVAILABLE for ConstNodeRef.
|
inline |
|
inline |
|
inline |
get an iterable view over children
Definition at line 1843 of file node.hpp.
Referenced by sample_float_precision().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 1875 of file node.hpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineinherited |
|
inlineinherited |
Forward to Tree::key().
Node must be readable.
Definition at line 174 of file node.hpp.
Referenced by c4::yml::NodeRef::at(), c4::yml::NodeRef::at(), c4::yml::NodeRef::operator[](), c4::yml::NodeRef::operator[](), c4::yml::NodeRef::remove_child(), c4::yml::NodeRef::set_key(), and c4::yml::NodeRef::set_key().
|
inlineinherited |
Forward to Tree::key_tag().
Node must be readable.
Definition at line 175 of file node.hpp.
Referenced by c4::yml::NodeRef::set_key_tag().
|
inlineinherited |
Forward to Tree::key_ref().
Node must be readable.
Definition at line 176 of file node.hpp.
Referenced by c4::yml::NodeRef::set_key_ref().
|
inlineinherited |
Forward to Tree::key_anchor().
Node must be readable.
Definition at line 177 of file node.hpp.
Referenced by c4::yml::NodeRef::set_key_anchor().
|
inlineinherited |
Forward to Tree::val().
Node must be readable.
Definition at line 179 of file node.hpp.
Referenced by c4::yml::NodeRef::set_val(), and c4::yml::NodeRef::set_val().
|
inlineinherited |
Forward to Tree::val_tag().
Node must be readable.
Definition at line 180 of file node.hpp.
Referenced by c4::yml::NodeRef::set_val_tag().
|
inlineinherited |
Forward to Tree::val_ref().
Node must be readable.
Definition at line 181 of file node.hpp.
Referenced by c4::yml::NodeRef::set_val_ref().
|
inlineinherited |
Forward to Tree::val_anchor().
Node must be readable.
Definition at line 182 of file node.hpp.
Referenced by c4::yml::NodeRef::set_val_anchor().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
Forward to Tree::is_key_unfiltered().
Node must be readable.
|
inlinenoexceptinherited |
Forward to Tree::is_val_unfiltered().
Node must be readable.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Forward to Tree::is_container_styled().
Node must be readable.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Forward to Tree::is_flow_ml1().
Node must be readable.
Definition at line 246 of file node.hpp.
Referenced by is_flow_ml().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Forward to Tree::has_parent() Node must be readable.
|
inlineinherited |
Forward to Tree::is_ancestor() Node must be readable.
|
inlineinherited |
Forward to Tree::has_child().
Node must be readable.
Definition at line 282 of file node.hpp.
Referenced by c4::yml::NodeRef::remove_child().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Forward to Tree::has_other_siblings().
Node must be readable.
|
inlineinherited |
O(num_children).
Forward to Tree::num_children().
Definition at line 302 of file node.hpp.
Referenced by c4::yml::NodeRef::remove_child().
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
O(num_children).
Forward to Tree::child_pos().
Definition at line 305 of file node.hpp.
Referenced by deserialize_child(), deserialize_child(), and deserialize_child().
|
inlineinherited |
|
inlineinherited |
Definition at line 308 of file node.hpp.
|
inlineinherited |
O(log(num_nodes)).
Forward to Tree::depth_asc(). Node must be readable.
Definition at line 309 of file node.hpp.
|
inlineinherited |
Definition at line 318 of file node.hpp.
|
inlineinherited |
(1) deserialize the node's contents (val or container) to the given variable, forwarding to the user-overrideable read() function, which can be for ConstNodeRef (see Read from ConstNodeRef) or for tree+id (see Read from Tree).
This method differs from ConstNodeRef::deserialize() in that here the error callback is called if the deserialization failed, or (optionally) the node is not readable.
Definition at line 345 of file node.hpp.
Referenced by operator>>(), and operator>>().
|
inlineinherited |
(2) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 361 of file node.hpp.
|
inlineinherited |
(1) deserialize the node's key (necessarily a scalar) to the given variable, forwarding to the user-overrideable read_key() function, which can be for ConstNodeRef (see Read from ConstNodeRef) or for tree+id (see Read from Tree).
This method differs from ConstNodeRef::deserialize_key() in that here the error callback is called if the deserialization failed, or (optionally) the node is not readable.
Definition at line 385 of file node.hpp.
Referenced by operator>>().
|
inlineinherited |
(2) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 401 of file node.hpp.
|
inlineinherited |
(1) deserialize the node's contents (val or container) to the given variable, forwarding to the user-overrideable read() function (see Read from ConstNodeRef).
Definition at line 428 of file node.hpp.
|
inlineinherited |
(2) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 437 of file node.hpp.
|
inlineinherited |
(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).
Definition at line 451 of file node.hpp.
|
inlineinherited |
(2) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 460 of file node.hpp.
|
inlineinherited |
(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 485 of file node.hpp.
|
inlineinherited |
(2) like (1), but assign from fallback if no such child exists.
|
inlineinherited |
(3) like (1), but for wrapper tag types such as c4::fmt::base64()
|
inlineinherited |
(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.
|
inlineinherited |
(2) like (1), but assign from fallback if no such child exists
|
inlineinherited |
(3) like (1), but for wrapper tag types such as c4::fmt::base64()
|
inlineinherited |
Definition at line 573 of file node.hpp.
|
inlineinherited |
|
inlineinherited |
Definition at line 581 of file node.hpp.
|
inlineprotectedinherited |
|
inlineprotectedinherited |
|
inlinestaticprotectedinherited |
Definition at line 609 of file node.hpp.
Referenced by check_key_(), and check_val_().
|
inlinestaticprotectedinherited |
Definition at line 615 of file node.hpp.
Referenced by check_key_(), check_val_(), load(), load(), load_key(), and load_key().
|
inlineprotectednoexceptinherited |
Definition at line 624 of file node.hpp.
Referenced by deserialize(), deserialize(), load(), and load().
|
inlineprotectednoexceptinherited |
Definition at line 625 of file node.hpp.
Referenced by deserialize_key(), deserialize_key(), load_key(), and load_key().
|
friend |