Public Member Functions

KScopedPtr< T, DeletionPolicyT > Class Template Reference

Search for all occurrences

Detailed Description

template<class T, class DeletionPolicyT = DefaultDeletionPolicy<T>>
class KScopedPtr< T, DeletionPolicyT >

Examples:

ViewScene/main.cxx.

Definition at line 88 of file kscopedptr.h.

#include <kscopedptr.h>

List of all members.

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 ()

Constructor & Destructor Documentation

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);
    }

Member Function Documentation

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]

Definition at line 132 of file kscopedptr.h.

    {
        return ptr;
    }
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;
    }

The documentation for this class was generated from the following file: