Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qsharedpointer_impl.h File Reference
#include <new>
#include <QtCore/qatomic.h>
#include <QtCore/qhashfunctions.h>
#include <QtCore/qmetatype.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 >
 \inmodule QtCore More...
 
class  QWeakPointer< T >
 \inmodule QtCore More...
 
struct  QtPrivate::EnableInternalData
 
struct  QtPrivate::EnableInternalDataWrap< T >
 
class  QEnableSharedFromThis< T >
 \inmodule QtCore More...
 

Namespaces

namespace  QtPrivate
 \macro QT_NAMESPACE
 
namespace  QtSharedPointer
 

Macros

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

Functions

template<class T >
qobject_cast (const QObject *object)
 
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; }
constexpr bool operator!=(const timespec &t1, const timespec &t2)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1219

Definition at line 424 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 430 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 749 of file qsharedpointer_impl.h.

References QSharedPointer< T >::data().

+ 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 754 of file qsharedpointer_impl.h.

References QSharedPointer< T >::data().

+ 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 759 of file qsharedpointer_impl.h.

References QSharedPointer< T >::data().

+ 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 768 of file qsharedpointer_impl.h.

References QSharedPointer< T >::data().

+ 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 774 of file qsharedpointer_impl.h.

References QSharedPointer< T >::data().

+ 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 780 of file qsharedpointer_impl.h.

References QSharedPointer< T >::data().

+ 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 
)
related

Definition at line 790 of file qsharedpointer_impl.h.

Referenced by QSharedPointer< T >::qHash().

+ Here is the caller graph for this function:

◆ qobject_cast() [1/3]

template<class T >
T qobject_cast ( const QObject object)
related

Definition at line 394 of file qobject.h.

◆ qobject_cast() [2/3]

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

Definition at line 882 of file qsharedpointer_impl.h.

◆ qobject_cast() [3/3]

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

Definition at line 888 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 911 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 918 of file qsharedpointer_impl.h.

◆ qSharedPointerCast() [1/3]

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

Definition at line 823 of file qsharedpointer_impl.h.

References QtSharedPointer::copyAndSetPointer(), ptr(), and X.

+ Here is the call graph for this function:

◆ qSharedPointerCast() [2/3]

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

Definition at line 823 of file qsharedpointer_impl.h.

References QtSharedPointer::copyAndSetPointer(), ptr(), and X.

+ Here is the call graph for this function:

◆ qSharedPointerCast() [3/3]

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

Definition at line 829 of file qsharedpointer_impl.h.

◆ qSharedPointerConstCast() [1/3]

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

Definition at line 849 of file qsharedpointer_impl.h.

References QtSharedPointer::copyAndSetPointer(), ptr(), and X.

+ Here is the call graph for this function:

◆ qSharedPointerConstCast() [2/3]

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

Definition at line 849 of file qsharedpointer_impl.h.

References QtSharedPointer::copyAndSetPointer(), ptr(), and X.

+ Here is the call graph for this function:

◆ qSharedPointerConstCast() [3/3]

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

Definition at line 855 of file qsharedpointer_impl.h.

◆ qSharedPointerDynamicCast() [1/3]

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

Definition at line 835 of file qsharedpointer_impl.h.

References QtSharedPointer::copyAndSetPointer(), ptr(), and X.

+ Here is the call graph for this function:

◆ qSharedPointerDynamicCast() [2/3]

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

Definition at line 835 of file qsharedpointer_impl.h.

References QtSharedPointer::copyAndSetPointer(), ptr(), and X.

+ Here is the call graph for this function:

◆ qSharedPointerDynamicCast() [3/3]

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

Definition at line 843 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 903 of file qsharedpointer_impl.h.

References QtSharedPointer::sharedPointerFromVariant_internal(), and variant.

+ 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 869 of file qsharedpointer_impl.h.

References QtSharedPointer::copyAndSetPointer(), ptr(), and X.

+ Here is the call graph for this function:

◆ qSharedPointerObjectCast() [2/5]

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

Definition at line 869 of file qsharedpointer_impl.h.

References QtSharedPointer::copyAndSetPointer(), ptr(), and X.

+ Here is the call graph for this function:

◆ qSharedPointerObjectCast() [3/5]

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

Definition at line 875 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 933 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 939 of file qsharedpointer_impl.h.

◆ qWeakPointerCast()

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

Definition at line 862 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 897 of file qsharedpointer_impl.h.

References QtPrivate::EnableInternalData::internalData(), variant, and QtSharedPointer::weakPointerFromVariant_internal().

+ 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 803 of file qsharedpointer_impl.h.

References p1, p2, swap(), and QPixmap::swap().

+ 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 807 of file qsharedpointer_impl.h.

References p1, p2, swap(), and QPixmap::swap().

+ Here is the call graph for this function: