Photon 1.0.0
Loading...
Searching...
No Matches
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
11namespace rapidxml
12{
13
15 template <class Ch> class node_iterator
16 {
17
18 public:
19 typedef typename xml_node<Ch> value_type;
20 typedef typename xml_node<Ch>& reference;
21 typedef typename xml_node<Ch>* pointer;
22 typedef std::ptrdiff_t difference_type;
23 typedef std::bidirectional_iterator_tag iterator_category;
24
26 {
27 }
28
29 node_iterator(xml_node<Ch>* node) : m_node(node->first_node())
30 {
31 }
32
34 {
35 assert(m_node);
36 return *m_node;
37 }
38
40 {
41 assert(m_node);
42 return m_node;
43 }
44
46 {
47 assert(m_node);
49 return *this;
50 }
51
53 {
54 node_iterator tmp = *this;
55 ++this;
56 return tmp;
57 }
58
60 {
61 assert(m_node && m_node->previous_sibling());
63 return *this;
64 }
65
67 {
68 node_iterator tmp = *this;
69 ++this;
70 return tmp;
71 }
72
74 {
75 return m_node == rhs.m_node;
76 }
77
79 {
80 return m_node != rhs.m_node;
81 }
82
83 private:
85 };
86
88 template <class Ch> class attribute_iterator
89 {
90
91 public:
92 typedef typename xml_attribute<Ch> value_type;
93 typedef typename xml_attribute<Ch>& reference;
94 typedef typename xml_attribute<Ch>* pointer;
95 typedef std::ptrdiff_t difference_type;
96 typedef std::bidirectional_iterator_tag iterator_category;
97
101
102 attribute_iterator(xml_node<Ch>* node) : m_attribute(node->first_attribute())
103 {
104 }
105
107 {
108 assert(m_attribute);
109 return *m_attribute;
110 }
111
113 {
114 assert(m_attribute);
115 return m_attribute;
116 }
117
119 {
120 assert(m_attribute);
122 return *this;
123 }
124
126 {
127 attribute_iterator tmp = *this;
128 ++this;
129 return tmp;
130 }
131
138
140 {
141 attribute_iterator tmp = *this;
142 ++this;
143 return tmp;
144 }
145
147 {
148 return m_attribute == rhs.m_attribute;
149 }
150
152 {
153 return m_attribute != rhs.m_attribute;
154 }
155
156 private:
158 };
159
160} // namespace rapidxml
161
162#endif
Iterator of child attributes of xml_node.
Definition rapidxml_iterators.hpp:89
xml_attribute< Ch > & reference
Definition rapidxml_iterators.hpp:93
attribute_iterator(xml_node< Ch > *node)
Definition rapidxml_iterators.hpp:102
attribute_iterator & operator++()
Definition rapidxml_iterators.hpp:118
xml_attribute< Ch > * m_attribute
Definition rapidxml_iterators.hpp:157
attribute_iterator()
Definition rapidxml_iterators.hpp:98
bool operator!=(const attribute_iterator< Ch > &rhs)
Definition rapidxml_iterators.hpp:151
pointer operator->() const
Definition rapidxml_iterators.hpp:112
xml_attribute< Ch > * pointer
Definition rapidxml_iterators.hpp:94
attribute_iterator & operator--()
Definition rapidxml_iterators.hpp:132
attribute_iterator operator++(int)
Definition rapidxml_iterators.hpp:125
std::bidirectional_iterator_tag iterator_category
Definition rapidxml_iterators.hpp:96
reference operator*() const
Definition rapidxml_iterators.hpp:106
bool operator==(const attribute_iterator< Ch > &rhs)
Definition rapidxml_iterators.hpp:146
std::ptrdiff_t difference_type
Definition rapidxml_iterators.hpp:95
xml_attribute< Ch > value_type
Definition rapidxml_iterators.hpp:92
attribute_iterator operator--(int)
Definition rapidxml_iterators.hpp:139
Iterator of child nodes of xml_node.
Definition rapidxml_iterators.hpp:16
node_iterator & operator--()
Definition rapidxml_iterators.hpp:59
pointer operator->() const
Definition rapidxml_iterators.hpp:39
bool operator!=(const node_iterator< Ch > &rhs)
Definition rapidxml_iterators.hpp:78
reference operator*() const
Definition rapidxml_iterators.hpp:33
node_iterator operator--(int)
Definition rapidxml_iterators.hpp:66
node_iterator()
Definition rapidxml_iterators.hpp:25
node_iterator & operator++()
Definition rapidxml_iterators.hpp:45
std::ptrdiff_t difference_type
Definition rapidxml_iterators.hpp:22
bool operator==(const node_iterator< Ch > &rhs)
Definition rapidxml_iterators.hpp:73
xml_node< Ch > * pointer
Definition rapidxml_iterators.hpp:21
std::bidirectional_iterator_tag iterator_category
Definition rapidxml_iterators.hpp:23
node_iterator(xml_node< Ch > *node)
Definition rapidxml_iterators.hpp:29
node_iterator operator++(int)
Definition rapidxml_iterators.hpp:52
xml_node< Ch > & reference
Definition rapidxml_iterators.hpp:20
xml_node< Ch > value_type
Definition rapidxml_iterators.hpp:19
xml_node< Ch > * m_node
Definition rapidxml_iterators.hpp:84
Definition rapidxml.hpp:784
xml_attribute< Ch > * next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition rapidxml.hpp:845
xml_attribute< Ch > * previous_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition rapidxml.hpp:821
Definition rapidxml.hpp:882
xml_node< Ch > * next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition rapidxml.hpp:995
xml_node< Ch > * previous_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Definition rapidxml.hpp:971
Definition rapidxml.hpp:62
This file contains rapidxml parser and DOM implementation.