2 pcursor.hh -- part of flowerlib
4 (c) 1996 Han-Wen Nienhuys&Jan Nieuwenhuizen
13 /** cursor to go with Link_list.
14 don't create Link_list<void*>'s.
15 This cursor is just an interface class for Cursor. It takes care of the
16 appropriate type casts
19 class PCursor : private Cursor<void *> {
20 friend class Pointer_list<T>;
27 Cursor<void*>::backspace;
29 Cursor<void*>::previous;
42 Link_list<T> &list() { return (Link_list<T>&)Cursor<void*>::list (); }
43 PCursor<T> operator++(int) { return Cursor<void*>::operator++(0);}
44 PCursor<T> operator--(int) { return Cursor<void*>::operator--(0); }
45 PCursor<T> operator+=(int i) { return Cursor<void*>::operator+=(i);}
46 PCursor<T> operator-=(int i) { return Cursor<void*>::operator-=(i); }
47 PCursor<T> operator -(int no) const { return Cursor<void*>::operator-(no);}
48 int operator -(PCursor<T> op) const { return Cursor<void*>::operator-(op);}
49 PCursor<T> operator +(int no) const {return Cursor<void*>::operator+(no);} PCursor (const Link_list<T> & l) : Cursor<void*> (l) {}
50 PCursor() : Cursor<void*> () {}
51 PCursor (const Cursor<void*>& cursor) : Cursor<void*>(cursor) { }
52 void* vptr() const { return *((Cursor<void*> &) *this); }
55 T ptr() const { return (T) vptr (); }
56 T operator ->() const { return ptr(); }
57 operator T() { return ptr(); }
58 T operator *() { return ptr(); }
59 void add (T const & p) { Cursor<void*>::add ((void*) p); }
60 void insert (T const & p) { Cursor<void*>::insert ((void*) p);}
61 static int compare (PCursor<T> a,PCursor<T>b) {
62 return Cursor<void*>::compare (a,b);
69 TEMPLATE_INSTANTIATE_COMPARE(PCursor<T>, PCursor<T>::compare, template<class T>);