2 cursor.icc -- implement Cursor
4 source file of the Flower Library
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
19 Initialisation of Cursor.. Set pointer and list fields.
23 Cursor<T>::Cursor (const List<T> & list, Link<T>* p )
25 list_l_ = (List<T> *) &list; // damn const
27 pointer_ = p ? p : list.top_;
36 Cursor<T>::Cursor (const Cursor<T>& cursor)
38 list_l_= cursor.list_l_;
39 pointer_ = cursor.pointer_;
47 return pointer_->thing();
52 Cursor<T>::operator =(const Cursor<T>& c)
54 assert (list_l_ == c.list_l_);
55 pointer_ = c.pointer_;
61 Cursor<T>::add (const T& th)
63 list_l_->add (th, *this);
68 Cursor<T>::insert (const T& th)
70 list_l_->insert (th, *this);
75 Cursor<T>::list_l() const
77 return list_l_; // ugh!
89 Cursor<T>::backward() const
91 return (pointer_ != 0);
96 Cursor<T>::forward() const
98 return (pointer_ != 0);
103 Cursor<T>::ok() const
105 return (pointer_ != 0);
112 pointer_ = pointer_->next();
117 Cursor<T>::operator ++(int)
126 Cursor<T>::previous()
129 pointer_ = pointer_->previous();
134 Cursor<T>::operator --(int)