git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2008-01-08 12:26:48 +00:00
parent 69d0fe8315
commit 72636c1509
3 changed files with 36 additions and 9 deletions

View File

@ -19,8 +19,12 @@ typedef T element_type
\end{verbatim} \end{verbatim}
}% }%
\latexignore{\rtfignore{\wxheading{Members}}} \wxheading{See also}
\helpref{wxSharedPtr}{wxsharedptr}, \helpref{wxWeakRef}{wxweakref}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxScopedPtr<T>::wxScopedPtr<T>}\label{wxscopedptrtemplatewxscopedptrtemplate} \membersection{wxScopedPtr<T>::wxScopedPtr<T>}\label{wxscopedptrtemplatewxscopedptrtemplate}
@ -58,7 +62,7 @@ cause an assert in debug mode.
\func{T*}{release}{\void} \func{T*}{release}{\void}
Releases the current pointer and returns NULL. Releases the current pointer and returns it.
\membersection{wxScopedPtr<T>::reset}\label{wxscopedptrtemplatereset} \membersection{wxScopedPtr<T>::reset}\label{wxscopedptrtemplatereset}

View File

@ -1,6 +1,9 @@
\section{\class{wxSharedPtr<T>}}\label{wxsharedptr} \section{\class{wxSharedPtr<T>}}\label{wxsharedptr}
A smart pointer with non-intrusive reference counting. A smart pointer with non-intrusive reference counting. It is modeled
after {\bf boost::shared\_ptr<>} and can be used with STL containers
and \helpref{wxVector<>}{wxvector} - unlike {\bf std::auto\_ptr<>}
and \helpref{wxScopedPtr<>}{wxscopedptrtemplate}.
\wxheading{Derived from} \wxheading{Derived from}
@ -18,6 +21,11 @@ typedef T element_type
\end{verbatim} \end{verbatim}
}% }%
\wxheading{See also}
\helpref{wxScopedPtr}{wxscopedptrtemplate}, \helpref{wxWeakRef}{wxweakref}
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}
@ -58,7 +66,15 @@ 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. Assignment operator. Releases any previously held pointer
and creates a reference to same object as {\it topcopy}.
\membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign2}
\func{wxSharedPtr<T>\& operator}{operator=}{\param{T *}{ptr}}
Assignment operator. Releases any previously held pointer
and creates a reference to {\it ptr}.
\membersection{wxSharedPtr<T>::unique}\label{wxsharedptrunique} \membersection{wxSharedPtr<T>::unique}\label{wxsharedptrunique}

View File

@ -3,8 +3,7 @@
{\bf wxWeakRef} is a template class for weak references to wxWidgets objects, {\bf wxWeakRef} is a template class for weak references to wxWidgets objects,
such as {\bf wxEvtHandler}, {\bf wxWindow} and {\bf wxObject}. A weak such as {\bf wxEvtHandler}, {\bf wxWindow} and {\bf wxObject}. A weak
reference behaves much like an ordinary pointer, but when the object pointed reference behaves much like an ordinary pointer, but when the object pointed
to goes out of scope (is destroyed), the weak reference is automatically is destroyed, the weak reference is automatically reset to a NULL pointer.
reset to a NULL pointer.
wxWeakref<T> can be used whenever one must keep a pointer to an object wxWeakref<T> can be used whenever one must keep a pointer to an object
that does not directly own, and that may be destroyed before the object that does not directly own, and that may be destroyed before the object
@ -31,9 +30,10 @@ wxWeakref<T> is a small object and the mechanism behind it is fast
wxASSERT( wr==NULL ); wxASSERT( wr==NULL );
\end{verbatim} \end{verbatim}
wxWeakref<T> works for any objects that are derived from {\bf wxTrackableBase} wxWeakref<T> works for any objects that are derived from
or {\bf wxTrackable}. By default, wxEvtHandler and wxWindow derive from \helpref{wxTrackableBase}{wxtrackablebase} or \helpref{wxTrackable}{wxtrackable}.
wxTrackableBase. However, wxObject does not, so types like {\bf wxFont} and By default, wxEvtHandler and wxWindow derive from wxTrackableBase. However,
wxObject does not, so types like {\bf wxFont} and
{\bf wxColour} are not trackable. The example below shows how to create a {\bf wxColour} are not trackable. The example below shows how to create a
wxObject derived class that is trackable: wxObject derived class that is trackable:
@ -71,6 +71,13 @@ wxTrackerNode
\wxheading{Data structures} \wxheading{Data structures}
{\small%
\begin{verbatim}
typedef T element_type
\end{verbatim}
}%
\latexignore{\rtfignore{\wxheading{Members}}} \latexignore{\rtfignore{\wxheading{Members}}}