12 #ifndef DOCWIRE_XML_CHILDREN_VIEW_H
13 #define DOCWIRE_XML_CHILDREN_VIEW_H
15 #include "xml_descendants.h"
16 #include "log_scope.h"
18 #include "xml_node_ref.h"
31 template <safety_policy safety_level = default_safety_level>
51 : m_state(std::move(state)), m_depth(depth) {}
61 template <safety_policy safety_level>
67 using iterator_concept = std::input_iterator_tag;
68 using difference_type = std::ptrdiff_t;
73 bool operator==(
const sentinel& s)
const {
return m_desc_iter == s; }
75 reference operator*()
const {
return *m_desc_iter; }
76 pointer operator->()
const {
return m_desc_iter.operator->(); }
99 void find_next_child()
101 while (m_desc_iter !=
sentinel{} && ((*m_desc_iter).depth() != m_depth || (*m_desc_iter).type() == node_type::end_element))
118 template<safety_policy safety_level>
131 template<safety_policy safety_level>
Represents a logging scope.
A wrapper for pointer-like types that enforces a non-null invariant.
Iterator for traversing direct child nodes.
A view over the direct children of an XML node.
children_view(not_null< std::shared_ptr< iterator_state< safety_level >>, safety_level > state, int depth)
Constructs a view from an iterator state and depth.
A reference to the current XML node in the reader.
non_negative< int, safety_level > depth() const
Returns the depth of the node in the XML tree.
const not_null< std::shared_ptr< iterator_state< safety_level > >, safety_level > & state() const
Returns the shared iterator state associated with this node reference.
XML processing utilities.
children_view< safety_level > children(const node_ref< safety_level > &node)
Returns a view of the direct children of the given node.
A sentinel type used to define the end of a range or view.
Shared state for XML iterators to coordinate traversal.