40#ifndef _xmlwrapp_nodes_view_h_
41#define _xmlwrapp_nodes_view_h_
45#include "xmlwrapp/export.h"
51XMLWRAPP_MSVC_SUPPRESS_DLL_MEMBER_WARN
57class const_nodes_view;
63class iter_advance_functor;
64struct xpath_context_impl;
87 nodes_view() : data_begin_(nullptr), advance_func_(nullptr) {}
105 using difference_type = int;
108 using iterator_category = std::forward_iterator_tag;
122 explicit iterator(
void *data, impl::iter_advance_functor *advance_func);
123 void* get_raw_node()
const;
126 std::unique_ptr<impl::nipimpl> pimpl_;
130 impl::iter_advance_functor *advance_func_ =
nullptr;
134 friend bool XMLWRAPP_API operator==(
const iterator& lhs,
const iterator& rhs);
148 using difference_type = int;
151 using iterator_category = std::forward_iterator_tag;
167 explicit const_iterator(
void *data, impl::iter_advance_functor *advance_func);
168 void* get_raw_node()
const;
171 std::unique_ptr<impl::nipimpl> pimpl_;
175 impl::iter_advance_functor *advance_func_ =
nullptr;
198 bool empty()
const {
return !data_begin_; }
232 explicit nodes_view(
void *data_begin, impl::iter_advance_functor *advance_func)
233 : data_begin_(data_begin), advance_func_(advance_func) {}
238 impl::iter_advance_functor *advance_func_;
241 friend struct impl::xpath_context_impl;
283 bool empty()
const {
return !data_begin_; }
286 explicit const_nodes_view(
void *data_begin, impl::iter_advance_functor *advance_func)
287 : data_begin_(data_begin), advance_func_(advance_func) {}
292 impl::iter_advance_functor *advance_func_;
295 friend struct impl::xpath_context_impl;
300inline bool operator==(
const nodes_view::iterator& lhs,
const nodes_view::iterator& rhs)
301 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
302inline bool operator!=(
const nodes_view::iterator& lhs,
const nodes_view::iterator& rhs)
303 {
return !(lhs == rhs); }
305inline bool operator==(
const nodes_view::const_iterator& lhs,
const nodes_view::const_iterator& rhs)
306 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
307inline bool operator!=(
const nodes_view::const_iterator& lhs,
const nodes_view::const_iterator& rhs)
308 {
return !(lhs == rhs); }
312XMLWRAPP_MSVC_RESTORE_DLL_MEMBER_WARN
This class implements a read-only view of XML nodes.
Definition nodes_view.h:256
bool empty() const
Is the view empty?
Definition nodes_view.h:283
const_iterator end() const
Get an iterator that points one past the last child for this view.
Definition nodes_view.h:277
std::size_t size_type
Size type.
Definition nodes_view.h:259
const_iterator begin() const
Get an iterator that points to the beginning of this view's nodes.
Definition nodes_view.h:273
size_type size() const
Returns the number of nodes in this view.
The xml::node class is used to hold information about one XML node.
Definition node.h:92
The const_iterator provides a way to access nodes in the view similar to a standard C++ container.
Definition nodes_view.h:145
The iterator provides a way to access nodes in the view similar to a standard C++ container.
Definition nodes_view.h:102
This class implements a view of XML nodes.
Definition nodes_view.h:82
bool empty() const
Is the view empty?
Definition nodes_view.h:198
iterator erase(const iterator &to_erase)
Erase the node that is pointed to by the given iterator.
iterator erase(iterator first, const iterator &last)
Erase all nodes in the given range, from first to last.
size_type size() const
Returns the number of nodes in this view.
iterator end()
Get an iterator that points one past the last child for this view.
Definition nodes_view.h:189
const_iterator begin() const
Get an iterator that points to the beginning of this view's nodes.
Definition nodes_view.h:186
std::size_t size_type
Size type.
Definition nodes_view.h:85
const_iterator end() const
Get an iterator that points one past the last child for this view.
Definition nodes_view.h:192
iterator begin()
Get an iterator that points to the beginning of this view's nodes.
Definition nodes_view.h:183
XML library namespace.
Definition attributes.h:55
This file contains the definition of the xml::init class.