40 #ifndef _xmlwrapp_nodes_view_h_
41 #define _xmlwrapp_nodes_view_h_
45 #include "xmlwrapp/export.h"
54 class const_nodes_view;
60 class iter_advance_functor;
83 nodes_view() : data_begin_(0), advance_func_(0) {}
101 typedef int difference_type;
104 typedef std::forward_iterator_tag iterator_category;
106 iterator() : pimpl_(0), advance_func_(0) {}
118 explicit iterator(
void *data, impl::iter_advance_functor *advance_func);
119 void* get_raw_node()
const;
122 impl::nipimpl *pimpl_;
126 impl::iter_advance_functor *advance_func_;
130 friend bool XMLWRAPP_API operator==(
const iterator& lhs,
const iterator& rhs);
144 typedef int difference_type;
147 typedef std::forward_iterator_tag iterator_category;
163 explicit const_iterator(
void *data, impl::iter_advance_functor *advance_func);
164 void* get_raw_node()
const;
167 impl::nipimpl *pimpl_;
171 impl::iter_advance_functor *advance_func_;
191 size_type size()
const;
194 bool empty()
const {
return !data_begin_; }
197 explicit nodes_view(
void *data_begin, impl::iter_advance_functor *advance_func)
198 : data_begin_(data_begin), advance_func_(advance_func) {}
203 impl::iter_advance_functor *advance_func_;
206 friend class const_nodes_view;
244 size_type size()
const;
247 bool empty()
const {
return !data_begin_; }
250 explicit const_nodes_view(
void *data_begin, impl::iter_advance_functor *advance_func)
251 : data_begin_(data_begin), advance_func_(advance_func) {}
256 impl::iter_advance_functor *advance_func_;
263 inline bool XMLWRAPP_API operator==(
const nodes_view::iterator& lhs,
264 const nodes_view::iterator& rhs)
265 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
266 inline bool XMLWRAPP_API operator!=(
const nodes_view::iterator& lhs,
267 const nodes_view::iterator& rhs)
268 {
return !(lhs == rhs); }
270 inline bool XMLWRAPP_API operator==(
const nodes_view::const_iterator& lhs,
271 const nodes_view::const_iterator& rhs)
272 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
273 inline bool XMLWRAPP_API operator!=(
const nodes_view::const_iterator& lhs,
274 const nodes_view::const_iterator& rhs)
275 {
return !(lhs == rhs); }
279 #endif // _xmlwrapp_nodes_view_h_
bool empty() const
Is the view empty?
Definition: nodes_view.h:194
This file contains the definition of the xml::init class.
const_iterator end() const
Get an iterator that points one past the last child for this view.
Definition: nodes_view.h:241
iterator begin()
Get an iterator that points to the beginning of this view's nodes.
Definition: nodes_view.h:179
This class implements a read-only view of XML nodes.
Definition: nodes_view.h:219
std::size_t size_type
Size type.
Definition: nodes_view.h:223
const_iterator begin() const
Get an iterator that points to the beginning of this view's nodes.
Definition: nodes_view.h:237
std::size_t size_type
Size type.
Definition: nodes_view.h:81
const_iterator end() const
Get an iterator that points one past the last child for this view.
Definition: nodes_view.h:188
bool empty() const
Is the view empty?
Definition: nodes_view.h:247
The xml::node class is used to hold information about one XML node.
Definition: node.h:86
const_iterator begin() const
Get an iterator that points to the beginning of this view's nodes.
Definition: nodes_view.h:182
The iterator provides a way to access nodes in the view similar to a standard C++ container...
Definition: nodes_view.h:97
This class implements a view of XML nodes.
Definition: nodes_view.h:77
The const_iterator provides a way to access nodes in the view similar to a standard C++ container...
Definition: nodes_view.h:140
iterator end()
Get an iterator that points one past the last child for this view.
Definition: nodes_view.h:185