]> git.saurik.com Git - wxWidgets.git/commitdiff
added release()
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 29 Jun 2003 15:44:08 +0000 (15:44 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 29 Jun 2003 15:44:08 +0000 (15:44 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21506 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/scpdptr.tex
include/wx/ptr_scpd.h

index f513808fb15aec7289965f3cdde8d0b405e3d918..31a30569983fa7972dee6fb5dd4231e382f3336a 100644 (file)
@@ -71,11 +71,20 @@ legal name.
 Creates the smart pointer with the given pointer or none if NULL.  On
 compilers that support it, this uses the explicit keyword.
 
 Creates the smart pointer with the given pointer or none if NULL.  On
 compilers that support it, this uses the explicit keyword.
 
+\membersection{wxScopedPtr::release}
+
+\func{T *}{release}{\void}
+
+Returns the currently hold pointer and resets the smart pointer object to 
+{\tt NULL}. After a call to this function the caller is responsible for
+deleting the pointer.
+
+
 \membersection{wxScopedPtr::reset}
 
 \func{\void}{reset}{\param{T}{ p * = NULL}}
 
 \membersection{wxScopedPtr::reset}
 
 \func{\void}{reset}{\param{T}{ p * = NULL}}
 
-Deletes the currently held pointer and sets it to 'p' or to NULL if no 
+Deletes the currently held pointer and sets it to {\it p} or to NULL if no 
 arguments are specified. This function does check to make sure that the
 pointer you are assigning is not the same pointer that is already stored.
 
 arguments are specified. This function does check to make sure that the
 pointer you are assigning is not the same pointer that is already stored.
 
@@ -103,8 +112,8 @@ there is none.
 
 \membersection{wxScopedPtr::swap}
 
 
 \membersection{wxScopedPtr::swap}
 
-\func{\void}{swap}{\param{wxScopedPtr}{ \& ot}}
+\func{\void}{swap}{\param{wxScopedPtr}{ \& other}}
 
 
-Swap the pointer inside the smart pointer with 'ot'. The pointer being swapped
-must be of the same type (hence the same class name).
+Swap the pointer inside the smart pointer with {\it other}. The pointer being
+swapped must be of the same type (hence the same class name).
 
 
index b574491359fbcdfe7e245f6a23640d107b2facf0..79ed8f3f00948ec3c61d4fc1c3c96df287aed471 100644 (file)
@@ -68,7 +68,7 @@ private:                            \
     name & operator=(name const &); \
                                     \
 public:                             \
     name & operator=(name const &); \
                                     \
 public:                             \
-    wxEXPLICIT name(T * ptr = NULL)  \
+    wxEXPLICIT name(T * ptr = NULL) \
     : m_ptr(ptr) { }                \
                                     \
     ~name();                        \
     : m_ptr(ptr) { }                \
                                     \
     ~name();                        \
@@ -82,6 +82,13 @@ public:                             \
         }                           \
     }                               \
                                     \
         }                           \
     }                               \
                                     \
+    T *release()                    \
+    {                               \
+        T *ptr = m_ptr;             \
+        m_ptr = NULL;               \
+        return ptr;                 \
+    }                               \
+                                    \
     T & operator*() const           \
     {                               \
         wxASSERT(m_ptr != NULL);    \
     T & operator*() const           \
     {                               \
         wxASSERT(m_ptr != NULL);    \