]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/sharedptr.h
Expose the Apple menu so it can be setup manually.
[wxWidgets.git] / interface / wx / sharedptr.h
index 2b18e2a4713c95793280a25249e5a7927eb731d9..8b7087baed8e85c0245919d63f66642cc05d2127 100644 (file)
@@ -2,14 +2,13 @@
 // Name:        sharedptr.h
 // Purpose:     interface of wxSharedPtr<T>
 // Author:      wxWidgets team
-// RCS-ID:      $Id$
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 /**
     A smart pointer with non-intrusive reference counting.
 
-    It is modeled after @c boost::shared_ptr<> and can be used with STL
+    It is modelled after @c boost::shared_ptr<> and can be used with STL
     containers and wxVector<T> unlike @c std::auto_ptr<> and wxScopedPtr<T>.
 
     @library{wxbase}
@@ -29,6 +28,22 @@ public:
     */
     wxEXPLICIT wxSharedPtr(T* ptr = NULL);
 
+    /**
+        Constructor.
+
+        Creates shared pointer from the raw pointer @a ptr and deleter @a d
+        and takes ownership of it.
+
+        @param ptr  The raw pointer.
+        @param d    Deleter - a functor that is called instead of delete to
+                    free the @a ptr raw pointer when its reference count drops to
+                    zero.
+
+        @since 3.0
+    */
+    template<typename Deleter>
+    wxEXPLICIT wxSharedPtr(T* ptr, Deleter d);
+
     /**
         Copy constructor.
     */
@@ -61,7 +76,9 @@ public:
     T operator*() const;
 
     /**
-        Returns pointer to its object or @NULL.
+        Smart pointer member access. Returns pointer to its object.
+
+        If the internal pointer is @NULL this method will cause an assert in debug mode.
     */
     T* operator->() const;
 
@@ -87,6 +104,21 @@ public:
     */
     void reset(T* ptr = NULL);
 
+    /**
+        Reset pointer to @a ptr.
+
+        If the reference count of the previously owned pointer was 1 it will be deleted.
+
+        @param ptr  The new raw pointer.
+        @param d    Deleter - a functor that is called instead of delete to
+                    free the @a ptr raw pointer when its reference count drops to
+                    zero.
+
+        @since 3.0
+    */
+    template<typename Deleter>
+    void reset(T* ptr, Deleter d);
+
     /**
         Returns @true if this is the only pointer pointing to its object.
     */