functioniterator.h

00001 #ifndef FUNCTIONITERATOR_H
00002 #define FUNCTIONITERATOR_H
00003 
00004 #include <iterator>
00005 #include <stack>
00006 
00007 namespace afl
00008 {
00009     class Function;
00010 
00032     class FunctionIterator 
00033         : public std::iterator<std::bidirectional_iterator_tag, Function*>
00034     {
00035         public:
00037             typedef Function* pointer;
00039             typedef Function& reference;
00040 
00048             FunctionIterator( Function* begin );
00049 
00055             FunctionIterator operator++( int );
00056 
00062             FunctionIterator operator--( int );
00063 
00068             FunctionIterator& operator++(  );
00069 
00074             FunctionIterator& operator--( );
00075 
00083             bool operator== ( const FunctionIterator& toCompare ) const
00084                 { return (_curFn.size() == 0 && toCompare._curFn.size() == 0) ||
00085                     (_curFn.size() && toCompare._curFn.size() && 
00086                      _curFn.top() == toCompare._curFn.top());
00087                 }
00088 
00096             bool operator!= ( const FunctionIterator& toCompare ) const 
00097                 { return ! (*this == toCompare); }
00098 
00102             reference operator*(  );
00103 
00107             pointer operator->(  );
00108 
00109         private:
00115             std::stack<Function*> _curFn;
00116 
00120             std::stack<size_t>    _curArg;
00121 
00125             void goUpRight(  );
00126 
00131             void goLeftDown(  );
00132     };
00133 }
00134 
00135 #endif // FUNCTIONITERATOR_H

Generated on Fri Dec 22 07:17:50 2006 for afl by  doxygen 1.4.6