QtBase  v6.3.1
Classes | Namespaces | Macros | Functions
qsharedpointer_impl.h File Reference
#include <new>
#include <QtCore/qatomic.h>
#include <QtCore/qobject.h>
#include <QtCore/qhashfunctions.h>
#include <memory>
Include dependency graph for qsharedpointer_impl.h:

Go to the source code of this file.

Classes

struct  QtSharedPointer::NormalDeleter
 
struct  QtSharedPointer::RemovePointer< T * >
 
struct  QtSharedPointer::RemovePointer< QSharedPointer< T > >
 
struct  QtSharedPointer::RemovePointer< QWeakPointer< T > >
 
struct  QtSharedPointer::ExternalRefCountData
 
struct  QtSharedPointer::CustomDeleter< T, Deleter >
 
struct  QtSharedPointer::CustomDeleter< T, NormalDeleter >
 
struct  QtSharedPointer::ExternalRefCountWithCustomDeleter< T, Deleter >
 
struct  QtSharedPointer::ExternalRefCountWithContiguousData< T >
 
class  QSharedPointer< T >
 The QSharedPointer class holds a strong reference to a shared pointer. More...
 
class  QWeakPointer< T >
 The QWeakPointer class holds a weak reference to a shared pointer. More...
 
struct  QtPrivate::EnableInternalData
 
struct  QtPrivate::EnableInternalDataWrap< T >
 
class  QEnableSharedFromThis< T >
 A base class that allows obtaining a QSharedPointer for an object already managed by a shared pointer. More...
 

Namespaces

 QtPrivate
 
 QtSharedPointer
 

Macros

#define DECLARE_COMPARE_SET(T1, A1, T2, A2)
 
#define DECLARE_TEMPLATE_COMPARE_SET(T1, A1, T2, A2)
 

Functions

template<class X , class T >
QSharedPointer< XqSharedPointerCast (const QSharedPointer< T > &ptr)
 
template<class X , class T >
QSharedPointer< XqSharedPointerDynamicCast (const QSharedPointer< T > &ptr)
 
template<class X , class T >
QSharedPointer< XqSharedPointerConstCast (const QSharedPointer< T > &ptr)
 
template<class X , class T >
QSharedPointer< XqSharedPointerObjectCast (const QSharedPointer< T > &ptr)
 
template<class X , class Y >
QSharedPointer< XQtSharedPointer::copyAndSetPointer (X *ptr, const QSharedPointer< Y > &src)
 
Q_CORE_EXPORT void QtSharedPointer::internalSafetyCheckAdd (const void *, const volatile void *)
 
Q_CORE_EXPORT void QtSharedPointer::internalSafetyCheckRemove (const void *)
 
template<class T , typename Klass , typename RetVal >
void QtSharedPointer::executeDeleter (T *t, RetVal(Klass::*memberDeleter)())
 
template<class T , typename Deleter >
void QtSharedPointer::executeDeleter (T *t, Deleter d)
 
Q_CORE_EXPORT QWeakPointer< QObjectQtSharedPointer::weakPointerFromVariant_internal (const QVariant &variant)
 
Q_CORE_EXPORT QSharedPointer< QObjectQtSharedPointer::sharedPointerFromVariant_internal (const QVariant &variant)
 
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 >
Q_INLINE_TEMPLATE size_t qHash (const QSharedPointer< T > &ptr, size_t seed=0)
 
template<class T >
void swap (QSharedPointer< T > &p1, QSharedPointer< T > &p2) noexcept
 
template<class T >
void swap (QWeakPointer< T > &p1, QWeakPointer< T > &p2) noexcept
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XQtSharedPointer::copyAndSetPointer (X *ptr, const QSharedPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XqSharedPointerCast (const QSharedPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XqSharedPointerCast (const QWeakPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XqSharedPointerDynamicCast (const QSharedPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XqSharedPointerDynamicCast (const QWeakPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XqSharedPointerConstCast (const QSharedPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XqSharedPointerConstCast (const QWeakPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QWeakPointer< XqWeakPointerCast (const QSharedPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XqSharedPointerObjectCast (const QSharedPointer< T > &src)
 
template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer< XqSharedPointerObjectCast (const QWeakPointer< T > &src)
 
template<class X , class T >
QSharedPointer< typename QtSharedPointer::RemovePointer< X >::Typeqobject_cast (const QSharedPointer< T > &src)
 
template<class X , class T >
QSharedPointer< typename QtSharedPointer::RemovePointer< X >::Typeqobject_cast (const QWeakPointer< T > &src)
 
template<typename T >
QWeakPointer< typename std::enable_if< QtPrivate::IsPointerToTypeDerivedFromQObject< T * >::Value, T >::typeqWeakPointerFromVariant (const QVariant &variant)
 
template<typename T >
QSharedPointer< typename std::enable_if< QtPrivate::IsPointerToTypeDerivedFromQObject< T * >::Value, T >::typeqSharedPointerFromVariant (const QVariant &variant)
 
template<typename X , class T >
std::shared_ptr< Xqobject_pointer_cast (const std::shared_ptr< T > &src)
 
template<typename X , class T >
std::shared_ptr< Xqobject_pointer_cast (std::shared_ptr< T > &&src)
 
template<typename X , class T >
std::shared_ptr< XqSharedPointerObjectCast (const std::shared_ptr< T > &src)
 
template<typename X , class T >
std::shared_ptr< XqSharedPointerObjectCast (std::shared_ptr< T > &&src)
 
template<typename T >
 Q_DECLARE_TYPEINFO_BODY (QWeakPointer< T >, Q_RELOCATABLE_TYPE)
 
template<typename T >
 Q_DECLARE_TYPEINFO_BODY (QSharedPointer< T >, Q_RELOCATABLE_TYPE)
 

Macro Definition Documentation

◆ DECLARE_COMPARE_SET

#define DECLARE_COMPARE_SET (   T1,
  A1,
  T2,
  A2 
)
Value:
friend bool operator==(T1, T2) noexcept \
{ return A1 == A2; } \
friend bool operator!=(T1, T2) noexcept \
{ return A1 != A2; }
template< typename Enum > bool operator!=(Enum lhs, QFlags< Enum > rhs)
template< typename Enum > bool operator==(Enum lhs, QFlags< Enum > rhs)

Definition at line 446 of file qsharedpointer_impl.h.

◆ DECLARE_TEMPLATE_COMPARE_SET

#define DECLARE_TEMPLATE_COMPARE_SET (   T1,
  A1,
  T2,
  A2 
)
Value:
template <typename X> \
friend bool operator==(T1, T2) noexcept \
{ return A1 == A2; } \
template <typename X> \
friend bool operator!=(T1, T2) noexcept \
{ return A1 != A2; }

Definition at line 452 of file qsharedpointer_impl.h.

Function Documentation

◆ operator-() [1/3]

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

Definition at line 762 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ operator-() [2/3]

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

Definition at line 767 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ operator-() [3/3]

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

Definition at line 772 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ operator<() [1/3]

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

Definition at line 781 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ operator<() [2/3]

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

Definition at line 787 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ operator<() [3/3]

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

Definition at line 793 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ Q_DECLARE_TYPEINFO_BODY() [1/2]

template<typename T >
Q_DECLARE_TYPEINFO_BODY ( QSharedPointer< T ,
Q_RELOCATABLE_TYPE   
)

◆ Q_DECLARE_TYPEINFO_BODY() [2/2]

template<typename T >
Q_DECLARE_TYPEINFO_BODY ( QWeakPointer< T ,
Q_RELOCATABLE_TYPE   
)

◆ qHash()

template<class T >
Q_INLINE_TEMPLATE size_t qHash ( const QSharedPointer< T > &  ptr,
size_t  seed = 0 
)

Definition at line 803 of file qsharedpointer_impl.h.

◆ qobject_cast() [1/2]

template<class X , class T >
QSharedPointer<typename QtSharedPointer::RemovePointer<X>::Type> qobject_cast ( const QSharedPointer< T > &  src)
inline

Definition at line 895 of file qsharedpointer_impl.h.

◆ qobject_cast() [2/2]

template<class X , class T >
QSharedPointer<typename QtSharedPointer::RemovePointer<X>::Type> qobject_cast ( const QWeakPointer< T > &  src)
inline

Definition at line 901 of file qsharedpointer_impl.h.

◆ qobject_pointer_cast() [1/2]

template<typename X , class T >
std::shared_ptr<X> qobject_pointer_cast ( const std::shared_ptr< T > &  src)
related

Definition at line 924 of file qsharedpointer_impl.h.

◆ qobject_pointer_cast() [2/2]

template<typename X , class T >
std::shared_ptr<X> qobject_pointer_cast ( std::shared_ptr< T > &&  src)
related

Definition at line 931 of file qsharedpointer_impl.h.

◆ qSharedPointerCast() [1/3]

template<class X , class T >
QSharedPointer<X> qSharedPointerCast ( const QSharedPointer< T > &  ptr)
related

Definition at line 836 of file qsharedpointer_impl.h.

◆ qSharedPointerCast() [2/3]

template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast ( const QSharedPointer< T > &  src)
related

Definition at line 836 of file qsharedpointer_impl.h.

◆ qSharedPointerCast() [3/3]

template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerCast ( const QWeakPointer< T > &  src)
related

Definition at line 842 of file qsharedpointer_impl.h.

◆ qSharedPointerConstCast() [1/3]

template<class X , class T >
QSharedPointer<X> qSharedPointerConstCast ( const QSharedPointer< T > &  ptr)
related

Definition at line 862 of file qsharedpointer_impl.h.

◆ qSharedPointerConstCast() [2/3]

template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerConstCast ( const QSharedPointer< T > &  src)
related

Definition at line 862 of file qsharedpointer_impl.h.

◆ qSharedPointerConstCast() [3/3]

template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerConstCast ( const QWeakPointer< T > &  src)
related

Definition at line 868 of file qsharedpointer_impl.h.

◆ qSharedPointerDynamicCast() [1/3]

template<class X , class T >
QSharedPointer<X> qSharedPointerDynamicCast ( const QSharedPointer< T > &  ptr)
related

Definition at line 848 of file qsharedpointer_impl.h.

◆ qSharedPointerDynamicCast() [2/3]

template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast ( const QSharedPointer< T > &  src)
related

Definition at line 848 of file qsharedpointer_impl.h.

◆ qSharedPointerDynamicCast() [3/3]

template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerDynamicCast ( const QWeakPointer< T > &  src)
related

Definition at line 856 of file qsharedpointer_impl.h.

◆ qSharedPointerFromVariant()

template<typename T >
QSharedPointer<typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value, T>::type> qSharedPointerFromVariant ( const QVariant variant)

Definition at line 916 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ qSharedPointerObjectCast() [1/5]

template<class X , class T >
QSharedPointer<X> qSharedPointerObjectCast ( const QSharedPointer< T > &  ptr)
related

Definition at line 882 of file qsharedpointer_impl.h.

◆ qSharedPointerObjectCast() [2/5]

template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast ( const QSharedPointer< T > &  src)
related

Definition at line 882 of file qsharedpointer_impl.h.

◆ qSharedPointerObjectCast() [3/5]

template<class X , class T >
Q_INLINE_TEMPLATE QSharedPointer<X> qSharedPointerObjectCast ( const QWeakPointer< T > &  src)
related

Definition at line 888 of file qsharedpointer_impl.h.

◆ qSharedPointerObjectCast() [4/5]

template<typename X , class T >
std::shared_ptr<X> qSharedPointerObjectCast ( const std::shared_ptr< T > &  src)
related

Definition at line 946 of file qsharedpointer_impl.h.

◆ qSharedPointerObjectCast() [5/5]

template<typename X , class T >
std::shared_ptr<X> qSharedPointerObjectCast ( std::shared_ptr< T > &&  src)
related

Definition at line 952 of file qsharedpointer_impl.h.

◆ qWeakPointerCast()

template<class X , class T >
Q_INLINE_TEMPLATE QWeakPointer<X> qWeakPointerCast ( const QSharedPointer< T > &  src)

Definition at line 875 of file qsharedpointer_impl.h.

◆ qWeakPointerFromVariant()

template<typename T >
QWeakPointer<typename std::enable_if<QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value, T>::type> qWeakPointerFromVariant ( const QVariant variant)

TODO - QTBUG-88102: make this use toStrongRef() (once support for

storing non-managed QObjects in QWeakPointer is removed)

Definition at line 910 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ swap() [1/2]

template<class T >
void swap ( QSharedPointer< T > &  p1,
QSharedPointer< T > &  p2 
)
inlinenoexcept

Definition at line 816 of file qsharedpointer_impl.h.

Here is the call graph for this function:

◆ swap() [2/2]

template<class T >
void swap ( QWeakPointer< T > &  p1,
QWeakPointer< T > &  p2 
)
inlinenoexcept

Definition at line 820 of file qsharedpointer_impl.h.

Here is the call graph for this function: