|
rapidyaml
0.16.0
parseandemitYAML,anddoitfast
|
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. More... | |
| bool | is_seed () const noexcept |
| true if the object is not invalid and in seed state. More... | |
| bool | readable () const noexcept |
| true if the object is not invalid and not in seed state. More... | |
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(). More... | |
| NodeData * | get () RYML_NOEXCEPT |
| Forward to Tree::type(). More... | |
node_setters | |
| void | create () |
| if this node is in seed state, create the node in the tree More... | |
| 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 More... | |
| void | clear_val () |
| remove the VAL (flags included) from a scalar More... | |
| void | clear_children () |
| remove the children from a scalar More... | |
| 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() . More... | |
| 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. More... | |
| 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 More... | |
| template<class T > | |
| void | set_key_serialized (T const &k, NodeType style_flags) |
hierarchy getters | |
| NodeRef | parent () RYML_NOEXCEPT |
| Forward to Tree::parent(). More... | |
| ConstNodeRef | parent () const RYML_NOEXCEPT |
| Forward to Tree::parent(). More... | |
| NodeRef | first_child () RYML_NOEXCEPT |
| Forward to Tree::first_child(). More... | |
| ConstNodeRef | first_child () const RYML_NOEXCEPT |
| Forward to Tree::first_child(). More... | |
| NodeRef | last_child () RYML_NOEXCEPT |
| Forward to Tree::last_child(). More... | |
| ConstNodeRef | last_child () const RYML_NOEXCEPT |
| Forward to Tree::last_child(). More... | |
| NodeRef | child (id_type pos) RYML_NOEXCEPT |
| Forward to Tree::child(). More... | |
| ConstNodeRef | child (id_type pos) const RYML_NOEXCEPT |
| Forward to Tree::child(). More... | |
| 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(). More... | |
| NodeRef | find_child (csubstr name) RYML_NOEXCEPT |
| Forward to Tree::child_r(). More... | |
| ConstNodeRef | find_child (csubstr name) const RYML_NOEXCEPT |
| Forward to Tree::find_child(). More... | |
| 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(). More... | |
| NodeRef | prev_sibling () RYML_NOEXCEPT |
| Forward to Tree::find_child_r(). More... | |
| ConstNodeRef | prev_sibling () const RYML_NOEXCEPT |
| Forward to Tree::prev_sibling(). More... | |
| NodeRef | next_sibling () RYML_NOEXCEPT |
| Forward to Tree::next_sibling(). More... | |
| ConstNodeRef | next_sibling () const RYML_NOEXCEPT |
| Forward to Tree::next_sibling(). More... | |
| NodeRef | first_sibling () RYML_NOEXCEPT |
| Forward to Tree::first_sibling(). More... | |
| ConstNodeRef | first_sibling () const RYML_NOEXCEPT |
| Forward to Tree::first_sibling(). More... | |
| NodeRef | last_sibling () RYML_NOEXCEPT |
| Forward to Tree::last_sibling(). More... | |
| ConstNodeRef | last_sibling () const RYML_NOEXCEPT |
| Forward to Tree::last_sibling(). More... | |
| NodeRef | sibling (id_type pos) RYML_NOEXCEPT |
| Forward to Tree::sibling(). More... | |
| ConstNodeRef | sibling (id_type pos) const RYML_NOEXCEPT |
| Forward to Tree::sibling(). More... | |
| 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(). More... | |
| NodeRef | find_sibling (csubstr name) RYML_NOEXCEPT |
| Forward to Tree::sibling_r(). More... | |
| ConstNodeRef | find_sibling (csubstr name) const RYML_NOEXCEPT |
| Forward to Tree::find_sibling(). More... | |
| 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(). More... | |
| NodeRef | ancestor_doc () RYML_NOEXCEPT |
| Forward to Tree::find_sibling_r(). More... | |
| ConstNodeRef | ancestor_doc () const RYML_NOEXCEPT |
| Forward to Tree::ancestor_doc(). More... | |
| NodeRef | doc (id_type i) RYML_NOEXCEPT |
| Forward to Tree::doc(). More... | |
| ConstNodeRef | doc (id_type i) const RYML_NOEXCEPT |
| Forward to Tree::doc(). More... | |
square_brackets | |
operator[] | |
| NodeRef | operator[] (csubstr key) RYML_NOEXCEPT |
| Find child by key; complexity is O(num_children). More... | |
| NodeRef | operator[] (id_type pos) RYML_NOEXCEPT |
| Find child by position; complexity is O(pos). More... | |
| ConstNodeRef | operator[] (csubstr key) const RYML_NOEXCEPT |
| Find a child by key; complexity is O(num_children). More... | |
| ConstNodeRef | operator[] (id_type pos) const RYML_NOEXCEPT |
| Find a child by position; complexity is O(pos). More... | |
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). More... | |
| NodeRef | at (id_type pos) |
| Find child by position; complexity is O(pos). More... | |
| ConstNodeRef | at (csubstr key) const |
| Get a child by name, with error checking; complexity is O(num_children). More... | |
| ConstNodeRef | at (id_type pos) const |
| Get a child by position, with error checking; complexity is O(pos). More... | |
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 More... | |
| void | remove_child (csubstr key) |
| remove a child by name More... | |
| 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. More... | |
| 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. More... | |
| 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(). More... | |
| csubstr | key () const RYML_NOEXCEPT |
| Forward to Tree::key(). More... | |
| csubstr | key_tag () const RYML_NOEXCEPT |
| Forward to Tree::key_tag(). More... | |
| csubstr | key_ref () const RYML_NOEXCEPT |
| Forward to Tree::key_ref(). More... | |
| csubstr | key_anchor () const RYML_NOEXCEPT |
| Forward to Tree::key_anchor(). More... | |
| csubstr | val () const RYML_NOEXCEPT |
| Forward to Tree::val(). More... | |
| csubstr | val_tag () const RYML_NOEXCEPT |
| Forward to Tree::val_tag(). More... | |
| csubstr | val_ref () const RYML_NOEXCEPT |
| Forward to Tree::val_ref(). More... | |
| csubstr | val_anchor () const RYML_NOEXCEPT |
| Forward to Tree::val_anchor(). More... | |
| NodeScalar const & | keysc () const RYML_NOEXCEPT |
| Forward to Tree::keysc(). More... | |
| NodeScalar const & | valsc () const RYML_NOEXCEPT |
| Forward to Tree::valsc(). More... | |
| bool | key_is_null () const RYML_NOEXCEPT |
| Forward to Tree::key_is_null(). More... | |
| bool | val_is_null () const RYML_NOEXCEPT |
| Forward to Tree::val_is_null(). More... | |
| bool | is_key_unfiltered () const noexcept |
| Forward to Tree::is_key_unfiltered(). More... | |
| bool | is_val_unfiltered () const noexcept |
| Forward to Tree::is_val_unfiltered(). More... | |
node type predicates | |
| bool | empty () const RYML_NOEXCEPT |
| Forward to Tree::empty(). More... | |
| bool | is_stream () const RYML_NOEXCEPT |
| Forward to Tree::is_stream(). More... | |
| bool | is_doc () const RYML_NOEXCEPT |
| Forward to Tree::is_doc(). More... | |
| bool | is_container () const RYML_NOEXCEPT |
| Forward to Tree::is_container(). More... | |
| bool | is_map () const RYML_NOEXCEPT |
| Forward to Tree::is_map(). More... | |
| bool | is_seq () const RYML_NOEXCEPT |
| Forward to Tree::is_seq(). More... | |
| bool | has_val () const RYML_NOEXCEPT |
| Forward to Tree::has_val(). More... | |
| bool | has_key () const RYML_NOEXCEPT |
| Forward to Tree::has_key(). More... | |
| bool | is_val () const RYML_NOEXCEPT |
| Forward to Tree::is_val(). More... | |
| bool | is_keyval () const RYML_NOEXCEPT |
| Forward to Tree::is_keyval(). More... | |
| bool | has_key_tag () const RYML_NOEXCEPT |
| Forward to Tree::has_key_tag(). More... | |
| bool | has_val_tag () const RYML_NOEXCEPT |
| Forward to Tree::has_val_tag(). More... | |
| bool | has_key_anchor () const RYML_NOEXCEPT |
| Forward to Tree::has_key_anchor(). More... | |
| bool | has_val_anchor () const RYML_NOEXCEPT |
| Forward to Tree::has_val_anchor(). More... | |
| bool | has_anchor () const RYML_NOEXCEPT |
| Forward to Tree::has_anchor(). More... | |
| bool | is_key_ref () const RYML_NOEXCEPT |
| Forward to Tree::is_key_ref(). More... | |
| bool | is_val_ref () const RYML_NOEXCEPT |
| Forward to Tree::is_val_ref(). More... | |
| bool | is_ref () const RYML_NOEXCEPT |
| Forward to Tree::is_ref(). More... | |
| bool | parent_is_seq () const RYML_NOEXCEPT |
| Forward to Tree::parent_is_seq(). More... | |
| bool | parent_is_map () const RYML_NOEXCEPT |
| Forward to Tree::parent_is_map(). More... | |
style predicates | |
| bool | type_has_any (type_bits bits) const RYML_NOEXCEPT |
| Forward to Tree::type_has_any(). More... | |
| bool | type_has_all (type_bits bits) const RYML_NOEXCEPT |
| Forward to Tree::type_has_all(). More... | |
| bool | type_has_none (type_bits bits) const RYML_NOEXCEPT |
| Forward to Tree::type_has_none(). More... | |
| NodeType | key_style () const RYML_NOEXCEPT |
| Forward to Tree::key_style(). More... | |
| NodeType | val_style () const RYML_NOEXCEPT |
| Forward to Tree::val_style(). More... | |
| bool | is_container_styled () const RYML_NOEXCEPT |
| Forward to Tree::is_container_styled(). More... | |
| bool | is_block () const RYML_NOEXCEPT |
| Forward to Tree::is_block(). More... | |
| bool | is_flow () const RYML_NOEXCEPT |
| Forward to Tree::is_flow(). More... | |
| bool | is_flow_sl () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_sl(). More... | |
| bool | is_flow_ml () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_ml1(). More... | |
| bool | is_flow_ml1 () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_ml1(). More... | |
| bool | is_flow_mln () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_mln(). More... | |
| bool | is_flow_mlx () const RYML_NOEXCEPT |
| Forward to Tree::is_flow_mlx(). More... | |
| bool | has_flow_space () const RYML_NOEXCEPT |
| Forward to Tree::has_flow_space(). More... | |
| bool | is_key_styled () const RYML_NOEXCEPT |
| Forward to Tree::is_key_styled(). More... | |
| bool | is_val_styled () const RYML_NOEXCEPT |
| Forward to Tree::is_val_styled(). More... | |
| bool | is_key_literal () const RYML_NOEXCEPT |
| Forward to Tree::is_key_literal(). More... | |
| bool | is_val_literal () const RYML_NOEXCEPT |
| Forward to Tree::is_val_literal(). More... | |
| bool | is_key_folded () const RYML_NOEXCEPT |
| Forward to Tree::is_key_folded(). More... | |
| bool | is_val_folded () const RYML_NOEXCEPT |
| Forward to Tree::is_val_folded(). More... | |
| bool | is_key_squo () const RYML_NOEXCEPT |
| Forward to Tree::is_key_squo(). More... | |
| bool | is_val_squo () const RYML_NOEXCEPT |
| Forward to Tree::is_val_squo(). More... | |
| bool | is_key_dquo () const RYML_NOEXCEPT |
| Forward to Tree::is_key_dquo(). More... | |
| bool | is_val_dquo () const RYML_NOEXCEPT |
| Forward to Tree::is_val_dquo(). More... | |
| bool | is_key_plain () const RYML_NOEXCEPT |
| Forward to Tree::is_key_plain(). More... | |
| bool | is_val_plain () const RYML_NOEXCEPT |
| Forward to Tree::is_val_plain(). More... | |
| bool | is_key_quoted () const RYML_NOEXCEPT |
| Forward to Tree::is_key_quoted(). More... | |
| bool | is_val_quoted () const RYML_NOEXCEPT |
| Forward to Tree::is_val_quoted(). More... | |
| bool | is_quoted () const RYML_NOEXCEPT |
| Forward to Tree::is_quoted(). More... | |
hierarchy predicates | |
| bool | is_root () const RYML_NOEXCEPT |
| Forward to Tree::is_root(). More... | |
| bool | has_parent () const RYML_NOEXCEPT |
| Forward to Tree::has_parent() Node must be readable. More... | |
| bool | is_ancestor (ConstNodeRef const &ancestor) const RYML_NOEXCEPT |
| Forward to Tree::is_ancestor() Node must be readable. More... | |
| bool | has_child (ConstNodeRef const &n) const RYML_NOEXCEPT |
| Forward to Tree::has_child(). More... | |
| bool | has_child (id_type node) const RYML_NOEXCEPT |
| Forward to Tree::has_child(). More... | |
| bool | has_child (csubstr name) const RYML_NOEXCEPT |
| Forward to Tree::has_child(). More... | |
| bool | has_children () const RYML_NOEXCEPT |
| Forward to Tree::has_children(). More... | |
| bool | has_sibling (ConstNodeRef const &n) const RYML_NOEXCEPT |
| Forward to Tree::has_sibling(). More... | |
| bool | has_sibling (id_type node) const RYML_NOEXCEPT |
| Forward to Tree::has_sibling(). More... | |
| bool | has_sibling (csubstr name) const RYML_NOEXCEPT |
| Forward to Tree::has_sibling(). More... | |
| bool | has_other_siblings () const RYML_NOEXCEPT |
| Forward to Tree::has_other_siblings(). More... | |
hierarchy getters | |
| id_type | num_children () const RYML_NOEXCEPT |
| O(num_children). More... | |
| id_type | num_siblings () const RYML_NOEXCEPT |
| O(num_children). More... | |
| id_type | num_other_siblings () const RYML_NOEXCEPT |
| O(num_siblings). More... | |
| id_type | child_pos (ConstNodeRef const &n) const RYML_NOEXCEPT |
| O(num_children). More... | |
| id_type | sibling_pos (ConstNodeRef const &n) const RYML_NOEXCEPT |
| O(num_siblings). More... | |
| id_type | depth_asc () const RYML_NOEXCEPT |
| id_type | depth_desc () const RYML_NOEXCEPT |
| O(log(num_nodes)). More... | |
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). More... | |
| void | load (Wrapper const &wrapper, bool check_readable=true) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() More... | |
| 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). More... | |
| void | load_key (Wrapper const &wrapper, bool check_readable=true) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() More... | |
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). More... | |
| ReadResult | deserialize (Wrapper const &wrapper) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() More... | |
| 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). More... | |
| ReadResult | deserialize_key (Wrapper const &wrapper) const |
| (2) like (1), but for wrapper tag types such as c4::fmt::base64() More... | |
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). More... | |
| ReadResult | deserialize_child (csubstr child_key, T *v, T const &fallback) const |
| (2) like (1), but assign from fallback if no such child exists. More... | |
| ReadResult | deserialize_child (csubstr child_key, Wrapper const &v) const |
| (3) like (1), but for wrapper tag types such as c4::fmt::base64() More... | |
| 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). More... | |
| 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 More... | |
| ReadResult | deserialize_child (id_type child_pos, Wrapper const &wrapper) const |
| (3) like (1), but for wrapper tag types such as c4::fmt::base64() More... | |
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. More... | |
| const_iterator | begin () const RYML_NOEXCEPT |
| get an iterator to the first child More... | |
| const_iterator | cbegin () const RYML_NOEXCEPT |
| get an iterator to the first child More... | |
| iterator | end () RYML_NOEXCEPT |
| get an iterator to after the last child. More... | |
| const_iterator | end () const RYML_NOEXCEPT |
| get an iterator to after the last child More... | |
| const_iterator | cend () const RYML_NOEXCEPT |
| get an iterator to after the last child More... | |
| children_view | children () RYML_NOEXCEPT |
| get an iterable view over children More... | |
| const_children_view | children () const RYML_NOEXCEPT |
| get an iterable view over children More... | |
| const_children_view | cchildren () const RYML_NOEXCEPT |
| get an iterable view over children More... | |
| children_view | siblings () RYML_NOEXCEPT |
| const_children_view | siblings () const RYML_NOEXCEPT |
| get an iterable view over all siblings (including the calling node) More... | |
| const_children_view | csiblings () const RYML_NOEXCEPT |
| get an iterable view over all siblings (including the calling node) More... | |
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::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 |
|
inlinenoexcept |
Definition at line 1110 of file node.hpp.
|
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 sample_create_tree().
|
inlinenoexcept |
true if the object is not invalid and in seed state.
Definition at line 1136 of file node.hpp.
Referenced by operator==(), and sample_create_tree().
|
inlinenoexcept |
|
inline |
Definition at line 1178 of file node.hpp.
|
inline |
|
inline |
Definition at line 1198 of file node.hpp.
|
inline |
|
inlinenoexcept |
Definition at line 1208 of file node.hpp.
Referenced by c4::yml::parse_in_arena(), c4::yml::parse_in_place(), c4::yml::parse_json_in_arena(), c4::yml::parse_json_in_place(), remove_child(), 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_place(), c4::yml::parse_json_in_arena(), 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.
|
inline |
Definition at line 1245 of file node.hpp.
|
inline |
Definition at line 1246 of file node.hpp.
|
inline |
Definition at line 1248 of file node.hpp.
Definition at line 1249 of file node.hpp.
|
inline |
Definition at line 1251 of file node.hpp.
Referenced by sample_create_tree(), sample_create_tree_style(), and sample_quick_overview().
Definition at line 1252 of file node.hpp.
|
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(), c4::yml::write(), and write().
|
inline |
Definition at line 1255 of file node.hpp.
|
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(), c4::yml::write(), and write().
|
inline |
Definition at line 1258 of file node.hpp.
|
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 |
remove the children from a scalar
Definition at line 1299 of file node.hpp.
|
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 sample_float_precision(), sample_lightning_overview(), sample_std_types(), sample_user_container_types(), sample_user_container_types_brief(), and sample_user_scalar_types().
|
inline |
Definition at line 1344 of file node.hpp.
|
inline |
Definition at line 1354 of file node.hpp.
|
inline |
Definition at line 1361 of file node.hpp.
|
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(), c4::yml::write(), and write().
|
inline |
Definition at line 1382 of file node.hpp.
|
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 |
Definition at line 1403 of file node.hpp.
|
inline |
Forward to Tree::parent().
Node must be readable.
Definition at line 1422 of file node.hpp.
Referenced by remove_child().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 1434 of file node.hpp.
|
inline |
Forward to Tree::child_r().
Node must be readable.
Definition at line 1435 of file node.hpp.
Forward to Tree::child_r().
Node must be readable. Forward to Tree::find_child(). Node must be readable.
|
inline |
|
inline |
Definition at line 1440 of file node.hpp.
|
inline |
Forward to Tree::find_child_r().
Node must be readable.
Definition at line 1441 of file node.hpp.
|
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 |
|
inline |
|
inline |
Definition at line 1458 of file node.hpp.
|
inline |
Forward to Tree::sibling_r().
Node must be readable.
Definition at line 1459 of file node.hpp.
Forward to Tree::sibling_r().
Node must be readable. Forward to Tree::find_sibling(). Node must be readable.
|
inline |
|
inline |
Definition at line 1464 of file node.hpp.
|
inline |
Forward to Tree::find_sibling_r().
Node must be readable.
Definition at line 1465 of file node.hpp.
|
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.
Definition at line 1524 of file node.hpp.
|
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.
Definition at line 1540 of file node.hpp.
|
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.
Definition at line 1557 of file node.hpp.
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.
Definition at line 1700 of file node.hpp.
|
inline |
Definition at line 1708 of file node.hpp.
|
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(), and c4::yml::write().
|
inline |
Definition at line 1722 of file node.hpp.
|
inline |
Definition at line 1730 of file node.hpp.
|
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 |
remove a child by name
Definition at line 1766 of file node.hpp.
|
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({}).
Definition at line 1801 of file node.hpp.
|
inline |
Definition at line 1811 of file node.hpp.
|
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 |
Definition at line 1865 of file node.hpp.
|
inline |
Definition at line 1868 of file node.hpp.
|
inline |
Definition at line 1875 of file node.hpp.
|
inline |
Definition at line 1878 of file node.hpp.
|
inline |
|
inline |
|
inline |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlinenoexceptinherited |
|
inlinenoexceptinherited |
|
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 |
|
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 |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
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.
|
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.
|
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.
|
inlineinherited |
|
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.
Definition at line 526 of file node.hpp.
|
inlineinherited |
(2) like (1), but assign from fallback if no such child exists
Definition at line 537 of file node.hpp.
|
inlineinherited |
(3) like (1), but for wrapper tag types such as c4::fmt::base64()
Definition at line 549 of file node.hpp.
|
inlineinherited |
Definition at line 573 of file node.hpp.
|
inlineinherited |
Definition at line 577 of file node.hpp.
|
inlineinherited |
Definition at line 581 of file node.hpp.
|
inlineprotectedinherited |
Definition at line 589 of file node.hpp.
|
inlineprotectedinherited |
Definition at line 598 of file node.hpp.
|
inlinestaticprotectedinherited |
|
inlinestaticprotectedinherited |
|
inlineprotectednoexceptinherited |
|
inlineprotectednoexceptinherited |
|
friend |