Corrected docs of ::release and ::reset in smart pointers

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-01-09 09:27:26 +00:00
parent 94eff479bf
commit aaf4caeedc
3 changed files with 18 additions and 11 deletions

View File

@@ -5,7 +5,8 @@ leaks because of missing calls to \helpref{wxObjectRefData::DecRef}{wxobjectrefd
Despite the name this template can actually be used as a Despite the name this template can actually be used as a
smart pointer for any class implementing the reference smart pointer for any class implementing the reference
counting interface and it does not use or depend on wxObject. counting interface which only consists of the two methods
{\bf T::IncRef()} and {\bf T::DecRef()}.
The difference to \helpref{wxSharedPtr}{wxsharedptr} is that The difference to \helpref{wxSharedPtr}{wxsharedptr} is that
wxObjectDataPtr relies on the reference counting to be in wxObjectDataPtr relies on the reference counting to be in
@@ -114,7 +115,9 @@ protected:
\func{wxEXPLICIT}{wxObjectDataPtr<T>}{\param{T* }{ptr = NULL}} \func{wxEXPLICIT}{wxObjectDataPtr<T>}{\param{T* }{ptr = NULL}}
Constructor. {\it ptr} is a pointer to the reference Constructor. {\it ptr} is a pointer to the reference
counted object to which this class points. counted object to which this class points. If {\it ptr}
is not NULL {\bf T::IncRef()} will be called on the
object.
\func{}{wxObjectDataPtr<T>}{\param{const wxObjectDataPtr<T>\& }{tocopy}} \func{}{wxObjectDataPtr<T>}{\param{const wxObjectDataPtr<T>\& }{tocopy}}
@@ -126,8 +129,8 @@ class will point to, as well.
\func{}{\destruct{wxObjectDataPtr<T>}}{\void} \func{}{\destruct{wxObjectDataPtr<T>}}{\void}
Calls \helpref{DecRef}{wxobjectrefdatadecref} on the reference Decreases the reference count of the object to which this
counted object to which this class points. class points.
\membersection{wxObjectDataPtr<T>::operator unspecified\_bool\_type}\label{wxobjectdataptroperatorbool} \membersection{wxObjectDataPtr<T>::operator unspecified\_bool\_type}\label{wxobjectdataptroperatorbool}
@@ -173,4 +176,5 @@ this class points.
\func{void}{reset}{\param{T* }{ptr}} \func{void}{reset}{\param{T* }{ptr}}
Reset this class to {\it ptr} which points to a reference Reset this class to {\it ptr} which points to a reference
counted object. counted object and calls {\bf T::DecRef()} on the previously
owned object.

View File

@@ -72,13 +72,15 @@ cause an assert in debug mode.
\func{T*}{release}{\void} \func{T*}{release}{\void}
Releases the current pointer and returns it. Releases the current pointer and returns it.
Afterwards the caller is responsible for deleting
the data contained in the scoped pointer before.
\membersection{wxScopedPtr<T>::reset}\label{wxscopedptrtemplatereset} \membersection{wxScopedPtr<T>::reset}\label{wxscopedptrtemplatereset}
\func{void}{reset}{\param{T * }{ptr = NULL}} \func{void}{reset}{\param{T * }{ptr = NULL}}
Reset pointer. Afterwards the caller is responsible for deleting Reset pointer to the value of {\it ptr}. The
the data contained in the scoped pointer before. previous pointer will be deleted.
\membersection{wxScopedPtr<T>::swap}\label{wxscopedptrtemplateswap} \membersection{wxScopedPtr<T>::swap}\label{wxscopedptrtemplateswap}

View File

@@ -23,7 +23,8 @@ typedef T element_type
\wxheading{See also} \wxheading{See also}
\helpref{wxScopedPtr}{wxscopedptrtemplate}, \helpref{wxWeakRef}{wxweakref} \helpref{wxScopedPtr}{wxscopedptrtemplate}, \helpref{wxWeakRef}{wxweakref},
\helpref{wxObjectDataPtr}{wxobjectdataptr}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}
@@ -76,7 +77,7 @@ Returns pointer to its object or NULL.
\func{wxSharedPtr<T>\& operator}{operator=}{\param{const wxSharedPtr<T>\& }{tocopy}} \func{wxSharedPtr<T>\& operator}{operator=}{\param{const wxSharedPtr<T>\& }{tocopy}}
Assignment operator. Releases any previously held pointer Assignment operator. Releases any previously held pointer
and creates a reference to same object as {\it topcopy}. and creates a reference to the same object as {\it topcopy}.
\membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign2} \membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign2}
@@ -101,6 +102,6 @@ Returns the number of pointers pointing to its object.
\func{void}{reset}{\param{T * }{ptr = NULL}} \func{void}{reset}{\param{T * }{ptr = NULL}}
Reset pointer to {\it ptr}. Afterwards the caller is responsible Reset pointer to {\it ptr}. If the reference count of the
for deleting the data contained in the pointer before. previously owned pointer was 1 it will be deleted.