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;
31 bool operator!()
const;
33 T *operator->()
const;
37 template <
typename X>
explicit QSharedPointer(X *ptr);
38 template <
typename X,
typename Deleter> QSharedPointer(X *ptr, Deleter d);
39 QSharedPointer(std::nullptr_t);
40 template <
typename Deleter> QSharedPointer(std::nullptr_t, Deleter d);
41 QSharedPointer(
const QSharedPointer<T> &other);
42 QSharedPointer(
const QWeakPointer<T> &other);
43 QSharedPointer(QSharedPointer<T> &&other)
noexcept;
47 QSharedPointer<T> &operator=(
const QSharedPointer<T> &other);
48 QSharedPointer<T> &operator=(QSharedPointer<T> &&other)
noexcept;
49 QSharedPointer<T> &operator=(
const QWeakPointer<T> &other);
52 QSharedPointer(QSharedPointer<X> && other)
noexcept;
54 QSharedPointer &operator=(QSharedPointer<X> && other)
noexcept;
56 void swap(QSharedPointer<T> &other)
noexcept;
58 QWeakPointer<T> toWeakRef()
const;
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> staticCast() &&;
70 template <
class X> QSharedPointer<X> dynamicCast()
const &;
71 template <
class X> QSharedPointer<X> dynamicCast() &&;
72 template <
class X> QSharedPointer<X> constCast()
const &;
73 template <
class X> QSharedPointer<X> constCast() &&;
74 template <
class X> QSharedPointer<X> objectCast()
const &;
75 template <
class X> QSharedPointer<X> objectCast() &&;
77 template <
typename... Args>
78 static inline QSharedPointer<T> create(Args &&... args);
82 bool owner_before(
const QSharedPointer<X> &other)
const noexcept;
84 bool owner_before(
const QWeakPointer<X> &other)
const noexcept;
87 bool owner_equal(
const QSharedPointer<X> &other)
const noexcept;
89 bool owner_equal(
const QWeakPointer<X> &other)
const noexcept;
91 size_t owner_hash()
const noexcept;
95size_t qHash(
const QSharedPointer<T> &key, size_t seed = 0)
noexcept;
103 operator
bool()
const;
104 bool operator!()
const;
108 QWeakPointer(
const QWeakPointer<T> &other)
noexcept;
109 QWeakPointer(QWeakPointer<T> &&other)
noexcept;
110 QWeakPointer(
const QSharedPointer<T> &other);
114 QWeakPointer<T> &operator=(
const QWeakPointer<T> &other)
noexcept;
115 QWeakPointer<T> &operator=(QWeakPointer<T> &&other)
noexcept;
116 QWeakPointer<T> &operator=(
const QSharedPointer<T> &other);
118 void swap(QWeakPointer<T> &other)
noexcept;
122 QSharedPointer<T> toStrongRef()
const;
123 QSharedPointer<T> lock()
const;
126 template <
typename X>
127 bool owner_before(
const QWeakPointer<X> &other)
const noexcept;
128 template <
typename X>
129 bool owner_before(
const QSharedPointer<X> &other)
const noexcept;
131 template <
typename X>
132 bool owner_equal(
const QWeakPointer<X> &other)
const noexcept;
133 template <
typename X>
134 bool owner_equal(
const QSharedPointer<X> &other)
const noexcept;
136 size_t owner_hash()
const noexcept;
140class QEnableSharedFromThis
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);
166template <
class X,
class T> QSharedPointer<X> qSharedPointerCast(
const QSharedPointer<T> &other);
167template <
class X,
class T> QSharedPointer<X> qSharedPointerCast(QSharedPointer<T> &&other);
168template <
class X,
class T> QSharedPointer<X> qSharedPointerCast(
const QWeakPointer<T> &other);
169template <
class X,
class T> QSharedPointer<X> qSharedPointerDynamicCast(
const QSharedPointer<T> &src);
170template <
class X,
class T> QSharedPointer<X> qSharedPointerDynamicCast(QSharedPointer<T> &&src);
171template <
class X,
class T> QSharedPointer<X> qSharedPointerDynamicCast(
const QWeakPointer<T> &src);
172template <
class X,
class T> QSharedPointer<X> qSharedPointerConstCast(
const QSharedPointer<T> &src);
173template <
class X,
class T> QSharedPointer<X> qSharedPointerConstCast(QSharedPointer<T> &&src);
174template <
class X,
class T> QSharedPointer<X> qSharedPointerConstCast(
const QWeakPointer<T> &src);
175template <
class X,
class T> QSharedPointer<X> qSharedPointerObjectCast(
const QSharedPointer<T> &src);
176template <
class X,
class T> QSharedPointer<X> qSharedPointerObjectCast(QSharedPointer<T> &&src);
177template <
class X,
class T> QSharedPointer<X> qSharedPointerObjectCast(
const QWeakPointer<T> &src);
178template <
typename X,
class T> std::shared_ptr<X> qobject_pointer_cast(
const std::shared_ptr<T> &src);
179template <
typename X,
class T> std::shared_ptr<X> qobject_pointer_cast(std::shared_ptr<T> &&src);
180template <
typename X,
class T> std::shared_ptr<X> qSharedPointerObjectCast(
const std::shared_ptr<T> &src);
181template <
typename X,
class T> std::shared_ptr<X> qSharedPointerObjectCast(std::shared_ptr<T> &&src);
183template <
class X,
class T> QWeakPointer<X> qWeakPointerCast(
const QWeakPointer<T> &src);
QHash< const void *, Data > dPointers
QHash< const volatile void *, const void * > dataPointers
const volatile void * pointer