]> git.donarmstrong.com Git - lilypond.git/commitdiff
flower-1.0.19
authorfred <fred>
Wed, 8 Jan 1997 20:48:44 +0000 (20:48 +0000)
committerfred <fred>
Wed, 8 Jan 1997 20:48:44 +0000 (20:48 +0000)
flower/cursor.hh
flower/list.hh
flower/pcursor.hh
flower/plist.hh

index c6a8584335b113ed858fe9222d73daf6f7b959ab..14847706882b267e51abd65f758aacdc8ce99b7b 100644 (file)
@@ -18,6 +18,7 @@ class Cursor
     Cursor( const Cursor<T>& cursor );
 
     T& thing();
+
     /// return current T
     T& operator *() { return thing(); }
     operator T() { return thing(); }
index f49b5d78500d1185a992d54135fe3afbab4633a1..4a4aab2f5b28ecf9e5b398457e9e2658816e5008 100644 (file)
@@ -29,11 +29,15 @@ class List
 
     void concatenate(List<T> 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<T> &before_me );
-    virtual void remove( Cursor<T> me );
-    /**
-      Remove link pointed to by me.
+    
+    void remove( Cursor<T> 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<T>* top_;
     Link<T>* bottom_;
index eeaa866ea8b4b95f199544c2ab46f2b9045f79f1..383a450a1ae4a2f4ce0eac353a9d9722b856c903 100644 (file)
 template<class T>
 struct PCursor : private Cursor<void *> {
     friend class IPointerList<T>;
+
+    /// delete contents
+    void junk();
 public:
     Cursor<void*>::ok;
-    Cursor<void*>::del;
-    Cursor<void*>::backspace;
+    void del() { junk(); Cursor<void*>::del(); }
+    void backspace() { junk(); Cursor<void*>::backspace(); }
+    T get() {
+       T p = ptr();
+       Cursor<void*>::del();
+       return p;
+    }
+    T get_prev() {
+       (*this)--;
+       return get();
+    }
     
     PointerList<T> &list() { return (PointerList<T>&)Cursor<void*>::list(); }
     PCursor<T> operator++(int) { return Cursor<void*>::operator++(0);}
index bac9f7bf0227874df00147b76850ab97db1f5d43..0aedfba60b6134aedc714a09cf07a3366949db4c 100644 (file)
@@ -34,9 +34,7 @@ template<class T>
 struct IPointerList : public PointerList<T> {
     IPointerList(const IPointerList&) { set_empty(); }
     IPointerList() { }
-protected:
-    virtual void remove( Cursor<void*> me ) { remove (PCursor<T>(me)); }
-    virtual void remove( PCursor<T> me );
+    ~IPointerList();
 };
 /**
   NOTE: