From 9bc1175caad1172db2e89aca27debd3c8d2ca084 Mon Sep 17 00:00:00 2001 From: fred Date: Wed, 8 Jan 1997 20:48:44 +0000 Subject: [PATCH] flower-1.0.19 --- flower/cursor.hh | 1 + flower/list.hh | 25 ++++++++++++++++++------- flower/pcursor.hh | 16 ++++++++++++++-- flower/plist.hh | 4 +--- 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/flower/cursor.hh b/flower/cursor.hh index c6a8584335..1484770688 100644 --- a/flower/cursor.hh +++ b/flower/cursor.hh @@ -18,6 +18,7 @@ class Cursor Cursor( const Cursor& cursor ); T& thing(); + /// return current T T& operator *() { return thing(); } operator T() { return thing(); } diff --git a/flower/list.hh b/flower/list.hh index f49b5d7850..4a4aab2f5b 100644 --- a/flower/list.hh +++ b/flower/list.hh @@ -29,11 +29,15 @@ class List void concatenate(List const &s); - /// make *this empty void set_empty(); /** - WARNING: contents lost, and not deleted. + + POST: + size == 0 + + WARNING: + contents lost, and not deleted. */ /// add after after_me @@ -41,13 +45,20 @@ class List /// put thing before #before_me# void insert( const T& thing, Cursor &before_me ); - virtual void remove( Cursor me ); - /** - Remove link pointed to by me. + + void remove( Cursor me ); + /** Remove link pointed to by me. Destructor of contents called + (nop for pointers) POST - none; WARNING: do not use #me#. - */ + none; + + + WARNING: do not use #me# after calling + */ + + /****************/ + int size_; Link* top_; Link* bottom_; diff --git a/flower/pcursor.hh b/flower/pcursor.hh index eeaa866ea8..383a450a1a 100644 --- a/flower/pcursor.hh +++ b/flower/pcursor.hh @@ -13,10 +13,22 @@ template struct PCursor : private Cursor { friend class IPointerList; + + /// delete contents + void junk(); public: Cursor::ok; - Cursor::del; - Cursor::backspace; + void del() { junk(); Cursor::del(); } + void backspace() { junk(); Cursor::backspace(); } + T get() { + T p = ptr(); + Cursor::del(); + return p; + } + T get_prev() { + (*this)--; + return get(); + } PointerList &list() { return (PointerList&)Cursor::list(); } PCursor operator++(int) { return Cursor::operator++(0);} diff --git a/flower/plist.hh b/flower/plist.hh index bac9f7bf02..0aedfba60b 100644 --- a/flower/plist.hh +++ b/flower/plist.hh @@ -34,9 +34,7 @@ template struct IPointerList : public PointerList { IPointerList(const IPointerList&) { set_empty(); } IPointerList() { } -protected: - virtual void remove( Cursor me ) { remove (PCursor(me)); } - virtual void remove( PCursor me ); + ~IPointerList(); }; /** NOTE: -- 2.39.5