summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2008-05-15 17:01:23 +0000
committermental <mental@users.sourceforge.net>2008-05-15 17:01:23 +0000
commit7dabe5d2a897b00edb34d48a91f51174b809f072 (patch)
treef6398e0d0e80372082cde88112f7758e37be163d
parentintroduce lifecycle stuff which will replace libgc (diff)
downloadinkscape-7dabe5d2a897b00edb34d48a91f51174b809f072.tar.gz
inkscape-7dabe5d2a897b00edb34d48a91f51174b809f072.zip
add DumbPtr
(bzr r5674)
-rw-r--r--src/lifecycle.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lifecycle.h b/src/lifecycle.h
index 7e37bd852..e86697c74 100644
--- a/src/lifecycle.h
+++ b/src/lifecycle.h
@@ -89,6 +89,30 @@ private:
}
};
+// Wrapper for a simple pointer emulating the ManagedPtr interface
+template <typename T>
+class DumbPtr {
+public:
+ DumbPtr() : ptr(NULL) {}
+ DumbPtr(T *p) : ptr(p) {}
+ DumbPtr(DumbPtr const &other) : ptr(other.ptr) {}
+
+ operator T *() const { return ptr; }
+ T &operator*() const { return *ptr; }
+ T *operator->() const { return ptr; }
+ DumbPtr &operator=(T *p) {
+ ptr = p;
+ return *this;
+ }
+ DumbPtr &operator=(DumbPtr const &other) {
+ ptr = other.ptr;
+ return *this;
+ }
+
+private:
+ T *ptr;
+};
+
// Dummy implementation of AbstractManaged to ease migration
class DummyManaged : public virtual AbstractManaged {
protected: