3 pcursor.hh -- part of flowerlib
5 (c) 1996 Han-Wen Nienhuys&Jan Nieuwenhuizen
12 /// cursor to go with PointerList
14 struct PCursor
: private Cursor
<void *> {
15 friend class IPointerList
<T
>;
22 Cursor
<void*>::backspace
;
33 PointerList
<T
> &list() { return (PointerList
<T
>&)Cursor
<void*>::list(); }
34 PCursor
<T
> operator++(int) { return Cursor
<void*>::operator++(0);}
35 PCursor
<T
> operator--(int) { return Cursor
<void*>::operator--(0); }
36 PCursor
<T
> operator+=(int i
) { return Cursor
<void*>::operator+=(i
);}
37 PCursor
<T
> operator-=(int i
) { return Cursor
<void*>::operator-=(i
); }
38 PCursor
<T
> operator -(int no
) const { return Cursor
<void*>::operator-(no
);}
39 int operator -(PCursor
<T
> op
) const { return Cursor
<void*>::operator-(op
);}
40 PCursor
<T
> operator +( int no
) const {return Cursor
<void*>::operator+(no
);} PCursor(const PointerList
<T
> & l
) : Cursor
<void*> (l
) {}
42 PCursor( const Cursor
<void*>& cursor
) : Cursor
<void*>(cursor
) { }
43 void* vptr() const { return * ((Cursor
<void*> &) *this); }
46 T
ptr() const { return (T
) vptr(); }
47 T
operator ->() const { return ptr(); }
48 operator T() { return ptr(); }
49 T
operator *() { return ptr(); }
50 void add(const T
& p
) { Cursor
<void*>::add((void*) p
); }
51 void insert(const T
& p
) { Cursor
<void*>::insert((void*) p
);}
52 static int compare(PCursor
<T
> a
,PCursor
<T
>b
) {
53 return Cursor
<void*>::compare(a
,b
);
57 don't create PointerList<void*>'s.
58 This cursor is just an interface class for Cursor. It takes care of the
59 appropriate type casts
65 template_instantiate_compare(PCursor
<T
>, PCursor
<T
>::compare
, template<class T
>);