]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/pcursor.hh
release: 0.0.39-1
[lilypond.git] / flower / pcursor.hh
index eeaa866ea8b4b95f199544c2ab46f2b9045f79f1..ea360078d1a0c53fec53e6bad315a75bc2b6617b 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
   pcursor.hh -- part of flowerlib
 
@@ -8,15 +7,33 @@
 #ifndef PCURSOR_HH
 #define PCURSOR_HH
 
+#include "plist.hh"
+#include "cursor.hh"
 
-/// cursor to go with PointerList
+/**  cursor to go with PointerList. 
+  don't create PointerList<void*>'s.
+  This cursor is just an interface class for Cursor. It takes care of the
+  appropriate type casts
+ */
 template<class T>
-struct PCursor : private Cursor<void *> {
+class PCursor : private Cursor<void *> {
     friend class IPointerList<T>;
+
+    /// delete contents
+    void junk();
 public:
     Cursor<void*>::ok;
     Cursor<void*>::del;
     Cursor<void*>::backspace;
+    T get_p() {
+       T p = ptr();
+       Cursor<void*>::del();
+       return p;
+    }
+    T get_prev() {
+       (*this)--;
+       return get_p();
+    }
     
     PointerList<T> &list() { return (PointerList<T>&)Cursor<void*>::list(); }
     PCursor<T> operator++(int) { return Cursor<void*>::operator++(0);}
@@ -28,7 +45,7 @@ public:
     PCursor<T> operator +( int no) const {return Cursor<void*>::operator+(no);}    PCursor(const PointerList<T> & l) : Cursor<void*> (l) {}
 
     PCursor( const Cursor<void*>& cursor ) : Cursor<void*>(cursor) { }
-    void* vptr() const { return  * ((Cursor<void*> &) *this); }
+    void* vptr() const { return *((Cursor<void*> &) *this); }
 
     // should return T& ?
     T ptr() const { return (T) vptr(); }
@@ -41,11 +58,6 @@ public:
        return Cursor<void*>::compare(a,b);
     }
 };
-/**
-  don't create PointerList<void*>'s.
-  This cursor is just an interface class for Cursor. It takes care of the
-  appropriate type casts
- */