2 cursor.icc -- implement Cursor
4 source file of the Flower Library
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
21 : list_(*(List<T> *)0) // ugh
29 Cursor<T>::Cursor (const List<T>& list, Link<T>* pointer) :
30 list_((List<T>&) list)
33 pointer_ = pointer ? pointer : list.top_;
40 Cursor<T>::Cursor (const Cursor<T>& cursor) :
43 pointer_ = cursor.pointer_;
51 return pointer_->thing();
56 Cursor<T>::operator =( const Cursor<T>& c)
58 assert (&list_ == &c.list_);
59 pointer_ = c.pointer_;
65 Cursor<T>::add (const T& th)
67 list_.add (th, *this);
72 Cursor<T>::insert (const T& th)
74 list_.insert (th, *this);
79 Cursor<T>::list() const
93 Cursor<T>::backward()const
95 return ( pointer_ != 0);
100 Cursor<T>::forward()const
102 return ( pointer_ != 0);
109 return ( pointer_ != 0);
116 pointer_ = pointer_->next();
121 Cursor<T>::operator ++( int)
130 Cursor<T>::previous()
133 pointer_ = pointer_->previous();
138 Cursor<T>::operator --( int)