5#ifndef QSHAREDPOINTER_H
6#define QSHAREDPOINTER_H
8#include <QtCore/qglobal.h>
9#include <QtCore/qatomic.h>
10#include <QtCore/qshareddata.h>
13# include <QtCore/qsharedpointer_impl.h>
31 operator
bool()
const;
32 bool operator!()
const;
34 T *operator->()
const;
38 template <
typename X>
explicit QSharedPointer(X *ptr);
39 template <
typename X,
typename Deleter> QSharedPointer(X *ptr, Deleter d);
40 QSharedPointer(std::nullptr_t);
41 template <
typename Deleter> QSharedPointer(std::nullptr_t, Deleter d);
42 QSharedPointer(
const QSharedPointer<T> &other);
43 QSharedPointer(
const QWeakPointer<T> &other);
44 QSharedPointer(QSharedPointer<T> &&other)
noexcept;
48 QSharedPointer<T> &operator=(
const QSharedPointer<T> &other);
49 QSharedPointer<T> &operator=(QSharedPointer<T> &&other)
noexcept;
50 QSharedPointer<T> &operator=(
const QWeakPointer<T> &other);
53 QSharedPointer(QSharedPointer<X> && other)
noexcept;
55 QSharedPointer &operator=(QSharedPointer<X> && other)
noexcept;
57 void swap(QSharedPointer<T> &other)
noexcept;
59 QWeakPointer<T> toWeakRef()
const;
65 template <
typename Deleter>
66 void reset(T *t, Deleter deleter);
69 template <
class X> QSharedPointer<X> staticCast()
const &;
70 template <
class X> QSharedPointer<X> staticCast() &&;
71 template <
class X> QSharedPointer<X> dynamicCast()
const &;
72 template <
class X> QSharedPointer<X> dynamicCast() &&;
73 template <
class X> QSharedPointer<X> constCast()
const &;
74 template <
class X> QSharedPointer<X> constCast() &&;
75 template <
class X> QSharedPointer<X> objectCast()
const &;
76 template <
class X> QSharedPointer<X> objectCast() &&;
78 template <
typename... Args>
79 static inline QSharedPointer<T> create(Args &&... args);
83 bool owner_before(
const QSharedPointer<X> &other)
const noexcept;
85 bool owner_before(
const QWeakPointer<X> &other)
const noexcept;
88 bool owner_equal(
const QSharedPointer<X> &other)
const noexcept;
90 bool owner_equal(
const QWeakPointer<X> &other)
const noexcept;
92 size_t owner_hash()
const noexcept;
96size_t qHash(
const QSharedPointer<T> &key, size_t seed = 0)
noexcept;
104 operator
bool()
const;
105 bool operator!()
const;
109 QWeakPointer(
const QWeakPointer<T> &other)
noexcept;
110 QWeakPointer(QWeakPointer<T> &&other)
noexcept;
111 QWeakPointer(
const QSharedPointer<T> &other);
115 QWeakPointer<T> &operator=(
const QWeakPointer<T> &other)
noexcept;
116 QWeakPointer<T> &operator=(QWeakPointer<T> &&other)
noexcept;
117 QWeakPointer<T> &operator=(
const QSharedPointer<T> &other);
119 void swap(QWeakPointer<T> &other)
noexcept;
123 QSharedPointer<T> toStrongRef()
const;
124 QSharedPointer<T> lock()
const;
127 template <
typename X>
128 bool owner_before(
const QWeakPointer<X> &other)
const noexcept;
129 template <
typename X>
130 bool owner_before(
const QSharedPointer<X> &other)
const noexcept;
132 template <
typename X>
133 bool owner_equal(
const QWeakPointer<X> &other)
const noexcept;
134 template <
typename X>
135 bool owner_equal(
const QSharedPointer<X> &other)
const noexcept;
137 size_t owner_hash()
const noexcept;
141class QEnableSharedFromThis
144 QSharedPointer<T> sharedFromThis();
145 QSharedPointer<
const T> sharedFromThis()
const;
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 QSharedPointer<X> &ptr2);
150template<
class T,
class X>
bool operator==(
const QSharedPointer<T> &ptr1,
const X *ptr2);
151template<
class T,
class X>
bool operator!=(
const QSharedPointer<T> &ptr1,
const X *ptr2);
152template<
class T,
class X>
bool operator==(
const T *ptr1,
const QSharedPointer<X> &ptr2);
153template<
class T,
class X>
bool operator!=(
const 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 QWeakPointer<T> &ptr1,
const QSharedPointer<X> &ptr2);
156template<
class T,
class X>
bool operator==(
const QSharedPointer<T> &ptr1,
const QWeakPointer<X> &ptr2);
157template<
class T,
class X>
bool operator!=(
const QSharedPointer<T> &ptr1,
const QWeakPointer<X> &ptr2);
158template<
class T>
bool operator==(
const QSharedPointer<T> &lhs, std::nullptr_t);
159template<
class T>
bool operator!=(
const QSharedPointer<T> &lhs, std::nullptr_t);
160template<
class T>
bool operator==(std::nullptr_t,
const QSharedPointer<T> &rhs);
161template<
class T>
bool operator!=(std::nullptr_t,
const QSharedPointer<T> &rhs);
162template<
class T>
bool operator==(
const QWeakPointer<T> &lhs, std::nullptr_t);
163template<
class T>
bool operator!=(
const QWeakPointer<T> &lhs, std::nullptr_t);
164template<
class T>
bool operator==(std::nullptr_t,
const QWeakPointer<T> &rhs);
165template<
class T>
bool operator!=(std::nullptr_t,
const QWeakPointer<T> &rhs);
167template <
class X,
class T> QSharedPointer<X> qSharedPointerCast(
const QSharedPointer<T> &other);
168template <
class X,
class T> QSharedPointer<X> qSharedPointerCast(QSharedPointer<T> &&other);
169template <
class X,
class T> QSharedPointer<X> qSharedPointerCast(
const QWeakPointer<T> &other);
170template <
class X,
class T> QSharedPointer<X> qSharedPointerDynamicCast(
const QSharedPointer<T> &src);
171template <
class X,
class T> QSharedPointer<X> qSharedPointerDynamicCast(QSharedPointer<T> &&src);
172template <
class X,
class T> QSharedPointer<X> qSharedPointerDynamicCast(
const QWeakPointer<T> &src);
173template <
class X,
class T> QSharedPointer<X> qSharedPointerConstCast(
const QSharedPointer<T> &src);
174template <
class X,
class T> QSharedPointer<X> qSharedPointerConstCast(QSharedPointer<T> &&src);
175template <
class X,
class T> QSharedPointer<X> qSharedPointerConstCast(
const QWeakPointer<T> &src);
176template <
class X,
class T> QSharedPointer<X> qSharedPointerObjectCast(
const QSharedPointer<T> &src);
177template <
class X,
class T> QSharedPointer<X> qSharedPointerObjectCast(QSharedPointer<T> &&src);
178template <
class X,
class T> QSharedPointer<X> qSharedPointerObjectCast(
const QWeakPointer<T> &src);
179template <
typename X,
class T> std::shared_ptr<X> qobject_pointer_cast(
const std::shared_ptr<T> &src);
180template <
typename X,
class T> std::shared_ptr<X> qobject_pointer_cast(std::shared_ptr<T> &&src);
181template <
typename X,
class T> std::shared_ptr<X> qSharedPointerObjectCast(
const std::shared_ptr<T> &src);
182template <
typename X,
class T> std::shared_ptr<X> qSharedPointerObjectCast(std::shared_ptr<T> &&src);
184template <
class X,
class T> QWeakPointer<X> qWeakPointerCast(
const QWeakPointer<T> &src);
QHash< const void *, Data > dPointers
QHash< const volatile void *, const void * > dataPointers
Combined button and popup list for selecting options.
const volatile void * pointer