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;
61 struct xpath_context_impl;
84 nodes_view() : data_begin_(0), advance_func_(0) {}
102 typedef int difference_type;
105 typedef std::forward_iterator_tag iterator_category;
107 iterator() : pimpl_(0), advance_func_(0) {}
112 reference operator*()
const;
113 pointer operator->()
const;
119 explicit iterator(
void *data, impl::iter_advance_functor *advance_func);
120 void* get_raw_node()
const;
123 impl::nipimpl *pimpl_;
127 impl::iter_advance_functor *advance_func_;
131 friend bool XMLWRAPP_API operator==(
const iterator& lhs,
const iterator& rhs);
145 typedef int difference_type;
148 typedef std::forward_iterator_tag iterator_category;
157 reference operator*()
const;
158 pointer operator->()
const;
164 explicit const_iterator(
void *data, impl::iter_advance_functor *advance_func);
165 void* get_raw_node()
const;
168 impl::nipimpl *pimpl_;
172 impl::iter_advance_functor *advance_func_;
192 size_type size()
const;
195 bool empty()
const {
return !data_begin_; }
210 iterator erase(
const iterator& to_erase);
226 iterator erase(iterator first,
const iterator& last);
229 explicit nodes_view(
void *data_begin, impl::iter_advance_functor *advance_func)
230 : data_begin_(data_begin), advance_func_(advance_func) {}
235 impl::iter_advance_functor *advance_func_;
238 friend struct impl::xpath_context_impl;
239 friend class const_nodes_view;
271 {
return const_iterator(data_begin_, advance_func_); }
274 const_iterator
end()
const {
return const_iterator(); }
277 size_type size()
const;
280 bool empty()
const {
return !data_begin_; }
283 explicit const_nodes_view(
void *data_begin, impl::iter_advance_functor *advance_func)
284 : data_begin_(data_begin), advance_func_(advance_func) {}
289 impl::iter_advance_functor *advance_func_;
292 friend struct impl::xpath_context_impl;
297 inline bool XMLWRAPP_API operator==(
const nodes_view::iterator& lhs,
298 const nodes_view::iterator& rhs)
299 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
300 inline bool XMLWRAPP_API operator!=(
const nodes_view::iterator& lhs,
301 const nodes_view::iterator& rhs)
302 {
return !(lhs == rhs); }
304 inline bool XMLWRAPP_API operator==(
const nodes_view::const_iterator& lhs,
305 const nodes_view::const_iterator& rhs)
306 {
return lhs.get_raw_node() == rhs.get_raw_node(); }
307 inline bool XMLWRAPP_API operator!=(
const nodes_view::const_iterator& lhs,
308 const nodes_view::const_iterator& rhs)
309 {
return !(lhs == rhs); }
313 #endif // _xmlwrapp_nodes_view_h_
bool empty() const
Is the view empty?
Definition: nodes_view.h:195
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:274
iterator begin()
Get an iterator that points to the beginning of this view's nodes.
Definition: nodes_view.h:180
This class implements a read-only view of XML nodes.
Definition: nodes_view.h:252
std::size_t size_type
Size type.
Definition: nodes_view.h:256
const_iterator begin() const
Get an iterator that points to the beginning of this view's nodes.
Definition: nodes_view.h:270
XML library namespace.
Definition: attributes.h:51
std::size_t size_type
Size type.
Definition: nodes_view.h:82
const_iterator end() const
Get an iterator that points one past the last child for this view.
Definition: nodes_view.h:189
bool empty() const
Is the view empty?
Definition: nodes_view.h:280
The xml::node class is used to hold information about one XML node.
Definition: node.h:88
const_iterator begin() const
Get an iterator that points to the beginning of this view's nodes.
Definition: nodes_view.h:183
The iterator provides a way to access nodes in the view similar to a standard C++ container...
Definition: nodes_view.h:98
This class implements a view of XML nodes.
Definition: nodes_view.h:78
The const_iterator provides a way to access nodes in the view similar to a standard C++ container...
Definition: nodes_view.h:141
iterator end()
Get an iterator that points one past the last child for this view.
Definition: nodes_view.h:186