MADARA  3.2.3
Iterator.cpp
Go to the documentation of this file.
1 #ifndef _TREE_ITERATOR_CPP
2 #define _TREE_ITERATOR_CPP
3 
4 #ifndef _MADARA_NO_KARL_
5 
6 #include <stdlib.h>
7 #include <algorithm>
8 #include <sstream>
9 
13 
15 
17  const ExpressionTreeIterator &ts)
18  : impl_ (ts.impl_)
19 {
20 
21 }
22 
24 
27  : impl_ (impl)
28 {
29 }
30 
33 
36 {
37  // return impl_->operator* ();
38  return *(*impl_);
39 }
40 
42 
45 {
46  // return impl_->operator* ();
47  return *(*impl_);
48 }
49 
51 
54 {
55  // return impl_->operator++ ();
56  ++(*impl_);
57  return *this;
58 }
59 
61 
64 {
65  ExpressionTreeIterator temp (impl_->clone ());
66  // return impl_->operator++ ();
67  ++(*impl_);
68  return temp;
69 }
70 
72 
73 bool
75  const ExpressionTreeIterator &rhs)
76 {
77  // return impl_->operator () == rhs.impl_->operator ();
78  return *impl_ == *rhs.impl_;
79 }
80 
82 
83 bool
85  const ExpressionTreeIterator &rhs)
86 {
87  return !(*this == rhs);
88 }
89 
91 
94  : impl_ (ts.impl_)
95 {
96 }
97 
99 
102  : impl_ (impl)
103 {
104 }
105 
107 
110 {
111  return *(*impl_);
112 }
113 
115 
118 {
119  ++(*impl_);
120  return *this;
121 }
122 
124 
127 {
128  ExpressionTreeConstIterator temp (impl_.get_ptr ()->clone ());
129  ++(*impl_);
130  return *this;
131 }
132 
134 
135 bool
137  const ExpressionTreeConstIterator &rhs)
138 {
139  return impl_->operator == (*rhs.impl_);
140 }
141 
143 
144 bool
146  const ExpressionTreeConstIterator &rhs)
147 {
148  return !(*this == rhs);
149 }
150 
151 #endif // _MADARA_NO_KARL_
152 
153 #endif /* _TREE_ITERATOR_CPP */
Encapsulates a MADARA KaRL expression into an evaluatable tree.
bool operator!=(const ExpressionTreeIterator &rhs)
In-equality operator.
Definition: Iterator.cpp:84
ExpressionTreeConstIterator(const ExpressionTreeConstIterator &ts)
Copy ctor - needed for reference counting.
Definition: Iterator.cpp:92
Constant iterator over an expression tree.
Definition: Iterator.h:76
Non-const iterator for traversing an expression tree.
Definition: Iterator.h:26
bool operator==(const ExpressionTreeConstIterator &rhs)
Equality operator.
Definition: Iterator.cpp:136
ExpressionTreeIterator & operator++(void)
Preincrement operator.
Definition: Iterator.cpp:53
bool operator==(const ExpressionTreeIterator &rhs)
Equality operator.
Definition: Iterator.cpp:74
ExpressionTree operator*(void)
Dereference operator returns a reference to the item contained at the current position.
Definition: Iterator.cpp:35
ExpressionTreeIterator(const ExpressionTreeIterator &ts)
Copy ctor - needed for reference counting.
Definition: Iterator.cpp:16
const ExpressionTree operator*(void) const
Returns a const reference to the item contained at the current position.
Definition: Iterator.cpp:109
madara::utility::Refcounter< ExpressionTreeIteratorImpl > impl_
Definition: Iterator.h:64
madara::utility::Refcounter< ExpressionTreeIteratorImpl > impl_
Pointer to actual implementation, i.e., the "bridge", which is reference counted to automate memory m...
Definition: Iterator.h:110
ExpressionTreeConstIterator & operator++(void)
Preincrement operator.
Definition: Iterator.cpp:117
Implementation of the ExpressionTreeIterator pattern that is used to define the various iterations al...
Definition: IteratorImpl.h:41
bool operator!=(const ExpressionTreeConstIterator &rhs)
Nonequality operator.
Definition: Iterator.cpp:145