4#ifndef QQMLREFCOUNT_P_H
5#define QQMLREFCOUNT_P_H
18#include <QtCore/qglobal.h>
19#include <QtCore/qatomic.h>
20#include <private/qv4global_p.h>
32 inline void addref()
const;
33 inline int count()
const;
68 inline QQmlRefPointer<T> &
operator=(
const QQmlRefPointer<T> &o);
69 inline QQmlRefPointer<T> &
operator=(QQmlRefPointer<T> &&o)
noexcept;
71 inline bool isNull()
const {
return !o; }
75 explicit inline operator bool()
const {
return o !=
nullptr; }
76 inline T*
data()
const {
return o; }
78 inline QQmlRefPointer<T> &
adopt(T *);
80 inline T*
take() { T *
res = o; o =
nullptr;
return res; }
119template <
typename T,
typename ...Args>
122 static_assert(std::is_base_of_v<QQmlRefCount, T>);
135QQmlRefCount::~QQmlRefCount()
149 static_assert(std::is_base_of_v<QQmlRefCounted, T>,
150 "QQmlRefCounted<T> must be a base of T (CRTP)");
151 Q_ASSERT(refCount.loadRelaxed() > 0);
152 if (!refCount.deref())
153 delete static_cast<const T *
>(
this);
159 static_assert(std::is_final_v<T> || std::has_virtual_destructor_v<T>,
160 "T must either be marked final or have a virtual dtor, "
161 "lest release() runs into UB.");
166 return refCount.loadRelaxed();
218 QQmlRefPointer<T>
m(std::move(
other));
T loadRelaxed() const noexcept
void swap(QQmlRefPointer &other) noexcept
QQmlRefPointer< T > & operator=(const QQmlRefPointer< T > &o)
QQmlRefPointer< T > & operator=(QQmlRefPointer< T > &&o) noexcept
friend size_t qHash(const QQmlRefPointer &v, size_t seed=0) noexcept
QQmlRefPointer< T > & adopt(T *)
Takes ownership of other.
friend bool operator!=(const QQmlRefPointer &a, const QQmlRefPointer &b) noexcept
friend bool operator==(const QQmlRefPointer &a, const QQmlRefPointer &b) noexcept
Q_NODISCARD_CTOR QQmlRefPointer() noexcept
QQmlRefPointer< T > makeRefPointer(Args &&... args)
Combined button and popup list for selecting options.
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLboolean GLboolean GLboolean GLboolean a
[7]
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
constexpr void qt_ptr_swap(T *&lhs, T *&rhs) noexcept
#define Q_DECLARE_TYPEINFO_BODY(TYPE, FLAGS)