Class NodeRef
Defined in File rapidyaml-0.5.0.hpp
Inheritance Relationships
Base Type
public c4::yml::detail::RoNodeMethods< NodeRef, ConstNodeRef >
(Template Struct RoNodeMethods)
Class Documentation
-
class NodeRef : public c4::yml::detail::RoNodeMethods<NodeRef, ConstNodeRef>
a reference to a node in an existing yaml tree, offering a more convenient API than the index-based API used in the tree.
construction
-
inline NodeRef()
-
inline NodeRef(Tree &t)
-
inline NodeRef(Tree *t)
-
inline NodeRef(Tree *t, size_t id)
-
inline NodeRef(Tree *t, size_t id, size_t seed_pos)
-
inline NodeRef(Tree *t, size_t id, csubstr seed_key)
-
inline NodeRef(std::nullptr_t)
assignment
comparisons
-
inline bool operator==(ConstNodeRef const &that) const
-
inline bool operator!=(ConstNodeRef const &that) const
-
inline bool operator==(std::nullptr_t) const
-
inline bool operator!=(std::nullptr_t) const
-
inline bool operator==(csubstr val) const
-
inline bool operator!=(csubstr val) const
node property getters
- inline C4_ALWAYS_INLINE C4_PURE Tree * tree () noexcept
- inline C4_ALWAYS_INLINE C4_PURE Tree const * tree () const noexcept
- inline C4_ALWAYS_INLINE C4_PURE size_t id () const noexcept
node modifiers
-
inline void change_type(NodeType t)
-
inline void set_type(NodeType t)
-
inline void set_key(csubstr key)
-
inline void set_val(csubstr val)
-
inline void set_key_tag(csubstr key_tag)
-
inline void set_val_tag(csubstr val_tag)
-
inline void set_key_anchor(csubstr key_anchor)
-
inline void set_val_anchor(csubstr val_anchor)
-
inline void set_key_ref(csubstr key_ref)
-
inline void set_val_ref(csubstr val_ref)
- template<class T> inline size_t set_key_serialized (T const &C4_RESTRICT k)
- template<class T> inline size_t set_val_serialized (T const &C4_RESTRICT v)
-
inline size_t set_val_serialized(std::nullptr_t)
-
size_t set_key_serialized(fmt::const_base64_wrapper w)
encode a blob as base64, then assign the result to the node’s key
- Returns:
the size of base64-encoded blob
-
size_t set_val_serialized(fmt::const_base64_wrapper w)
encode a blob as base64, then assign the result to the node’s val
- Returns:
the size of base64-encoded blob
-
inline void clear()
-
inline void clear_key()
-
inline void clear_val()
-
inline void clear_children()
-
inline void create()
-
inline void operator=(NodeType_e t)
-
inline void operator|=(NodeType_e t)
-
inline void operator=(NodeInit const &v)
-
inline void operator=(NodeScalar const &v)
-
inline void operator=(std::nullptr_t)
-
inline void operator=(csubstr v)
serialization
- template<class T> inline csubstr to_arena (T const &C4_RESTRICT s)
serialize a variable to the arena
-
inline NodeRef &operator<<(csubstr s)
serialize a variable, then assign the result to the node’s val
- template<class T> inline NodeRef & operator<< (T const &C4_RESTRICT v)
- template<class T> inline NodeRef & operator<< (Key< const T > const &C4_RESTRICT v)
serialize a variable, then assign the result to the node’s key
- template<class T> inline NodeRef & operator<< (Key< T > const &C4_RESTRICT v)
serialize a variable, then assign the result to the node’s key
-
inline NodeRef &operator<<(Key<fmt::const_base64_wrapper> w)
-
inline NodeRef &operator<<(fmt::const_base64_wrapper w)
modification of hierarchy
-
inline NodeRef insert_sibling(ConstNodeRef const &after)
-
inline NodeRef insert_sibling(NodeInit const &i, ConstNodeRef const &after)
-
inline void remove_child(size_t pos)
remove the nth child of this node
-
inline void remove_child(csubstr key)
remove a child by name
-
inline void move(ConstNodeRef const &after)
change the node’s position within its parent, placing it after
after
. To move to the first position in the parent, simply pass an empty or default-constructed reference like this:n.move({})
.
-
inline void move(NodeRef const &parent, ConstNodeRef const &after)
move the node to a different
parent
(which may belong to a different tree), placing it afterafter
. When the destination parent is in a new tree, then this node’s tree pointer is reset to the tree of the parent node.
-
inline NodeRef duplicate(ConstNodeRef const &after) const
duplicate the current node somewhere within its parent, 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 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 nodeafter
. To place into the first position of the parent, simply pass an empty or default-constructed reference like this:n.move({})
.
-
inline void duplicate_children(NodeRef const &parent, ConstNodeRef const &after) const
Public Types
-
using tree_type = Tree
-
using base_type = detail::RoNodeMethods<NodeRef, ConstNodeRef>
Friends
- friend struct detail::RoNodeMethods< NodeRef, ConstNodeRef >
-
inline NodeRef()