Definition at line 321 of file qsharedpointer_impl.h.
#include <qsharedpointer_impl.h>

Protected Types |
|
| typedef ExternalRefCountData | Data |
Protected Member Functions |
|
| void | ref () const |
| void | deref () |
| void | internalConstruct (T *ptr) |
| template<typename Deleter > | |
| void | internalConstruct (T *ptr, Deleter deleter) |
| void | internalCreate () |
| void | internalFinishConstruction (T *ptr) |
| ExternalRefCount () | |
| ExternalRefCount (Qt::Initialization i) | |
| ExternalRefCount (const ExternalRefCount< T > &other) | |
| template<class X > | |
| ExternalRefCount (const ExternalRefCount< X > &other) | |
| ~ExternalRefCount () | |
| template<class X > | |
| void | internalCopy (const ExternalRefCount< X > &other) |
| void | internalSwap (ExternalRefCount &other) |
| void | internalSet (Data *o, T *actual) |
Static Protected Member Functions |
|
| static void | deref (Data *d, T *value) |
Protected Attributes |
|
| Data * | d |
Friends |
|
| class | ExternalRefCount |
| template<class X > | |
| class | QT_PREPEND_NAMESPACE (QWeakPointer) |
| template<class X , class Y > | |
| QSharedPointer< X > | copyAndSetPointer (X *ptr, const QSharedPointer< Y > &src) |
typedef ExternalRefCountData
Data
[protected] |
Definition at line 324 of file qsharedpointer_impl.h.
| ExternalRefCount | ( | ) | [inline, protected] |
Definition at line 379 of file qsharedpointer_impl.h.
: d(0) { }
| ExternalRefCount | ( | Qt::Initialization | i | ) | [inline, protected] |
Definition at line 380 of file qsharedpointer_impl.h.
: Basic<T>(i) { }
| ExternalRefCount | ( | const ExternalRefCount< T > & | other | ) | [inline, protected] |
Definition at line 381 of file qsharedpointer_impl.h.
| ExternalRefCount | ( | const ExternalRefCount< X > & | other | ) | [inline, protected] |
Definition at line 384 of file qsharedpointer_impl.h.
| ~ExternalRefCount | ( | ) | [inline, protected] |
Definition at line 386 of file qsharedpointer_impl.h.
{ deref(); }
| void ref | ( | ) | const [inline, protected] |
Definition at line 326 of file qsharedpointer_impl.h.
| void deref | ( | ) | [inline, protected] |
Definition at line 327 of file qsharedpointer_impl.h.
| static void deref | ( | Data * | d, |
| T * | value | ||
| ) | [inline, static, protected] |
| void internalConstruct | ( | T * | ptr | ) | [inline, protected] |
Reimplemented from Basic< T >.
Definition at line 340 of file qsharedpointer_impl.h.
{
#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
internalConstruct<void (*)(T *)>(ptr, normalDeleter);
#else
if (ptr)
d = new Data;
else
d = 0;
internalFinishConstruction(ptr);
#endif
}
| void internalConstruct | ( | T * | ptr, |
| Deleter | deleter | ||
| ) | [inline, protected] |
Definition at line 354 of file qsharedpointer_impl.h.
{
if (ptr)
d = ExternalRefCountWithCustomDeleter<T, Deleter>::create(ptr, deleter);
else
d = 0;
internalFinishConstruction(ptr);
}
| void internalCreate | ( | ) | [inline, protected] |
Definition at line 363 of file qsharedpointer_impl.h.
{
T *ptr;
d = ExternalRefCountWithContiguousData<T>::create(&ptr);
Basic<T>::internalConstruct(ptr);
}
| void internalFinishConstruction | ( | T * | ptr | ) | [inline, protected] |
Definition at line 370 of file qsharedpointer_impl.h.
{
Basic<T>::internalConstruct(ptr);
if (ptr) d->setQObjectShared(ptr, true);
#ifdef QT_SHAREDPOINTER_TRACK_POINTERS
if (ptr) internalSafetyCheckAdd2(d, ptr);
#endif
}
| void internalCopy | ( | const ExternalRefCount< X > & | other | ) | [inline, protected] |
Definition at line 389 of file qsharedpointer_impl.h.
{
internalSet(other.d, other.data());
}
| void internalSwap | ( | ExternalRefCount< T > & | other | ) | [inline, protected] |
Definition at line 394 of file qsharedpointer_impl.h.
| void internalSet | ( | Data * | o, |
| T * | actual | ||
| ) | [inline, protected] |
Definition at line 408 of file qsharedpointer_impl.h.
{
if (o) {
// increase the strongref, but never up from zero
// or less (-1 is used by QWeakPointer on untracked QObject)
register int tmp = o->strongref;
while (tmp > 0) {
// try to increment from "tmp" to "tmp + 1"
if (o->strongref.testAndSetRelaxed(tmp, tmp + 1))
break; // succeeded
tmp = o->strongref; // failed, try again
}
if (tmp > 0)
o->weakref.ref();
else
o = 0;
}
qSwap(d, o);
qSwap(this->value, actual);
if (!d || d->strongref == 0)
this->value = 0;
// dereference saved data
deref(o, actual);
}
friend class ExternalRefCount
[friend] |
Definition at line 403 of file qsharedpointer_impl.h.
| class QT_PREPEND_NAMESPACE | ( | QWeakPointer | ) | [friend] |
Reimplemented from Basic< T >.
| QSharedPointer<X> copyAndSetPointer | ( | X * | ptr, |
| const QSharedPointer< Y > & | src | ||
| ) | [friend] |
Definition at line 436 of file qsharedpointer_impl.h.