Public Types | Public Member Functions | Protected Member Functions

QSharedDataPointer< T > Class Template Reference

Search for all occurrences

Detailed Description

template<class T>
class QSharedDataPointer< T >

Definition at line 69 of file qshareddata.h.

#include <qshareddata.h>

List of all members.

Public Types

typedef T  Type
typedef T *  pointer

Public Member Functions

void  detach ()
T &  operator* ()
const T &  operator* () const
T *  operator-> ()
const T *  operator-> () const
  operator T * ()
  operator const T * () const
T *  data ()
const T *  data () const
const T *  constData () const
bool  operator== (const QSharedDataPointer< T > &other) const
bool  operator!= (const QSharedDataPointer< T > &other) const
  QSharedDataPointer ()
  ~QSharedDataPointer ()
  QSharedDataPointer (T *data)
  QSharedDataPointer (const QSharedDataPointer< T > &o)
QSharedDataPointer< T > &  operator= (const QSharedDataPointer< T > &o)
QSharedDataPointer operator= (T *o)
bool  operator! () const
void  swap (QSharedDataPointer &other)

Protected Member Functions

T *  clone ()

Member Typedef Documentation

typedef T Type

Definition at line 72 of file qshareddata.h.

typedef T* pointer

Definition at line 73 of file qshareddata.h.


Constructor & Destructor Documentation

QSharedDataPointer ( ) [inline]

Definition at line 89 of file qshareddata.h.

{ d = 0; }
~QSharedDataPointer ( ) [inline]

Definition at line 90 of file qshareddata.h.

{ if (d && !d->ref.deref()) delete d; }
Q_INLINE_TEMPLATE QSharedDataPointer ( T *  data ) [explicit]

Definition at line 213 of file qshareddata.h.

                                                                    : d(adata)
{ if (d) d->ref.ref(); }
QSharedDataPointer ( const QSharedDataPointer< T > &  o ) [inline]

Definition at line 93 of file qshareddata.h.

: d(o.d) { if (d) d->ref.ref(); }

Member Function Documentation

void detach ( ) [inline]

Definition at line 75 of file qshareddata.h.

{ if (d && d->ref != 1) detach_helper(); }
T& operator* ( ) [inline]

Definition at line 76 of file qshareddata.h.

{ detach(); return *d; }
const T& operator* ( ) const [inline]

Definition at line 77 of file qshareddata.h.

{ return *d; }
T* operator-> ( void  ) [inline]

Definition at line 78 of file qshareddata.h.

{ detach(); return d; }
const T* operator-> ( void  ) const [inline]

Definition at line 79 of file qshareddata.h.

{ return d; }
operator T * ( ) [inline]

Definition at line 80 of file qshareddata.h.

{ detach(); return d; }
operator const T * ( ) const [inline]

Definition at line 81 of file qshareddata.h.

{ return d; }
T* data ( ) [inline]

Definition at line 82 of file qshareddata.h.

{ detach(); return d; }
const T* data ( ) const [inline]

Definition at line 83 of file qshareddata.h.

{ return d; }
const T* constData ( ) const [inline]

Definition at line 84 of file qshareddata.h.

{ return d; }
bool operator== ( const QSharedDataPointer< T > &  other ) const [inline]

Definition at line 86 of file qshareddata.h.

{ return d == other.d; }
bool operator!= ( const QSharedDataPointer< T > &  other ) const [inline]

Definition at line 87 of file qshareddata.h.

{ return d != other.d; }
QSharedDataPointer<T>& operator= ( const QSharedDataPointer< T > &  o ) [inline]

Definition at line 94 of file qshareddata.h.

                                                                             {
        if (o.d != d) {
            if (o.d)
                o.d->ref.ref();
            T *old = d;
            d = o.d;
            if (old && !old->ref.deref())
                delete old;
        }
        return *this;
    }
QSharedDataPointer& operator= ( T *  o ) [inline]

Definition at line 105 of file qshareddata.h.

                                               {
        if (o != d) {
            if (o)
                o->ref.ref();
            T *old = d;
            d = o;
            if (old && !old->ref.deref())
                delete old;
        }
        return *this;
    }
bool operator! ( void  ) const [inline]

Definition at line 117 of file qshareddata.h.

{ return !d; }
void swap ( QSharedDataPointer< T > &  other ) [inline]

Definition at line 119 of file qshareddata.h.

    { qSwap(d, other.d); }
Q_INLINE_TEMPLATE T * clone ( ) [protected]

Definition at line 217 of file qshareddata.h.

{
    return new T(*d);
}

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