ScopedPtr< T > Class Template Reference

A non-copyable scoped pointer. More...

#include <ScopedPtr.h++>

List of all members.

Public Member Functions

 ScopedPtr ()
 Construct a new, NULL ScopedPtr.
 ScopedPtr (T *object)
 Construct a new ScopedPtr for the given object pointer.
 ~ScopedPtr ()
 Destructor.
T & operator* () const throw (NullPointerException)
 Dereference operator.
T * operator-> () const throw (NullPointerException)
 Pointer-to-member operator.
void reset (T *object=NULL)
 Reset the pointer.
T * get () const
 Get the value of the pointer.
T * release () throw ()
 Release ownership of the object.
bool operator! () const
 Test if the pointer is NULL.
 operator const void * () const
 Boolean test operator.
bool isNull () const throw ()
 Test if the pointer is NULL.
void swap (ScopedPtr &other) throw ()
 Swap this pointer with another.

Detailed Description

template<class T>
class ccxx::ScopedPtr< T >

A non-copyable scoped pointer.

Maintains a pointer to another object, which is deleted automatically when the ScopedPtr itself is destroyed.

Author:
Mark Lindner

Constructor & Destructor Documentation

ScopedPtr (  )  [inline]

Construct a new, NULL ScopedPtr.

ScopedPtr ( T *  object  )  [inline, explicit]

Construct a new ScopedPtr for the given object pointer.

~ScopedPtr (  )  [inline]

Destructor.


Member Function Documentation

T* get (  )  const [inline]

Get the value of the pointer.

bool isNull (  )  const throw () [inline]

Test if the pointer is NULL.

operator const void * (  )  const [inline]

Boolean test operator.

(Test if the pointer is non-NULL.)

bool operator! (  )  const [inline]

Test if the pointer is NULL.

T& operator* (  )  const throw (NullPointerException) [inline]

Dereference operator.

Exceptions:
NullPointerException If this pointer is NULL.
T* operator-> (  )  const throw (NullPointerException) [inline]

Pointer-to-member operator.

Exceptions:
NullPointerException If this pointer is NULL.
T* release (  )  throw () [inline]

Release ownership of the object.

void reset ( T *  object = NULL  )  [inline]

Reset the pointer.

The old object, if any, is deleted.

void swap ( ScopedPtr< T > &  other  )  throw () [inline]

Swap this pointer with another.


The documentation for this class was generated from the following file:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3