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

- File List
- File Members

Classes | Namespaces | Defines | Functions

# qsharedpointer_impl.h File Reference

`#include <new>`
`#include <QtCore/qatomic.h>`
`#include <QtCore/qobject.h>`

Go to the source code of this file.

## Classes
struct | RemovePointer< T * >
struct | RemovePointer< QSharedPointer< T > >
struct | RemovePointer< QWeakPointer< T > >
class | Basic< T >
struct | ExternalRefCountData
struct | ExternalRefCountWithDestroyFn
struct | ExternalRefCountWithCustomDeleter< T, Deleter >
struct | ExternalRefCountWithCustomDeleter< T, Deleter >::CustomDeleter
struct | ExternalRefCountWithContiguousData< T >
class | ExternalRefCount< T >
class | QSharedPointer< T >
class | QWeakPointer< T >
## Namespaces
namespace | QtSharedPointer
## Defines
#define | QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X) qt_sharedpointer_cast_check<T>(static_cast<X *>(0))
## Functions
template<typename T >
QT_BEGIN_HEADER QT_BEGIN_NAMESPACE void | qt_sharedpointer_cast_check (T *)
template<class X , class T >
QSharedPointer< X > | qSharedPointerCast (const QSharedPointer< T > &ptr)
template<class X , class T >
QSharedPointer< X > | qSharedPointerDynamicCast (const QSharedPointer< T > &ptr)
template<class X , class T >
QSharedPointer< X > | qSharedPointerConstCast (const QSharedPointer< T > &ptr)
template<class X , class T >
QSharedPointer< X > | qSharedPointerObjectCast (const QSharedPointer< T > &ptr)
template<class X , class Y >
QSharedPointer< X > | copyAndSetPointer (X *ptr, const QSharedPointer< Y > &src)
Q_CORE_EXPORT void | internalSafetyCheckAdd2 (const void *, const volatile void *)
Q_CORE_EXPORT void | internalSafetyCheckRemove2 (const void *)
template<class T , typename Klass , typename RetVal >
void | executeDeleter (T *t, RetVal(Klass::*memberDeleter)())
template<class T , typename Deleter >
void | executeDeleter (T *t, Deleter d)
template<class T >
void | normalDeleter (T *t)
template<class T , class X >
bool | operator== (const QSharedPointer< T > &ptr1, const QSharedPointer< X > &ptr2)
template<class T , class X >
bool | operator!= (const QSharedPointer< T > &ptr1, const QSharedPointer< X > &ptr2)
template<class T , class X >
bool | operator== (const QSharedPointer< T > &ptr1, const X *ptr2)
template<class T , class X >
bool | operator== (const T *ptr1, const QSharedPointer< X > &ptr2)
template<class T , class X >
bool | operator!= (const QSharedPointer< T > &ptr1, const X *ptr2)
template<class T , class X >
bool | operator!= (const T *ptr1, const QSharedPointer< X > &ptr2)
template<class T , class X >
bool | operator== (const QSharedPointer< T > &ptr1, const QWeakPointer< X > &ptr2)
template<class T , class X >
bool | operator!= (const QSharedPointer< T > &ptr1, const QWeakPointer< X > &ptr2)
template<class T , class X >
Q_INLINE_TEMPLATE QSharedPointer< T > ::difference_type | operator- (const QSharedPointer< T > &ptr1, const QSharedPointer< X > &ptr2)
template<class T , class X >
Q_INLINE_TEMPLATE QSharedPointer< T > ::difference_type | operator- (const QSharedPointer< T > &ptr1, X *ptr2)
template<class T , class X >
Q_INLINE_TEMPLATE QSharedPointer< X > ::difference_type | operator- (T *ptr1, const QSharedPointer< X > &ptr2)
template<class T , class X >
Q_INLINE_TEMPLATE bool | operator< (const QSharedPointer< T > &ptr1, const QSharedPointer< X > &ptr2)
template<class T , class X >
Q_INLINE_TEMPLATE bool | operator< (const QSharedPointer< T > &ptr1, X *ptr2)
template<class T , class X >
Q_INLINE_TEMPLATE bool | operator< (T *ptr1, const QSharedPointer< X > &ptr2)
template<class T >
uint | qHash (const T *key)
template<class T >
Q_INLINE_TEMPLATE uint | qHash (const QSharedPointer< T > &ptr)
template<class T >
void | qSwap (QSharedPointer< T > &p1, QSharedPointer< T > &p2)
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< X > | copyAndSetPointer (X *ptr, const QSharedPointer< T > &src)
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< X > | qSharedPointerCast (const QWeakPointer< T > &src)
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< X > | qSharedPointerDynamicCast (const QWeakPointer< T > &src)
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< X > | qSharedPointerConstCast (const QWeakPointer< T > &src)
template<class X , class T >
Q_INLINE_TEMPLATE QWeakPointer< X > | qWeakPointerCast (const QSharedPointer< T > &src)
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< X > | qSharedPointerObjectCast (const QWeakPointer< T > &src)
template<class X , class T >
QSharedPointer< typename QtSharedPointer::RemovePointer < X >::Type > | qobject_cast (const QSharedPointer< T > &src)
template<class X , class T >
QSharedPointer< typename QtSharedPointer::RemovePointer < X >::Type > | qobject_cast (const QWeakPointer< T > &src)

## Define Documentation

#define QSHAREDPOINTER_VERIFY_AUTO_CAST | ( |  | T,
|  |  | X
| ) |  | qt_sharedpointer_cast_check<T>(static_cast<X *>(0))

Search for all occurrences

Definition at line 71 of file qsharedpointer_impl.h.

## Function Documentation

QT_BEGIN_HEADER QT_BEGIN_NAMESPACE void qt_sharedpointer_cast_check | ( | T * |  | ) | `[inline]`

Search for all occurrences

Definition at line 70 of file qsharedpointer_impl.h.

    { }

Q_INLINE_TEMPLATE QSharedPointer< X > qSharedPointerCast | ( | const QSharedPointer< T > & | ptr | ) |

Search for all occurrences

Definition at line 780 of file qsharedpointer_impl.h.

    {
        register X *ptr = static_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid
        return QtSharedPointer::copyAndSetPointer(ptr, src);
    }

Q_INLINE_TEMPLATE QSharedPointer< X > qSharedPointerDynamicCast | ( | const QSharedPointer< T > & | ptr | ) |

Search for all occurrences

Definition at line 792 of file qsharedpointer_impl.h.

    {
        register X *ptr = dynamic_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid
        return QtSharedPointer::copyAndSetPointer(ptr, src);
    }

Q_INLINE_TEMPLATE QSharedPointer< X > qSharedPointerConstCast | ( | const QSharedPointer< T > & | ptr | ) |

Search for all occurrences

Definition at line 804 of file qsharedpointer_impl.h.

    {
        register X *ptr = const_cast<X *>(src.data()); // if you get an error in this line, the cast is invalid
        return QtSharedPointer::copyAndSetPointer(ptr, src);
    }

Q_INLINE_TEMPLATE QSharedPointer< X > qSharedPointerObjectCast | ( | const QSharedPointer< T > & | ptr | ) |

Search for all occurrences

Definition at line 824 of file qsharedpointer_impl.h.

    {
        register X *ptr = qobject_cast<X *>(src.data());
        return QtSharedPointer::copyAndSetPointer(ptr, src);
    }

bool operator== | ( | const QSharedPointer< T > & | ptr1,
|  | const QSharedPointer< X > & | ptr2
| ) |  |

Definition at line 664 of file qsharedpointer_impl.h.

    {
        return ptr1.data() == ptr2.data();
    }

bool operator!= | ( | const QSharedPointer< T > & | ptr1,
|  | const QSharedPointer< X > & | ptr2
| ) |  |

Definition at line 669 of file qsharedpointer_impl.h.

    {
        return ptr1.data() != ptr2.data();
    }

bool operator== | ( | const QSharedPointer< T > & | ptr1,
|  | const X * | ptr2
| ) |  |

Definition at line 675 of file qsharedpointer_impl.h.

    {
        return ptr1.data() == ptr2;
    }

bool operator== | ( | const T * | ptr1,
|  | const QSharedPointer< X > & | ptr2
| ) |  |

Definition at line 680 of file qsharedpointer_impl.h.

    {
        return ptr1 == ptr2.data();
    }

bool operator!= | ( | const QSharedPointer< T > & | ptr1,
|  | const X * | ptr2
| ) |  |

Definition at line 685 of file qsharedpointer_impl.h.

    {
        return !(ptr1 == ptr2);
    }

bool operator!= | ( | const T * | ptr1,
|  | const QSharedPointer< X > & | ptr2
| ) |  |

Definition at line 690 of file qsharedpointer_impl.h.

    {
        return !(ptr2 == ptr1);
    }

bool operator== | ( | const QSharedPointer< T > & | ptr1,
|  | const QWeakPointer< X > & | ptr2
| ) |  |

Definition at line 696 of file qsharedpointer_impl.h.

    {
        return ptr2 == ptr1;
    }

bool operator!= | ( | const QSharedPointer< T > & | ptr1,
|  | const QWeakPointer< X > & | ptr2
| ) |  |

Definition at line 701 of file qsharedpointer_impl.h.

    {
        return ptr2 != ptr1;
    }

Q_INLINE_TEMPLATE QSharedPointer<T>::difference_type operator- | ( | const QSharedPointer< T > & | ptr1,
|  | const QSharedPointer< X > & | ptr2
| ) |  |

Definition at line 710 of file qsharedpointer_impl.h.

    {
        return ptr1.data() - ptr2.data();
    }

Q_INLINE_TEMPLATE QSharedPointer<T>::difference_type operator- | ( | const QSharedPointer< T > & | ptr1,
|  | X * | ptr2
| ) |  |

Definition at line 715 of file qsharedpointer_impl.h.

    {
        return ptr1.data() - ptr2;
    }

Q_INLINE_TEMPLATE QSharedPointer<X>::difference_type operator- | ( | T * | ptr1,
|  | const QSharedPointer< X > & | ptr2
| ) |  |

Definition at line 720 of file qsharedpointer_impl.h.

    {
        return ptr1 - ptr2.data();
    }

Q_INLINE_TEMPLATE bool operator< | ( | const QSharedPointer< T > & | ptr1,
|  | const QSharedPointer< X > & | ptr2
| ) |  |

Definition at line 729 of file qsharedpointer_impl.h.

    {
        return ptr1.data() < ptr2.data();
    }

Q_INLINE_TEMPLATE bool operator< | ( | const QSharedPointer< T > & | ptr1,
|  | X * | ptr2
| ) |  |

Definition at line 734 of file qsharedpointer_impl.h.

    {
        return ptr1.data() < ptr2;
    }

Q_INLINE_TEMPLATE bool operator< | ( | T * | ptr1,
|  | const QSharedPointer< X > & | ptr2
| ) |  |

Definition at line 739 of file qsharedpointer_impl.h.

    {
        return ptr1 < ptr2.data();
    }

uint qHash | ( | const T * | key | ) | `[inline]`

Search for all occurrences

Definition at line 97 of file qhash.h.

    {
        return qHash(reinterpret_cast<quintptr>(key));
    }

Q_INLINE_TEMPLATE uint qHash | ( | const QSharedPointer< T > & | ptr | ) |

Search for all occurrences

Definition at line 749 of file qsharedpointer_impl.h.

    {
        return QT_PREPEND_NAMESPACE(qHash)<T>(ptr.data());
    }

void qSwap | ( | QSharedPointer< T > & | p1,
|  | QSharedPointer< T > & | p2
| ) |  | `[inline]`

Search for all occurrences

Definition at line 762 of file qsharedpointer_impl.h.

    {
        p1.swap(p2);
    }

Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast | ( | const QWeakPointer< T > & | src | ) |

Search for all occurrences

Definition at line 786 of file qsharedpointer_impl.h.

    {
        return qSharedPointerCast<X, T>(src.toStrongRef());
    }

Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast | ( | const QWeakPointer< T > & | src | ) |

Search for all occurrences

Definition at line 798 of file qsharedpointer_impl.h.

    {
        return qSharedPointerDynamicCast<X, T>(src.toStrongRef());
    }

Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerConstCast | ( | const QWeakPointer< T > & | src | ) |

Search for all occurrences

Definition at line 810 of file qsharedpointer_impl.h.

    {
        return qSharedPointerConstCast<X, T>(src.toStrongRef());
    }

Q_INLINE_TEMPLATE QWeakPointer<X> qWeakPointerCast | ( | const QSharedPointer< T > & | src | ) |

Search for all occurrences

Definition at line 817 of file qsharedpointer_impl.h.

    {
        return qSharedPointerCast<X, T>(src).toWeakRef();
    }

Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast | ( | const QWeakPointer< T > & | src | ) |

Search for all occurrences

Definition at line 830 of file qsharedpointer_impl.h.

    {
        return qSharedPointerObjectCast<X>(src.toStrongRef());
    }

QSharedPointer<typename QtSharedPointer::RemovePointer<X>::Type> qobject_cast | ( | const QSharedPointer< T > & | src | ) | `[inline]`

Search for all occurrences

Definition at line 837 of file qsharedpointer_impl.h.

    {
        return qSharedPointerObjectCast<typename QtSharedPointer::RemovePointer<X>::Type, T>(src);
    }

QSharedPointer<typename QtSharedPointer::RemovePointer<X>::Type> qobject_cast | ( | const QWeakPointer< T > & | src | ) | `[inline]`

Search for all occurrences

Definition at line 843 of file qsharedpointer_impl.h.

    {
        return qSharedPointerObjectCast<typename QtSharedPointer::RemovePointer<X>::Type, T>(src);
    }