7 |
|
#ifndef _NullNode_hpp_ |
8 |
|
#define _NullNode_hpp_ |
9 |
|
|
10 |
+ |
#include "Visitor.hpp" |
11 |
+ |
|
12 |
|
template<typename Type> |
13 |
|
class NullNode |
14 |
|
{ |
32 |
|
NullNode<Type>* getPrevious(void) const { return next; } |
33 |
|
bool contains(const Type& value, NullNode<Type>* end, bool forward = true); |
34 |
|
void remove(const Type& value, NullNode<Type>* end, bool forward = true); |
35 |
+ |
void accept(Visitor<Type>* visitor, NullNode<Type>* end, bool forward = true); |
36 |
|
}; |
37 |
|
|
38 |
|
template<typename Type> |
110 |
|
else if (end != this) another->remove(value, end, forward); |
111 |
|
} |
112 |
|
|
113 |
+ |
template<typename Type> |
114 |
+ |
void NullNode<Type>::accept(Visitor<Type>* visitor, NullNode<Type>* end, bool forward) |
115 |
+ |
{ |
116 |
+ |
NullNode<Type>* another = forward ? next : previous; |
117 |
+ |
|
118 |
+ |
if (!null) visitor->visit(value); |
119 |
+ |
|
120 |
+ |
if (end != this) another->accept(visitor, end, forward); |
121 |
+ |
} |
122 |
+ |
|
123 |
|
#endif // _NullNode_hpp_ |