4#ifndef QSHAREDPOINTER_H
5#define QSHAREDPOINTER_H
7#include <QtCore/qglobal.h>
8#include <QtCore/qatomic.h>
9#include <QtCore/qshareddata.h>
12# include <QtCore/qsharedpointer_impl.h>
30 operator bool()
const;
40 template <
typename Deleter>
QSharedPointer(std::nullptr_t, Deleter d);
56 void swap(QSharedPointer<T> &
other)
noexcept;
64 template <
typename Deleter>
65 void reset(T *
t, Deleter deleter);
68 template <
class X> QSharedPointer<X>
staticCast()
const;
69 template <
class X> QSharedPointer<X>
dynamicCast()
const;
70 template <
class X> QSharedPointer<X>
constCast()
const;
71 template <
class X> QSharedPointer<X>
objectCast()
const;
73 template <
typename... Args>
74 static inline QSharedPointer<T>
create(Args &&...
args);
99 operator bool()
const;
110 QWeakPointer<T> &
operator=(
const QWeakPointer<T> &
other)
noexcept;
117 void swap(QWeakPointer<T> &
other)
noexcept;
122 QSharedPointer<T> toStrongRef()
const;
123 QSharedPointer<T>
lock()
const;
126 template <
typename X>
128 template <
typename X>
131 template <
typename X>
133 template <
typename X>
143 QSharedPointer<T> sharedFromThis();
144 QSharedPointer<const T> sharedFromThis()
const;
147template<
class T,
class X>
bool operator==(
const QSharedPointer<T> &ptr1,
const QSharedPointer<X> &ptr2);
148template<
class T,
class X>
bool operator!=(
const QSharedPointer<T> &ptr1,
const QSharedPointer<X> &ptr2);
149template<
class T,
class X>
bool operator==(
const QSharedPointer<T> &ptr1,
const X *ptr2);
150template<
class T,
class X>
bool operator!=(
const QSharedPointer<T> &ptr1,
const X *ptr2);
151template<
class T,
class X>
bool operator==(
const T *ptr1,
const QSharedPointer<X> &ptr2);
152template<
class T,
class X>
bool operator!=(
const T *ptr1,
const QSharedPointer<X> &ptr2);
153template<
class T,
class X>
bool operator==(
const QWeakPointer<T> &ptr1,
const QSharedPointer<X> &ptr2);
154template<
class T,
class X>
bool operator!=(
const QWeakPointer<T> &ptr1,
const QSharedPointer<X> &ptr2);
155template<
class T,
class X>
bool operator==(
const QSharedPointer<T> &ptr1,
const QWeakPointer<X> &ptr2);
156template<
class T,
class X>
bool operator!=(
const QSharedPointer<T> &ptr1,
const QWeakPointer<X> &ptr2);
157template<
class T>
bool operator==(
const QSharedPointer<T> &lhs, std::nullptr_t);
158template<
class T>
bool operator!=(
const QSharedPointer<T> &lhs, std::nullptr_t);
159template<
class T>
bool operator==(std::nullptr_t,
const QSharedPointer<T> &rhs);
160template<
class T>
bool operator!=(std::nullptr_t,
const QSharedPointer<T> &rhs);
161template<
class T>
bool operator==(
const QWeakPointer<T> &lhs, std::nullptr_t);
162template<
class T>
bool operator!=(
const QWeakPointer<T> &lhs, std::nullptr_t);
163template<
class T>
bool operator==(std::nullptr_t,
const QWeakPointer<T> &rhs);
164template<
class T>
bool operator!=(std::nullptr_t,
const QWeakPointer<T> &rhs);
template< class X, class T > std::shared_ptr< X > qobject_pointer_cast(const std::shared_ptr< T > &src)
bool owner_equal(const QSharedPointer< X > &other) const noexcept
bool isNull() const noexcept
Returns true if this object refers to \nullptr.
template< class T, class X > bool operator==(const QSharedPointer< T > &ptr1, const QSharedPointer< X > &ptr2)
Returns true if ptr1 and ptr2 refer to the same pointer.
QSharedPointer< X > constCast() const
Performs a \tt const_cast from this pointer's type to \tt X and returns a QSharedPointer that shares ...
bool operator!() const noexcept
Returns true if this object refers to \nullptr.
friend class QSharedPointer
Creates a QSharedPointer that is null (the object is holding a reference to \nullptr).
template< class X, class T > QSharedPointer< X > qSharedPointerDynamicCast(const QSharedPointer< T > &src)
Returns a shared pointer to the pointer held by src, using a dynamic cast to type \tt X to obtain an ...
QWeakPointer< T > toWeakRef() const
Returns a weak reference object that shares the pointer referenced by this object.
QSharedPointer< X > objectCast() const
T * data() const noexcept
Returns the value of the pointer referenced by this object.
template< class X, class T > QSharedPointer< X > qSharedPointerConstCast(const QSharedPointer< T > &src)
Returns a shared pointer to the pointer held by src, cast to type \tt X.
QSharedPointer< X > dynamicCast() const
Performs a dynamic cast from this pointer's type to \tt X and returns a QSharedPointer that shares th...
~QSharedPointer()
Destroys this QSharedPointer object.
size_t owner_hash() const noexcept
friend class QWeakPointer
bool owner_before(const QWeakPointer< X > &other) const noexcept
template< class T, class X > bool operator!=(const QSharedPointer< T > &ptr1, const QSharedPointer< X > &ptr2)
Returns true if ptr1 and ptr2 refer to distinct pointers.
template< class X, class T > QSharedPointer< X > qSharedPointerCast(const QSharedPointer< T > &other)
Returns a shared pointer to the pointer held by other, cast to type \tt X.
template< class X, class T > QSharedPointer< X > qSharedPointerObjectCast(const QSharedPointer< T > &src)
The qSharedPointerObjectCast function is for casting a shared pointer.
T & operator*() const
Provides access to the shared pointer's members.
QSharedPointer & operator=(const QSharedPointer &other) noexcept
Makes this object share other's pointer.
QSharedPointer< X > staticCast() const
Performs a static cast from this pointer's type to \tt X and returns a QSharedPointer that shares the...
T * operator->() const noexcept
Provides access to the shared pointer's members.
void swap(QSharedPointer &other) noexcept
template< class T > qHash(const QSharedPointer< T > &key, size_t seed)
Returns the hash value for key, using seed to seed the calculation.
void clear()
Clears this QSharedPointer object, dropping the reference that it may have had to the pointer.
Combined button and popup list for selecting options.
static ControlElement< T > * ptr(QWidget *widget)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
Q_INLINE_TEMPLATE QWeakPointer< X > qWeakPointerCast(const QSharedPointer< T > &src)