Public Types | Public Member Functions | Protected Member Functions

QExplicitlySharedDataPointer< T > Class Template Reference

Search for all occurrences

Detailed Description

template<class T>
class QExplicitlySharedDataPointer< T >

Definition at line 131 of file qshareddata.h.

#include <qshareddata.h>

List of all members.

Public Types

typedef T  Type
typedef T *  pointer

Public Member Functions

T &  operator* () const
T *  operator-> ()
T *  operator-> () const
T *  data () const
const T *  constData () const
void  detach ()
void  reset ()
  operator bool () const
bool  operator== (const QExplicitlySharedDataPointer< T > &other) const
bool  operator!= (const QExplicitlySharedDataPointer< T > &other) const
bool  operator== (const T *ptr) const
bool  operator!= (const T *ptr) const
  QExplicitlySharedDataPointer ()
  ~QExplicitlySharedDataPointer ()
  QExplicitlySharedDataPointer (T *data)
  QExplicitlySharedDataPointer (const QExplicitlySharedDataPointer< T > &o)
template<class X >
  QExplicitlySharedDataPointer (const QExplicitlySharedDataPointer< X > &o)
QExplicitlySharedDataPointer< T > &  operator= (const QExplicitlySharedDataPointer< T > &o)
QExplicitlySharedDataPointer operator= (T *o)
bool  operator! () const
void  swap (QExplicitlySharedDataPointer &other)

Protected Member Functions

T *  clone ()

Member Typedef Documentation

typedef T Type

Definition at line 134 of file qshareddata.h.

typedef T* pointer

Definition at line 135 of file qshareddata.h.


Constructor & Destructor Documentation

Definition at line 160 of file qshareddata.h.

{ d = 0; }

Definition at line 161 of file qshareddata.h.

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

Definition at line 249 of file qshareddata.h.

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

Definition at line 164 of file qshareddata.h.

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

Definition at line 168 of file qshareddata.h.

                                                                                  : d(static_cast<T *>(o.data()))
    {
        if(d)
            d->ref.ref();
    }

Member Function Documentation

T& operator* ( ) const [inline]

Definition at line 137 of file qshareddata.h.

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

Definition at line 138 of file qshareddata.h.

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

Definition at line 139 of file qshareddata.h.

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

Definition at line 140 of file qshareddata.h.

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

Definition at line 141 of file qshareddata.h.

{ return d; }
void detach ( ) [inline]

Definition at line 143 of file qshareddata.h.

{ if (d && d->ref != 1) detach_helper(); }
void reset ( ) [inline]

Definition at line 145 of file qshareddata.h.

    {
        if(d && !d->ref.deref())
            delete d;

        d = 0;
    }
operator bool ( void  ) const [inline]

Definition at line 153 of file qshareddata.h.

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

Definition at line 155 of file qshareddata.h.

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

Definition at line 156 of file qshareddata.h.

{ return d != other.d; }
bool operator== ( const T *  ptr ) const [inline]

Definition at line 157 of file qshareddata.h.

{ return d == ptr; }
bool operator!= ( const T *  ptr ) const [inline]

Definition at line 158 of file qshareddata.h.

{ return d != ptr; }
QExplicitlySharedDataPointer<T>& operator= ( const QExplicitlySharedDataPointer< T > &  o ) [inline]

Definition at line 175 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;
    }
QExplicitlySharedDataPointer& operator= ( T *  o ) [inline]

Definition at line 186 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 198 of file qshareddata.h.

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

Definition at line 200 of file qshareddata.h.

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

Definition at line 233 of file qshareddata.h.

{
    return new T(*d);
}

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