Definition at line 88 of file kscopedptr.h.
#include <kscopedptr.h>
Public Member Functions |
|
KScopedPtr (T *p=0) | |
~KScopedPtr () | |
void | Reset (T *p=0) |
T & | operator* () const |
T * | operator-> () const |
T * | Get () const |
operator T * () const | |
operator bool () const | |
bool | operator! () const |
void | Swap (KScopedPtr &b) |
T * | Release () |
KScopedPtr | ( | T * | p = 0 |
) | [inline, explicit] |
Definition at line 102 of file kscopedptr.h.
: ptr(p){}
~KScopedPtr | ( | ) | [inline] |
Definition at line 105 of file kscopedptr.h.
{ DeletionPolicy::DeleteIt(&ptr); }
void Reset | ( | T * | p = 0 |
) | [inline] |
Definition at line 111 of file kscopedptr.h.
{ K_ASSERT(p == 0 || p != ptr); // catch self-reset errors ThisType(p).Swap(*this); }
T& operator* | ( | ) | const [inline] |
Definition at line 118 of file kscopedptr.h.
{ K_ASSERT(ptr != 0); return *ptr; }
T* operator-> | ( | ) | const [inline] |
Definition at line 125 of file kscopedptr.h.
{ K_ASSERT(ptr != 0); return ptr; }
T* Get | ( | ) | const [inline] |
operator T * | ( | ) | const [inline] |
Definition at line 137 of file kscopedptr.h.
{
return ptr;
}
operator bool | ( | ) | const [inline] |
Definition at line 144 of file kscopedptr.h.
{
return ptr != 0;
}
bool operator! | ( | ) | const [inline] |
Definition at line 150 of file kscopedptr.h.
{
return ptr == 0;
}
void Swap | ( | KScopedPtr< T, DeletionPolicyT > & | b | ) | [inline] |
Definition at line 156 of file kscopedptr.h.
{ T * tmp = b.ptr; b.ptr = ptr; ptr = tmp; }
T* Release | ( | ) | [inline] |
Definition at line 164 of file kscopedptr.h.
{ T* tmp = ptr; ptr = NULL; return tmp; }