- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Protected Attributes

# QScopedPointer< T, Cleanup > Class Template Reference

Search for all occurrences

## Detailed Description

### template<typename T, typename Cleanup = QScopedPointerDeleter<T>>
class QScopedPointer< T, Cleanup >

Definition at line 87 of file qscopedpointer.h.

`#include <qscopedpointer.h>`

Inheritance diagram for QScopedPointer< T, Cleanup >:
[legend]

List of all members.

## Public Types
typedef T * | pointer
## Public Member Functions
| QScopedPointer (T *p=0)
| ~QScopedPointer ()
T & | operator* () const
T * | operator-> () const
bool | operator! () const
| operator RestrictedBool () const
T * | data () const
bool | isNull () const
void | reset (T *other=0)
T * | take ()
void | swap (QScopedPointer< T, Cleanup > &other)
## Protected Attributes
T * | d

## Member Typedef Documentation

typedef T* pointer

Search for all occurrences

Definition at line 164 of file qscopedpointer.h.

## Constructor & Destructor Documentation

QScopedPointer | ( | T * | p = `0` | ) | `[inline, explicit]`

Definition at line 93 of file qscopedpointer.h.

                                                 : d(p)
        {
        }

~QScopedPointer | ( |  | ) | `[inline]`

Definition at line 97 of file qscopedpointer.h.

        {
            T *oldD = this->d;
            Cleanup::cleanup(oldD);
            this->d = 0;
        }

## Member Function Documentation

T& operator* | ( |  | ) | const `[inline]`

Definition at line 104 of file qscopedpointer.h.

        {
            Q_ASSERT(d);
            return *d;
        }

T* operator-> | ( | void |  | ) | const `[inline]`

Definition at line 110 of file qscopedpointer.h.

        {
            Q_ASSERT(d);
            return d;
        }

bool operator! | ( | void |  | ) | const `[inline]`

Definition at line 116 of file qscopedpointer.h.

        {
            return !d;
        }

operator RestrictedBool | ( |  | ) | const `[inline]`

Definition at line 127 of file qscopedpointer.h.

        {
            return isNull() ? 0 : &QScopedPointer::d;
        }

T* data | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 133 of file qscopedpointer.h.

        {
            return d;
        }

bool isNull | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 138 of file qscopedpointer.h.

        {
            return !d;
        }

void reset | ( | T * | other = `0` | ) | `[inline]`

Search for all occurrences

Definition at line 143 of file qscopedpointer.h.

        {
            if (d == other)
                return;
            T *oldD = d;
            d = other;
            Cleanup::cleanup(oldD);
        }

T* take | ( |  | ) | `[inline]`

Search for all occurrences

Definition at line 152 of file qscopedpointer.h.

        {
            T *oldD = d;
            d = 0;
            return oldD;
        }

void swap | ( | QScopedPointer< T, Cleanup > & | other | ) | `[inline]`

Search for all occurrences

Definition at line 159 of file qscopedpointer.h.

        {
            qSwap(d, other.d);
        }

## Member Data Documentation

T* d `[protected]`

Search for all occurrences

Definition at line 167 of file qscopedpointer.h.

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

- QtCore/qscopedpointer.h