|
|
|
|
@@ -187,6 +187,8 @@ struct RoNodeMethods
|
|
|
|
|
RYML_ASSERT(tree_ != nullptr); \
|
|
|
|
|
_RYML_CB_ASSERT(tree_->m_callbacks, id_ != NONE); \
|
|
|
|
|
_RYML_CB_ASSERT(tree_->m_callbacks, (((Impl const* C4_RESTRICT)this)->readable()))
|
|
|
|
|
// a SFINAE beautifier to enable a function only if the
|
|
|
|
|
// implementation is mutable
|
|
|
|
|
#define _C4_IF_MUTABLE(ty) typename std::enable_if<!std::is_same<U, ConstImpl>::value, ty>::type
|
|
|
|
|
/** @endcond */
|
|
|
|
|
|
|
|
|
|
@@ -201,27 +203,27 @@ public:
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto get() RYML_NOEXCEPT -> _C4_IF_MUTABLE(NodeData*) { return ((Impl const*)this)->readable() ? tree__->get(id__) : nullptr; }
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE NodeType type() const RYML_NOEXCEPT { _C4RR(); return tree_->type(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE const char* type_str() const RYML_NOEXCEPT { _C4RR(); return tree_->type_str(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE NodeType type() const RYML_NOEXCEPT { _C4RR(); return tree_->type(id_); } /**< Forward to @ref Tree::type_str(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE const char* type_str() const RYML_NOEXCEPT { _C4RR(); return tree_->type_str(id_); } /**< Forward to @ref Tree::type_str(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE csubstr key() const RYML_NOEXCEPT { _C4RR(); return tree_->key(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE csubstr key_tag() const RYML_NOEXCEPT { _C4RR(); return tree_->key_tag(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE csubstr key_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->key_ref(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE csubstr key_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->key_anchor(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE csubstr key() const RYML_NOEXCEPT { _C4RR(); return tree_->key(id_); } /**< Forward to @ref Tree::key(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE csubstr key_tag() const RYML_NOEXCEPT { _C4RR(); return tree_->key_tag(id_); } /**< Forward to @ref Tree::key_tag(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE csubstr key_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->key_ref(id_); } /**< Forward to @ref Tree::key_ref(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE csubstr key_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->key_anchor(id_); } /**< Forward to @ref Tree::key_anchor(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE csubstr val() const RYML_NOEXCEPT { _C4RR(); return tree_->val(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE csubstr val_tag() const RYML_NOEXCEPT { _C4RR(); return tree_->val_tag(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE csubstr val_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->val_ref(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE csubstr val_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->val_anchor(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE csubstr val() const RYML_NOEXCEPT { _C4RR(); return tree_->val(id_); } /**< Forward to @ref Tree::val(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE csubstr val_tag() const RYML_NOEXCEPT { _C4RR(); return tree_->val_tag(id_); } /**< Forward to @ref Tree::val_tag(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE csubstr val_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->val_ref(id_); } /**< Forward to @ref Tree::val_ref(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE csubstr val_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->val_anchor(id_); } /**< Forward to @ref Tree::val_anchor(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE NodeScalar const& keysc() const RYML_NOEXCEPT { _C4RR(); return tree_->keysc(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE NodeScalar const& valsc() const RYML_NOEXCEPT { _C4RR(); return tree_->valsc(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE NodeScalar const& keysc() const RYML_NOEXCEPT { _C4RR(); return tree_->keysc(id_); } /**< Forward to @ref Tree::keysc(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE NodeScalar const& valsc() const RYML_NOEXCEPT { _C4RR(); return tree_->valsc(id_); } /**< Forward to @ref Tree::valsc(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE bool key_is_null() const RYML_NOEXCEPT { _C4RR(); return tree_->key_is_null(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE bool val_is_null() const RYML_NOEXCEPT { _C4RR(); return tree_->val_is_null(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE bool key_is_null() const RYML_NOEXCEPT { _C4RR(); return tree_->key_is_null(id_); } /**< Forward to @ref Tree::key_is_null(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool val_is_null() const RYML_NOEXCEPT { _C4RR(); return tree_->val_is_null(id_); } /**< Forward to @ref Tree::val_is_null(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_key_unfiltered() const noexcept { _C4RR(); return tree_->is_key_unfiltered(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_val_unfiltered() const noexcept { _C4RR(); return tree_->is_val_unfiltered(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_unfiltered() const noexcept { _C4RR(); return tree_->is_key_unfiltered(id_); } /**< Forward to @ref Tree::is_key_unfiltered(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_unfiltered() const noexcept { _C4RR(); return tree_->is_val_unfiltered(id_); } /**< Forward to @ref Tree::is_val_unfiltered(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
@@ -230,26 +232,26 @@ public:
|
|
|
|
|
/** @name node type predicates */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE bool empty() const RYML_NOEXCEPT { _C4RR(); return tree_->empty(id_); } /**< Forward to Tree::empty(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_stream() const RYML_NOEXCEPT { _C4RR(); return tree_->is_stream(id_); } /**< Forward to Tree::is_stream(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_doc() const RYML_NOEXCEPT { _C4RR(); return tree_->is_doc(id_); } /**< Forward to Tree::is_doc(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_container() const RYML_NOEXCEPT { _C4RR(); return tree_->is_container(id_); } /**< Forward to Tree::is_container(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_map() const RYML_NOEXCEPT { _C4RR(); return tree_->is_map(id_); } /**< Forward to Tree::is_map(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_seq() const RYML_NOEXCEPT { _C4RR(); return tree_->is_seq(id_); } /**< Forward to Tree::is_seq(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_val() const RYML_NOEXCEPT { _C4RR(); return tree_->has_val(id_); } /**< Forward to Tree::has_val(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_key() const RYML_NOEXCEPT { _C4RR(); return tree_->has_key(id_); } /**< Forward to Tree::has_key(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val(id_); } /**< Forward to Tree::is_val(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_keyval() const RYML_NOEXCEPT { _C4RR(); return tree_->is_keyval(id_); } /**< Forward to Tree::is_keyval(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_key_tag() const RYML_NOEXCEPT { _C4RR(); return tree_->has_key_tag(id_); } /**< Forward to Tree::has_key_tag(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_val_tag() const RYML_NOEXCEPT { _C4RR(); return tree_->has_val_tag(id_); } /**< Forward to Tree::has_val_tag(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_key_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->has_key_anchor(id_); } /**< Forward to Tree::has_key_anchor(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_val_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->has_val_anchor(id_); } /**< Forward to Tree::has_val_anchor(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->has_anchor(id_); } /**< Forward to Tree::has_anchor(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_ref(id_); } /**< Forward to Tree::is_key_ref(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_ref(id_); } /**< Forward to Tree::is_val_ref(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->is_ref(id_); } /**< Forward to Tree::is_ref(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool parent_is_seq() const RYML_NOEXCEPT { _C4RR(); return tree_->parent_is_seq(id_); } /**< Forward to Tree::parent_is_seq(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool parent_is_map() const RYML_NOEXCEPT { _C4RR(); return tree_->parent_is_map(id_); } /**< Forward to Tree::parent_is_map(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool empty() const RYML_NOEXCEPT { _C4RR(); return tree_->empty(id_); } /**< Forward to @ref Tree::empty(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_stream() const RYML_NOEXCEPT { _C4RR(); return tree_->is_stream(id_); } /**< Forward to @ref Tree::is_stream(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_doc() const RYML_NOEXCEPT { _C4RR(); return tree_->is_doc(id_); } /**< Forward to @ref Tree::is_doc(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_container() const RYML_NOEXCEPT { _C4RR(); return tree_->is_container(id_); } /**< Forward to @ref Tree::is_container(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_map() const RYML_NOEXCEPT { _C4RR(); return tree_->is_map(id_); } /**< Forward to @ref Tree::is_map(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_seq() const RYML_NOEXCEPT { _C4RR(); return tree_->is_seq(id_); } /**< Forward to @ref Tree::is_seq(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_val() const RYML_NOEXCEPT { _C4RR(); return tree_->has_val(id_); } /**< Forward to @ref Tree::has_val(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_key() const RYML_NOEXCEPT { _C4RR(); return tree_->has_key(id_); } /**< Forward to @ref Tree::has_key(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val(id_); } /**< Forward to @ref Tree::is_val(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_keyval() const RYML_NOEXCEPT { _C4RR(); return tree_->is_keyval(id_); } /**< Forward to @ref Tree::is_keyval(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_key_tag() const RYML_NOEXCEPT { _C4RR(); return tree_->has_key_tag(id_); } /**< Forward to @ref Tree::has_key_tag(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_val_tag() const RYML_NOEXCEPT { _C4RR(); return tree_->has_val_tag(id_); } /**< Forward to @ref Tree::has_val_tag(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_key_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->has_key_anchor(id_); } /**< Forward to @ref Tree::has_key_anchor(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_val_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->has_val_anchor(id_); } /**< Forward to @ref Tree::has_val_anchor(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_anchor() const RYML_NOEXCEPT { _C4RR(); return tree_->has_anchor(id_); } /**< Forward to @ref Tree::has_anchor(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_ref(id_); } /**< Forward to @ref Tree::is_key_ref(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_ref(id_); } /**< Forward to @ref Tree::is_val_ref(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_ref() const RYML_NOEXCEPT { _C4RR(); return tree_->is_ref(id_); } /**< Forward to @ref Tree::is_ref(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool parent_is_seq() const RYML_NOEXCEPT { _C4RR(); return tree_->parent_is_seq(id_); } /**< Forward to @ref Tree::parent_is_seq(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool parent_is_map() const RYML_NOEXCEPT { _C4RR(); return tree_->parent_is_map(id_); } /**< Forward to @ref Tree::parent_is_map(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
RYML_DEPRECATED("use has_key_anchor()") bool is_key_anchor() const noexcept { _C4RR(); return tree_->has_key_anchor(id_); }
|
|
|
|
|
RYML_DEPRECATED("use has_val_anchor()") bool is_val_hanchor() const noexcept { _C4RR(); return tree_->has_val_anchor(id_); }
|
|
|
|
|
@@ -263,31 +265,33 @@ public:
|
|
|
|
|
/** @name node container+scalar style predicates */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool type_has_any(NodeType_e bits) const { _C4RR(); return tree_->type_has_any(id_, bits); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool type_has_all(NodeType_e bits) const { _C4RR(); return tree_->type_has_all(id_, bits); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool type_has_none(NodeType_e bits) const { _C4RR(); return tree_->type_has_none(id_, bits); }
|
|
|
|
|
// documentation to the right -->
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_container_styled() const { _C4RR(); return tree_->is_container_styled(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_block() const { _C4RR(); return tree_->is_block(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_flow_sl() const { _C4RR(); return tree_->is_flow_sl(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_flow_ml() const { _C4RR(); return tree_->is_flow_ml(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_flow() const { _C4RR(); return tree_->is_flow(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE bool type_has_any(NodeType_e bits) const RYML_NOEXCEPT { _C4RR(); return tree_->type_has_any(id_, bits); } /**< Forward to @ref Tree::type_has_any(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool type_has_all(NodeType_e bits) const RYML_NOEXCEPT { _C4RR(); return tree_->type_has_all(id_, bits); } /**< Forward to @ref Tree::type_has_all(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool type_has_none(NodeType_e bits) const RYML_NOEXCEPT { _C4RR(); return tree_->type_has_none(id_, bits); } /**< Forward to @ref Tree::type_has_none(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_key_styled() const { _C4RR(); return tree_->is_key_styled(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_val_styled() const { _C4RR(); return tree_->is_val_styled(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_key_literal() const { _C4RR(); return tree_->is_key_literal(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_val_literal() const { _C4RR(); return tree_->is_val_literal(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_key_folded() const { _C4RR(); return tree_->is_key_folded(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_val_folded() const { _C4RR(); return tree_->is_val_folded(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_key_squo() const { _C4RR(); return tree_->is_key_squo(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_val_squo() const { _C4RR(); return tree_->is_val_squo(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_key_dquo() const { _C4RR(); return tree_->is_key_dquo(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_val_dquo() const { _C4RR(); return tree_->is_val_dquo(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_key_plain() const { _C4RR(); return tree_->is_key_plain(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_val_plain() const { _C4RR(); return tree_->is_val_plain(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_key_quoted() const { _C4RR(); return tree_->is_key_quoted(id_); } /**< Forward to Tree::is_key_quoted(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_val_quoted() const { _C4RR(); return tree_->is_val_quoted(id_); } /**< Forward to Tree::is_val_quoted(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE bool is_quoted() const { _C4RR(); return tree_->is_quoted(id_); } /**< Forward to Tree::is_quoted(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_container_styled() const RYML_NOEXCEPT { _C4RR(); return tree_->is_container_styled(id_); } /**< Forward to @ref Tree::is_container_styled(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_block() const RYML_NOEXCEPT { _C4RR(); return tree_->is_block(id_); } /**< Forward to @ref Tree::is_block(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_flow_sl() const RYML_NOEXCEPT { _C4RR(); return tree_->is_flow_sl(id_); } /**< Forward to @ref Tree::is_flow_sl(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_flow_ml() const RYML_NOEXCEPT { _C4RR(); return tree_->is_flow_ml(id_); } /**< Forward to @ref Tree::is_flow_ml(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_flow() const RYML_NOEXCEPT { _C4RR(); return tree_->is_flow(id_); } /**< Forward to @ref Tree::is_flow(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_styled() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_styled(id_); } /**< Forward to @ref Tree::is_key_styled(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_styled() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_styled(id_); } /**< Forward to @ref Tree::is_val_styled(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_literal() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_literal(id_); } /**< Forward to @ref Tree::is_key_literal(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_literal() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_literal(id_); } /**< Forward to @ref Tree::is_val_literal(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_folded() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_folded(id_); } /**< Forward to @ref Tree::is_key_folded(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_folded() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_folded(id_); } /**< Forward to @ref Tree::is_val_folded(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_squo() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_squo(id_); } /**< Forward to @ref Tree::is_key_squo(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_squo() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_squo(id_); } /**< Forward to @ref Tree::is_val_squo(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_dquo() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_dquo(id_); } /**< Forward to @ref Tree::is_key_dquo(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_dquo() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_dquo(id_); } /**< Forward to @ref Tree::is_val_dquo(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_plain() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_plain(id_); } /**< Forward to @ref Tree::is_key_plain(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_plain() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_plain(id_); } /**< Forward to @ref Tree::is_val_plain(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_key_quoted() const RYML_NOEXCEPT { _C4RR(); return tree_->is_key_quoted(id_); } /**< Forward to @ref Tree::is_key_quoted(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_val_quoted() const RYML_NOEXCEPT { _C4RR(); return tree_->is_val_quoted(id_); } /**< Forward to @ref Tree::is_val_quoted(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_quoted() const RYML_NOEXCEPT { _C4RR(); return tree_->is_quoted(id_); } /**< Forward to @ref Tree::is_quoted(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
@@ -296,19 +300,20 @@ public:
|
|
|
|
|
/** @name hierarchy predicates */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE bool is_root() const RYML_NOEXCEPT { _C4RR(); return tree_->is_root(id_); } /**< Forward to Tree::is_root(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_parent() const RYML_NOEXCEPT { _C4RR(); return tree_->has_parent(id_); } /**< Forward to Tree::has_parent() Node must be readable. */
|
|
|
|
|
// documentation to the right -->
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE bool has_child(ConstImpl const& n) const RYML_NOEXCEPT { _C4RR(); return n.readable() ? tree_->has_child(id_, n.m_id) : false; } /**< Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_child(id_type node) const RYML_NOEXCEPT { _C4RR(); return tree_->has_child(id_, node); } /**< Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_child(csubstr name) const RYML_NOEXCEPT { _C4RR(); return tree_->has_child(id_, name); } /**< Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_children() const RYML_NOEXCEPT { _C4RR(); return tree_->has_children(id_); } /**< Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool is_root() const RYML_NOEXCEPT { _C4RR(); return tree_->is_root(id_); } /**< Forward to @ref Tree::is_root(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_parent() const RYML_NOEXCEPT { _C4RR(); return tree_->has_parent(id_); } /**< Forward to @ref Tree::has_parent() Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE bool has_sibling(ConstImpl const& n) const RYML_NOEXCEPT { _C4RR(); return n.readable() ? tree_->has_sibling(id_, n.m_id) : false; } /**< Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_sibling(id_type node) const RYML_NOEXCEPT { _C4RR(); return tree_->has_sibling(id_, node); } /**< Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_sibling(csubstr name) const RYML_NOEXCEPT { _C4RR(); return tree_->has_sibling(id_, name); } /**< Node must be readable. */
|
|
|
|
|
/** does not count with this */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_other_siblings() const RYML_NOEXCEPT { _C4RR(); return tree_->has_other_siblings(id_); }
|
|
|
|
|
C4_ALWAYS_INLINE bool has_child(ConstImpl const& n) const RYML_NOEXCEPT { _C4RR(); return n.readable() ? tree_->has_child(id_, n.m_id) : false; } /**< Forward to @ref Tree::has_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_child(id_type node) const RYML_NOEXCEPT { _C4RR(); return tree_->has_child(id_, node); } /**< Forward to @ref Tree::has_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_child(csubstr name) const RYML_NOEXCEPT { _C4RR(); return tree_->has_child(id_, name); } /**< Forward to @ref Tree::has_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_children() const RYML_NOEXCEPT { _C4RR(); return tree_->has_children(id_); } /**< Forward to @ref Tree::has_child(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE bool has_sibling(ConstImpl const& n) const RYML_NOEXCEPT { _C4RR(); return n.readable() ? tree_->has_sibling(id_, n.m_id) : false; } /**< Forward to @ref Tree::has_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_sibling(id_type node) const RYML_NOEXCEPT { _C4RR(); return tree_->has_sibling(id_, node); } /**< Forward to @ref Tree::has_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_sibling(csubstr name) const RYML_NOEXCEPT { _C4RR(); return tree_->has_sibling(id_, name); } /**< Forward to @ref Tree::has_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE bool has_other_siblings() const RYML_NOEXCEPT { _C4RR(); return tree_->has_other_siblings(id_); } /**< Forward to @ref Tree::has_sibling(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
RYML_DEPRECATED("use has_other_siblings()") bool has_siblings() const RYML_NOEXCEPT { _C4RR(); return tree_->has_siblings(id_); }
|
|
|
|
|
|
|
|
|
|
@@ -319,69 +324,62 @@ public:
|
|
|
|
|
/** @name hierarchy getters */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
// documentation to the right -->
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto doc(id_type i) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { RYML_ASSERT(tree_); return {tree__, tree__->doc(i)}; } /**< Forward to Tree::doc(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto doc(id_type i) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { RYML_ASSERT(tree_); return {tree__, tree__->doc(i)}; } /**< Forward to @ref Tree::doc(). Node must be readable. */
|
|
|
|
|
/** succeeds even when the node may have invalid or seed id */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl doc(id_type i) const RYML_NOEXCEPT { RYML_ASSERT(tree_); return {tree_, tree_->doc(i)}; } /**< Forward to Tree::doc(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl doc(id_type i) const RYML_NOEXCEPT { RYML_ASSERT(tree_); return {tree_, tree_->doc(i)}; } /**< Forward to @ref Tree::doc(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto parent() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->parent(id__)}; } /**< Forward to Tree::parent(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl parent() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->parent(id_)}; } /**< Forward to Tree::parent(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto parent() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->parent(id__)}; } /**< Forward to @ref Tree::parent(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl parent() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->parent(id_)}; } /**< Forward to @ref Tree::parent(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto first_child() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->first_child(id__)}; } /**< Forward to Tree::first_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl first_child() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->first_child(id_)}; } /**< Forward to Tree::first_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto first_child() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->first_child(id__)}; } /**< Forward to @ref Tree::first_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl first_child() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->first_child(id_)}; } /**< Forward to @ref Tree::first_child(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto last_child() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->last_child(id__)}; } /**< Forward to Tree::last_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl last_child () const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->last_child (id_)}; } /**< Forward to Tree::last_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto last_child() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->last_child(id__)}; } /**< Forward to @ref Tree::last_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl last_child () const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->last_child (id_)}; } /**< Forward to @ref Tree::last_child(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto child(id_type pos) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->child(id__, pos)}; } /**< Forward to Tree::child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl child(id_type pos) const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->child(id_, pos)}; } /**< Forward to Tree::child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto child(id_type pos) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->child(id__, pos)}; } /**< Forward to @ref Tree::child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl child(id_type pos) const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->child(id_, pos)}; } /**< Forward to @ref Tree::child(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto find_child(csubstr name) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->find_child(id__, name)}; } /**< Forward to Tree::first_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl find_child(csubstr name) const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->find_child(id_, name)}; } /**< Forward to Tree::first_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto find_child(csubstr name) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->find_child(id__, name)}; } /**< Forward to @ref Tree::first_child(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl find_child(csubstr name) const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->find_child(id_, name)}; } /**< Forward to @ref Tree::first_child(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto prev_sibling() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->prev_sibling(id__)}; } /**< Forward to Tree::prev_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl prev_sibling() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->prev_sibling(id_)}; } /**< Forward to Tree::prev_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto prev_sibling() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->prev_sibling(id__)}; } /**< Forward to @ref Tree::prev_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl prev_sibling() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->prev_sibling(id_)}; } /**< Forward to @ref Tree::prev_sibling(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto next_sibling() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->next_sibling(id__)}; } /**< Forward to Tree::next_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl next_sibling() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->next_sibling(id_)}; } /**< Forward to Tree::next_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto next_sibling() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->next_sibling(id__)}; } /**< Forward to @ref Tree::next_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl next_sibling() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->next_sibling(id_)}; } /**< Forward to @ref Tree::next_sibling(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto first_sibling() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->first_sibling(id__)}; } /**< Forward to Tree::first_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl first_sibling() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->first_sibling(id_)}; } /**< Forward to Tree::first_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto first_sibling() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->first_sibling(id__)}; } /**< Forward to @ref Tree::first_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl first_sibling() const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->first_sibling(id_)}; } /**< Forward to @ref Tree::first_sibling(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto last_sibling() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->last_sibling(id__)}; } /**< Forward to Tree::last_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl last_sibling () const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->last_sibling(id_)}; } /**< Forward to Tree::last_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto last_sibling() RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->last_sibling(id__)}; } /**< Forward to @ref Tree::last_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl last_sibling () const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->last_sibling(id_)}; } /**< Forward to @ref Tree::last_sibling(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto sibling(id_type pos) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->sibling(id__, pos)}; } /**< Forward to Tree::sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl sibling(id_type pos) const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->sibling(id_, pos)}; } /**< Forward to Tree::sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto sibling(id_type pos) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->sibling(id__, pos)}; } /**< Forward to @ref Tree::sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl sibling(id_type pos) const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->sibling(id_, pos)}; } /**< Forward to @ref Tree::sibling(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto find_sibling(csubstr name) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->find_sibling(id__, name)}; } /**< Forward to Tree::find_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl find_sibling(csubstr name) const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->find_sibling(id_, name)}; } /**< Forward to Tree::find_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE auto find_sibling(csubstr name) RYML_NOEXCEPT -> _C4_IF_MUTABLE(Impl) { _C4RR(); return {tree__, tree__->find_sibling(id__, name)}; } /**< Forward to @ref Tree::find_sibling(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE ConstImpl find_sibling(csubstr name) const RYML_NOEXCEPT { _C4RR(); return {tree_, tree_->find_sibling(id_, name)}; } /**< Forward to @ref Tree::find_sibling(). Node must be readable. */
|
|
|
|
|
|
|
|
|
|
/** O(num_children). Forward to Tree::num_children(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type num_children() const RYML_NOEXCEPT { _C4RR(); return tree_->num_children(id_); }
|
|
|
|
|
|
|
|
|
|
/** O(num_children). Forward to Tree::num_siblings(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type num_siblings() const RYML_NOEXCEPT { _C4RR(); return tree_->num_siblings(id_); }
|
|
|
|
|
|
|
|
|
|
/** O(num_siblings). Forward to Tree::num_other_siblings(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type num_other_siblings() const RYML_NOEXCEPT { _C4RR(); return tree_->num_other_siblings(id_); }
|
|
|
|
|
|
|
|
|
|
/** O(num_children). Forward to Tree::child_pos(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type child_pos(ConstImpl const& n) const RYML_NOEXCEPT { _C4RR(); _RYML_CB_ASSERT(tree_->m_callbacks, n.readable()); return tree_->child_pos(id_, n.m_id); }
|
|
|
|
|
|
|
|
|
|
/** O(num_siblings). Forward to Tree::sibling_pos(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type sibling_pos(ConstImpl const& n) const RYML_NOEXCEPT { _C4RR(); _RYML_CB_ASSERT(tree_->callbacks(), n.readable()); return tree_->child_pos(tree_->parent(id_), n.m_id); }
|
|
|
|
|
C4_ALWAYS_INLINE id_type num_children() const RYML_NOEXCEPT { _C4RR(); return tree_->num_children(id_); } /**< O(num_children). Forward to @ref Tree::num_children(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type num_siblings() const RYML_NOEXCEPT { _C4RR(); return tree_->num_siblings(id_); } /**< O(num_children). Forward to @ref Tree::num_siblings(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type num_other_siblings() const RYML_NOEXCEPT { _C4RR(); return tree_->num_other_siblings(id_); } /**< O(num_siblings). Forward to @ref Tree::num_other_siblings(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type child_pos(ConstImpl const& n) const RYML_NOEXCEPT { _C4RR(); _RYML_CB_ASSERT(tree_->m_callbacks, n.readable()); return tree_->child_pos(id_, n.m_id); } /**< O(num_children). Forward to @ref Tree::child_pos(). */
|
|
|
|
|
C4_ALWAYS_INLINE id_type sibling_pos(ConstImpl const& n) const RYML_NOEXCEPT { _C4RR(); _RYML_CB_ASSERT(tree_->callbacks(), n.readable()); return tree_->child_pos(tree_->parent(id_), n.m_id); } /**< O(num_siblings). Forward to @ref Tree::sibling_pos(). */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE id_type depth_asc() const RYML_NOEXCEPT { _C4RR(); return tree_->depth_asc(id_); } /** O(log(num_nodes)). Forward to Tree::depth_asc(). Node must be readable. */
|
|
|
|
|
C4_ALWAYS_INLINE id_type depth_desc() const RYML_NOEXCEPT { _C4RR(); return tree_->depth_desc(id_); } /** O(num_nodes). Forward to Tree::depth_desc(). Node must be readable. */
|
|
|
|
|
@@ -617,6 +615,7 @@ public:
|
|
|
|
|
/** @name deserialization */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
/** deserialize the node's val to the given variable */
|
|
|
|
|
template<class T>
|
|
|
|
|
ConstImpl const& operator>> (T &v) const
|
|
|
|
|
{
|
|
|
|
|
@@ -626,7 +625,8 @@ public:
|
|
|
|
|
return *((ConstImpl const*)this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** deserialize the node's key to the given variable */
|
|
|
|
|
/** deserialize the node's key to the given variable; use @ref key()
|
|
|
|
|
* to disambiguate; for example: `node >> ryml::key(var)` */
|
|
|
|
|
template<class T>
|
|
|
|
|
ConstImpl const& operator>> (Key<T> v) const
|
|
|
|
|
{
|
|
|
|
|
@@ -636,14 +636,14 @@ public:
|
|
|
|
|
return *((ConstImpl const*)this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** deserialize the node's key as base64 */
|
|
|
|
|
/** deserialize the node's key as base64. lightweight wrapper over @ref deserialize_key() */
|
|
|
|
|
ConstImpl const& operator>> (Key<fmt::base64_wrapper> w) const
|
|
|
|
|
{
|
|
|
|
|
deserialize_key(w.wrapper);
|
|
|
|
|
return *((ConstImpl const*)this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** deserialize the node's val as base64 */
|
|
|
|
|
/** deserialize the node's val as base64. lightweight wrapper over @ref deserialize_val() */
|
|
|
|
|
ConstImpl const& operator>> (fmt::base64_wrapper w) const
|
|
|
|
|
{
|
|
|
|
|
deserialize_val(w);
|
|
|
|
|
@@ -667,6 +667,8 @@ public:
|
|
|
|
|
return from_chars(val(), &v);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** look for a child by name, if it exists assign to var. return
|
|
|
|
|
* true if the child existed. */
|
|
|
|
|
template<class T>
|
|
|
|
|
bool get_if(csubstr name, T *var) const
|
|
|
|
|
{
|
|
|
|
|
@@ -678,6 +680,9 @@ public:
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** look for a child by name, if it exists assign to var,
|
|
|
|
|
* otherwise default to fallback. return true if the child
|
|
|
|
|
* existed. */
|
|
|
|
|
template<class T>
|
|
|
|
|
bool get_if(csubstr name, T *var, T const& fallback) const
|
|
|
|
|
{
|
|
|
|
|
@@ -717,14 +722,20 @@ public:
|
|
|
|
|
using children_view = detail::children_view_<Impl>;
|
|
|
|
|
using const_children_view = detail::children_view_<ConstImpl>;
|
|
|
|
|
|
|
|
|
|
/** get an iterator to the first child */
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto begin() RYML_NOEXCEPT -> _C4_IF_MUTABLE(iterator) { _C4RR(); return iterator(tree__, tree__->first_child(id__)); }
|
|
|
|
|
/** get an iterator to the first child */
|
|
|
|
|
C4_ALWAYS_INLINE const_iterator begin() const RYML_NOEXCEPT { _C4RR(); return const_iterator(tree_, tree_->first_child(id_)); }
|
|
|
|
|
/** get an iterator to the first child */
|
|
|
|
|
C4_ALWAYS_INLINE const_iterator cbegin() const RYML_NOEXCEPT { _C4RR(); return const_iterator(tree_, tree_->first_child(id_)); }
|
|
|
|
|
|
|
|
|
|
/** get an iterator to after the last child */
|
|
|
|
|
template<class U=Impl>
|
|
|
|
|
C4_ALWAYS_INLINE auto end() RYML_NOEXCEPT -> _C4_IF_MUTABLE(iterator) { _C4RR(); return iterator(tree__, NONE); }
|
|
|
|
|
/** get an iterator to after the last child */
|
|
|
|
|
C4_ALWAYS_INLINE const_iterator end() const RYML_NOEXCEPT { _C4RR(); return const_iterator(tree_, NONE); }
|
|
|
|
|
/** get an iterator to after the last child */
|
|
|
|
|
C4_ALWAYS_INLINE const_iterator cend() const RYML_NOEXCEPT { _C4RR(); return const_iterator(tree_, tree_->first_child(id_)); }
|
|
|
|
|
|
|
|
|
|
/** get an iterable view over children */
|
|
|
|
|
@@ -838,17 +849,17 @@ public:
|
|
|
|
|
/** @name construction */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
ConstNodeRef() : m_tree(nullptr), m_id(NONE) {}
|
|
|
|
|
ConstNodeRef(Tree const &t) : m_tree(&t), m_id(t .root_id()) {}
|
|
|
|
|
ConstNodeRef(Tree const *t) : m_tree(t ), m_id(t->root_id()) {}
|
|
|
|
|
ConstNodeRef(Tree const *t, id_type id) : m_tree(t), m_id(id) {}
|
|
|
|
|
ConstNodeRef(std::nullptr_t) : m_tree(nullptr), m_id(NONE) {}
|
|
|
|
|
ConstNodeRef() noexcept : m_tree(nullptr), m_id(NONE) {}
|
|
|
|
|
ConstNodeRef(Tree const &t) noexcept : m_tree(&t), m_id(t .root_id()) {}
|
|
|
|
|
ConstNodeRef(Tree const *t) noexcept : m_tree(t ), m_id(t->root_id()) {}
|
|
|
|
|
ConstNodeRef(Tree const *t, id_type id) noexcept : m_tree(t), m_id(id) {}
|
|
|
|
|
ConstNodeRef(std::nullptr_t) noexcept : m_tree(nullptr), m_id(NONE) {}
|
|
|
|
|
|
|
|
|
|
ConstNodeRef(ConstNodeRef const&) = default;
|
|
|
|
|
ConstNodeRef(ConstNodeRef &&) = default;
|
|
|
|
|
ConstNodeRef(ConstNodeRef const&) noexcept = default;
|
|
|
|
|
ConstNodeRef(ConstNodeRef &&) noexcept = default;
|
|
|
|
|
|
|
|
|
|
ConstNodeRef(NodeRef const&);
|
|
|
|
|
ConstNodeRef(NodeRef &&);
|
|
|
|
|
ConstNodeRef(NodeRef const&) noexcept;
|
|
|
|
|
ConstNodeRef(NodeRef &&) noexcept;
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
@@ -857,13 +868,13 @@ public:
|
|
|
|
|
/** @name assignment */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
ConstNodeRef& operator= (std::nullptr_t) { m_tree = nullptr; m_id = NONE; return *this; }
|
|
|
|
|
ConstNodeRef& operator= (std::nullptr_t) noexcept { m_tree = nullptr; m_id = NONE; return *this; }
|
|
|
|
|
|
|
|
|
|
ConstNodeRef& operator= (ConstNodeRef const&) = default;
|
|
|
|
|
ConstNodeRef& operator= (ConstNodeRef &&) = default;
|
|
|
|
|
ConstNodeRef& operator= (ConstNodeRef const&) noexcept = default;
|
|
|
|
|
ConstNodeRef& operator= (ConstNodeRef &&) noexcept = default;
|
|
|
|
|
|
|
|
|
|
ConstNodeRef& operator= (NodeRef const&);
|
|
|
|
|
ConstNodeRef& operator= (NodeRef &&);
|
|
|
|
|
ConstNodeRef& operator= (NodeRef const&) noexcept;
|
|
|
|
|
ConstNodeRef& operator= (NodeRef &&) noexcept;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
@@ -999,15 +1010,15 @@ public:
|
|
|
|
|
/** @name construction */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
NodeRef() : m_tree(nullptr), m_id(NONE), m_seed() { _clear_seed(); }
|
|
|
|
|
NodeRef(Tree &t) : m_tree(&t), m_id(t .root_id()), m_seed() { _clear_seed(); }
|
|
|
|
|
NodeRef(Tree *t) : m_tree(t ), m_id(t->root_id()), m_seed() { _clear_seed(); }
|
|
|
|
|
NodeRef(Tree *t, id_type id) : m_tree(t), m_id(id), m_seed() { _clear_seed(); }
|
|
|
|
|
NodeRef(Tree *t, id_type id, id_type seed_pos) : m_tree(t), m_id(id), m_seed() { m_seed.str = nullptr; m_seed.len = (size_t)seed_pos; }
|
|
|
|
|
NodeRef(Tree *t, id_type id, csubstr seed_key) : m_tree(t), m_id(id), m_seed(seed_key) {}
|
|
|
|
|
NodeRef(std::nullptr_t) : m_tree(nullptr), m_id(NONE), m_seed() {}
|
|
|
|
|
NodeRef() noexcept : m_tree(nullptr), m_id(NONE), m_seed() { _clear_seed(); }
|
|
|
|
|
NodeRef(Tree &t) noexcept : m_tree(&t), m_id(t .root_id()), m_seed() { _clear_seed(); }
|
|
|
|
|
NodeRef(Tree *t) noexcept : m_tree(t ), m_id(t->root_id()), m_seed() { _clear_seed(); }
|
|
|
|
|
NodeRef(Tree *t, id_type id) noexcept : m_tree(t), m_id(id), m_seed() { _clear_seed(); }
|
|
|
|
|
NodeRef(Tree *t, id_type id, id_type seed_pos) noexcept : m_tree(t), m_id(id), m_seed() { m_seed.str = nullptr; m_seed.len = (size_t)seed_pos; }
|
|
|
|
|
NodeRef(Tree *t, id_type id, csubstr seed_key) noexcept : m_tree(t), m_id(id), m_seed(seed_key) {}
|
|
|
|
|
NodeRef(std::nullptr_t) noexcept : m_tree(nullptr), m_id(NONE), m_seed() {}
|
|
|
|
|
|
|
|
|
|
inline void _clear_seed() { /*do the following manually or an assert is triggered: */ m_seed.str = nullptr; m_seed.len = npos; }
|
|
|
|
|
inline void _clear_seed() noexcept { /*do the following manually or an assert is triggered: */ m_seed.str = nullptr; m_seed.len = npos; }
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
@@ -1016,11 +1027,11 @@ public:
|
|
|
|
|
/** @name assignment */
|
|
|
|
|
/** @{ */
|
|
|
|
|
|
|
|
|
|
NodeRef(NodeRef const&) = default;
|
|
|
|
|
NodeRef(NodeRef &&) = default;
|
|
|
|
|
NodeRef(NodeRef const&) noexcept = default;
|
|
|
|
|
NodeRef(NodeRef &&) noexcept = default;
|
|
|
|
|
|
|
|
|
|
NodeRef& operator= (NodeRef const&) = default;
|
|
|
|
|
NodeRef& operator= (NodeRef &&) = default;
|
|
|
|
|
NodeRef& operator= (NodeRef const&) noexcept = default;
|
|
|
|
|
NodeRef& operator= (NodeRef &&) noexcept = default;
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
@@ -1029,12 +1040,12 @@ public:
|
|
|
|
|
/** @name state_queries
|
|
|
|
|
* @{ */
|
|
|
|
|
|
|
|
|
|
/** true if the object is not referring to any existing or seed node @see the doc for the NodeRef */
|
|
|
|
|
inline bool invalid() const { return m_tree == nullptr || m_id == NONE; }
|
|
|
|
|
/** true if the object is not invalid and in seed state. @see the doc for the NodeRef */
|
|
|
|
|
inline bool is_seed() const { return (m_tree != NULL && m_id != NONE) && (m_seed.str != nullptr || m_seed.len != (size_t)NONE); }
|
|
|
|
|
/** true if the object is not invalid and not in seed state. @see the doc for the NodeRef */
|
|
|
|
|
inline bool readable() const { return (m_tree != NULL && m_id != NONE) && (m_seed.str == nullptr && m_seed.len == (size_t)NONE); }
|
|
|
|
|
/** true if the object is not referring to any existing or seed node. @see the doc for @ref NodeRef */
|
|
|
|
|
inline bool invalid() const noexcept { return m_tree == nullptr || m_id == NONE; }
|
|
|
|
|
/** true if the object is not invalid and in seed state. @see the doc for @ref NodeRef */
|
|
|
|
|
inline bool is_seed() const noexcept { return (m_tree != NULL && m_id != NONE) && (m_seed.str != nullptr || m_seed.len != (size_t)NONE); }
|
|
|
|
|
/** true if the object is not invalid and not in seed state. @see the doc for @ref NodeRef */
|
|
|
|
|
inline bool readable() const noexcept { return (m_tree != NULL && m_id != NONE) && (m_seed.str == nullptr && m_seed.len == (size_t)NONE); }
|
|
|
|
|
|
|
|
|
|
RYML_DEPRECATED("use one of readable(), is_seed() or !invalid()") inline bool valid() const { return m_tree != nullptr && m_id != NONE; }
|
|
|
|
|
|
|
|
|
|
@@ -1081,10 +1092,10 @@ public:
|
|
|
|
|
/** @name node_property_getters
|
|
|
|
|
* @{ */
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE Tree * tree() noexcept { return m_tree; }
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE Tree const* tree() const noexcept { return m_tree; }
|
|
|
|
|
C4_ALWAYS_INLINE Tree * tree() noexcept { return m_tree; }
|
|
|
|
|
C4_ALWAYS_INLINE Tree const* tree() const noexcept { return m_tree; }
|
|
|
|
|
|
|
|
|
|
C4_ALWAYS_INLINE C4_PURE id_type id() const noexcept { return m_id; }
|
|
|
|
|
C4_ALWAYS_INLINE id_type id() const noexcept { return m_id; }
|
|
|
|
|
|
|
|
|
|
/** @} */
|
|
|
|
|
|
|
|
|
|
@@ -1550,27 +1561,27 @@ public:
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
inline ConstNodeRef::ConstNodeRef(NodeRef const& that)
|
|
|
|
|
inline ConstNodeRef::ConstNodeRef(NodeRef const& that) noexcept
|
|
|
|
|
: m_tree(that.m_tree)
|
|
|
|
|
, m_id(!that.is_seed() ? that.id() : (id_type)NONE)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline ConstNodeRef::ConstNodeRef(NodeRef && that)
|
|
|
|
|
inline ConstNodeRef::ConstNodeRef(NodeRef && that) noexcept
|
|
|
|
|
: m_tree(that.m_tree)
|
|
|
|
|
, m_id(!that.is_seed() ? that.id() : (id_type)NONE)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline ConstNodeRef& ConstNodeRef::operator= (NodeRef const& that)
|
|
|
|
|
inline ConstNodeRef& ConstNodeRef::operator= (NodeRef const& that) noexcept
|
|
|
|
|
{
|
|
|
|
|
m_tree = (that.m_tree);
|
|
|
|
|
m_id = (!that.is_seed() ? that.id() : (id_type)NONE);
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline ConstNodeRef& ConstNodeRef::operator= (NodeRef && that)
|
|
|
|
|
inline ConstNodeRef& ConstNodeRef::operator= (NodeRef && that) noexcept
|
|
|
|
|
{
|
|
|
|
|
m_tree = (that.m_tree);
|
|
|
|
|
m_id = (!that.is_seed() ? that.id() : (id_type)NONE);
|
|
|
|
|
|