ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/ccscs20/NullNode.hpp
(Generate patch)

Comparing NullNode.hpp (file contents):
Revision 9 by Douglas Thrift, 2004-05-14T11:26:01-07:00 vs.
Revision 10 by Douglas Thrift, 2004-05-14T13:57:49-07:00

# Line 7 | Line 7
7   #ifndef _NullNode_hpp_
8   #define _NullNode_hpp_
9  
10 + #include "Visitor.hpp"
11 +
12   template<typename Type>
13   class NullNode
14   {
# Line 30 | Line 32 | public:
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>
# Line 107 | Line 110 | void NullNode<Type>::remove(const 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_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines