rapidxml_iterators.hpp
Go to the documentation of this file.
1 #ifndef RAPIDXML_ITERATORS_HPP_INCLUDED
2 #define RAPIDXML_ITERATORS_HPP_INCLUDED
3 
4 // Copyright (C) 2006, 2009 Marcin Kalicinski
5 // Version 1.13
6 // Revision $DateTime: 2009/05/13 01:46:17 $
8 
9 #include "rapidxml.hpp"
10 
11 namespace rapidxml
12 {
13 
15  template<class Ch>
17  {
18 
19  public:
20 
21  typedef typename xml_node<Ch> value_type;
22  typedef typename xml_node<Ch> &reference;
23  typedef typename xml_node<Ch> *pointer;
24  typedef std::ptrdiff_t difference_type;
25  typedef std::bidirectional_iterator_tag iterator_category;
26 
28  : m_node(0)
29  {
30  }
31 
33  : m_node(node->first_node())
34  {
35  }
36 
37  reference operator *() const
38  {
39  assert(m_node);
40  return *m_node;
41  }
42 
43  pointer operator->() const
44  {
45  assert(m_node);
46  return m_node;
47  }
48 
50  {
51  assert(m_node);
52  m_node = m_node->next_sibling();
53  return *this;
54  }
55 
57  {
58  node_iterator tmp = *this;
59  ++this;
60  return tmp;
61  }
62 
64  {
65  assert(m_node && m_node->previous_sibling());
66  m_node = m_node->previous_sibling();
67  return *this;
68  }
69 
71  {
72  node_iterator tmp = *this;
73  ++this;
74  return tmp;
75  }
76 
77  bool operator ==(const node_iterator<Ch> &rhs)
78  {
79  return m_node == rhs.m_node;
80  }
81 
82  bool operator !=(const node_iterator<Ch> &rhs)
83  {
84  return m_node != rhs.m_node;
85  }
86 
87  private:
88 
90 
91  };
92 
94  template<class Ch>
96  {
97 
98  public:
99 
100  typedef typename xml_attribute<Ch> value_type;
101  typedef typename xml_attribute<Ch> &reference;
102  typedef typename xml_attribute<Ch> *pointer;
103  typedef std::ptrdiff_t difference_type;
104  typedef std::bidirectional_iterator_tag iterator_category;
105 
107  : m_attribute(0)
108  {
109  }
110 
112  : m_attribute(node->first_attribute())
113  {
114  }
115 
116  reference operator *() const
117  {
118  assert(m_attribute);
119  return *m_attribute;
120  }
121 
122  pointer operator->() const
123  {
124  assert(m_attribute);
125  return m_attribute;
126  }
127 
129  {
130  assert(m_attribute);
131  m_attribute = m_attribute->next_attribute();
132  return *this;
133  }
134 
136  {
137  attribute_iterator tmp = *this;
138  ++this;
139  return tmp;
140  }
141 
143  {
144  assert(m_attribute && m_attribute->previous_attribute());
145  m_attribute = m_attribute->previous_attribute();
146  return *this;
147  }
148 
150  {
151  attribute_iterator tmp = *this;
152  ++this;
153  return tmp;
154  }
155 
157  {
158  return m_attribute == rhs.m_attribute;
159  }
160 
162  {
163  return m_attribute != rhs.m_attribute;
164  }
165 
166  private:
167 
169 
170  };
171 
172 }
173 
174 #endif
node_iterator operator++(int)
This file contains rapidxml parser and DOM implementation.
Iterator of child nodes of xml_node.
std::bidirectional_iterator_tag iterator_category
node_iterator & operator++()
attribute_iterator & operator--()
attribute_iterator & operator++()
attribute_iterator operator++(int)
xml_attribute< Ch > * previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:836
reference operator*() const
node_iterator operator--(int)
bool operator==(const node_iterator< Ch > &rhs)
node_iterator & operator--()
Iterator of child attributes of xml_node.
attribute_iterator operator--(int)
node_iterator(xml_node< Ch > *node)
std::bidirectional_iterator_tag iterator_category
attribute_iterator(xml_node< Ch > *node)
bool operator!=(const node_iterator< Ch > &rhs)
xml_attribute< Ch > * m_attribute


asr_rapidxml
Author(s): Aumann Florian
autogenerated on Thu Dec 5 2019 03:14:37