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 
14 template <class Ch>
16  public:
17  typedef typename xml_node<Ch> value_type;
18  typedef typename xml_node<Ch> &reference;
19  typedef typename xml_node<Ch> *pointer;
20  typedef std::ptrdiff_t difference_type;
21  typedef std::bidirectional_iterator_tag iterator_category;
22 
24 
25  node_iterator(xml_node<Ch> *node) : m_node(node->first_node()) {}
26 
27  reference operator*() const {
28  assert(m_node);
29  return *m_node;
30  }
31 
32  pointer operator->() const {
33  assert(m_node);
34  return m_node;
35  }
36 
38  assert(m_node);
39  m_node = m_node->next_sibling();
40  return *this;
41  }
42 
44  node_iterator tmp = *this;
45  ++this;
46  return tmp;
47  }
48 
50  assert(m_node && m_node->previous_sibling());
51  m_node = m_node->previous_sibling();
52  return *this;
53  }
54 
56  node_iterator tmp = *this;
57  ++this;
58  return tmp;
59  }
60 
61  bool operator==(const node_iterator<Ch> &rhs) { return m_node == rhs.m_node; }
62 
63  bool operator!=(const node_iterator<Ch> &rhs) { return m_node != rhs.m_node; }
64 
65  private:
67 };
68 
70 template <class Ch>
72  public:
73  typedef typename xml_attribute<Ch> value_type;
74  typedef typename xml_attribute<Ch> &reference;
75  typedef typename xml_attribute<Ch> *pointer;
76  typedef std::ptrdiff_t difference_type;
77  typedef std::bidirectional_iterator_tag iterator_category;
78 
79  attribute_iterator() : m_attribute(0) {}
80 
82  : m_attribute(node->first_attribute()) {}
83 
84  reference operator*() const {
85  assert(m_attribute);
86  return *m_attribute;
87  }
88 
89  pointer operator->() const {
90  assert(m_attribute);
91  return m_attribute;
92  }
93 
95  assert(m_attribute);
96  m_attribute = m_attribute->next_attribute();
97  return *this;
98  }
99 
101  attribute_iterator tmp = *this;
102  ++this;
103  return tmp;
104  }
105 
107  assert(m_attribute && m_attribute->previous_attribute());
108  m_attribute = m_attribute->previous_attribute();
109  return *this;
110  }
111 
113  attribute_iterator tmp = *this;
114  ++this;
115  return tmp;
116  }
117 
119  return m_attribute == rhs.m_attribute;
120  }
121 
123  return m_attribute != rhs.m_attribute;
124  }
125 
126  private:
128 };
129 
130 } // namespace rapidxml
131 
132 #endif
node_iterator operator++(int)
This file contains rapidxml parser and DOM implementation.
xml_attribute< Ch > & reference
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)
bool operator==(const attribute_iterator< Ch > &rhs)
xml_attribute< Ch > * previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition: rapidxml.hpp:797
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
bool operator!=(const attribute_iterator< Ch > &rhs)
attribute_iterator(xml_node< Ch > *node)
bool operator!=(const node_iterator< Ch > &rhs)
xml_attribute< Ch > * m_attribute


livox_ros_driver
Author(s): Livox Dev Team
autogenerated on Mon Mar 15 2021 02:40:46