revisions of o-p headers contributed by Utensil Candel and revised by me

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53116 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-04-10 21:16:38 +00:00
parent b3623ed593
commit b1b95a653c
13 changed files with 714 additions and 414 deletions

View File

@@ -10,14 +10,15 @@
@wxheader{ptr_shrd.h}
A smart pointer with non-intrusive reference counting. It is modeled after
@c boost::shared_ptr and can be used with STL containers and wxVector<T> -
unlike @c std::auto_ptr and wxScopedPtr<T>.
@c boost::shared_ptr<> and can be used with STL containers and wxVector<T> -
unlike @c std::auto_ptr<> and wxScopedPtr<T>.
@library{wxbase}
@category{smartpointers}
@see wxScopedPtr<T>, wxWeakRef<T>, wxObjectDataPtr<T>
*/
template<typename T>
class wxSharedPtr<T>
{
@@ -28,9 +29,11 @@ public:
Creates shared pointer from the raw pointer @a ptr and takes ownership
of it.
*/
wxSharedPtr(T* ptr = NULL);
wxEXPLICIT wxSharedPtr(T* ptr = NULL);
/// Copy constructor.
/**
Copy constructor.
*/
wxSharedPtr(const wxSharedPtr<T>& tocopy);
/**
@@ -45,32 +48,44 @@ public:
/**
Conversion to a boolean expression (in a variant which is not
convertable to anything but a boolean expression). If this class
contains a valid pointer it will return @e @true, if it contains
a @NULL pointer it will return @e @false.
convertable to anything but a boolean expression).
If this class contains a valid pointer it will return @true, if it contains
a @NULL pointer it will return @false.
*/
operator unspecified_bool_type() const;
/**
Returns a reference to the object. If the internal pointer is @NULL
this method will cause an assert in debug mode.
Returns a reference to the object.
If the internal pointer is @NULL this method will cause an assert in debug mode.
*/
T operator*() const;
/**
Returns pointer to its object or @NULL.
*/
T* operator-() const;
T* operator->() const;
/**
Assignment operator. Releases any previously held pointer
and creates a reference to @e ptr.
Assignment operator.
Releases any previously held pointer and creates a reference to @a ptr.
*/
wxSharedPtr& operator operator=(T* ptr);
wxSharedPtr<T>& operator=(T* ptr);
/**
Reset pointer to @e ptr. If the reference count of the
previously owned pointer was 1 it will be deleted.
Assignment operator.
Releases any previously held pointer and creates a reference to the
same object as @a topcopy.
*/
wxSharedPtr<T>& operator=(const wxSharedPtr<T>& tocopy)
/**
Reset pointer to @a ptr.
If the reference count of the previously owned pointer was 1 it will be deleted.
*/
void reset(T* ptr = NULL);