diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-11-10 09:42:13 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-11-12 12:24:29 +0100 |
commit | bdbc91cb90e9858cddc23da90ddd659262faa068 (patch) | |
tree | b166c2b9df84bf99393baa5bfacf14d25c469cb0 /src/qml/qml/ftw | |
parent | 21237e40565c1331aab531ae2c262fdc2c96fc53 (diff) |
Fix life cycle methods of various types related to QQmlBind
Code checker complains about the absence of move ctors and operators.
While we're at it, make ctors default where possible, do not use const
rvalue refs, add noexcept where possible, properly disable moving and
copying of QQmlBindEntryContent, and inline the null check of
QV4::PersistentValueStorage::free().
Change-Id: I11b6511f39f3d84479dbacee7f3e3552a5fb2b5a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/ftw')
-rw-r--r-- | src/qml/qml/ftw/qbipointer_p.h | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/src/qml/qml/ftw/qbipointer_p.h b/src/qml/qml/ftw/qbipointer_p.h index 009f371846..781b0a24d5 100644 --- a/src/qml/qml/ftw/qbipointer_p.h +++ b/src/qml/qml/ftw/qbipointer_p.h @@ -79,10 +79,15 @@ template <> struct QFlagPointerAlignment<void> template<typename T, typename T2> class QBiPointer { public: - inline QBiPointer(); + constexpr QBiPointer() noexcept = default; + ~QBiPointer() noexcept = default; + QBiPointer(const QBiPointer &o) noexcept = default; + QBiPointer(QBiPointer &&o) noexcept = default; + QBiPointer<T, T2> &operator=(const QBiPointer<T, T2> &o) noexcept = default; + QBiPointer<T, T2> &operator=(QBiPointer<T, T2> &&o) noexcept = default; + inline QBiPointer(T *); inline QBiPointer(T2 *); - inline QBiPointer(const QBiPointer<T, T2> &o); inline bool isNull() const; inline bool isT1() const; @@ -93,7 +98,6 @@ public: inline void clearFlag(); inline void setFlagValue(bool); - inline QBiPointer<T, T2> &operator=(const QBiPointer<T, T2> &o); inline QBiPointer<T, T2> &operator=(T *); inline QBiPointer<T, T2> &operator=(T2 *); @@ -112,7 +116,7 @@ public: return !(ptr1 == ptr2); } - friend inline void swap(QBiPointer<T, T2> ptr1, QBiPointer<T, T2> ptr2) + friend inline void swap(QBiPointer<T, T2> &ptr1, QBiPointer<T, T2> &ptr2) noexcept { qSwap(ptr1.ptr_value, ptr2.ptr_value); } @@ -129,11 +133,6 @@ private: }; template<typename T, typename T2> -QBiPointer<T, T2>::QBiPointer() -{ -} - -template<typename T, typename T2> QBiPointer<T, T2>::QBiPointer(T *v) : ptr_value(quintptr(v)) { @@ -152,12 +151,6 @@ QBiPointer<T, T2>::QBiPointer(T2 *v) } template<typename T, typename T2> -QBiPointer<T, T2>::QBiPointer(const QBiPointer<T, T2> &o) -: ptr_value(o.ptr_value) -{ -} - -template<typename T, typename T2> bool QBiPointer<T, T2>::isNull() const { return 0 == (ptr_value & (~FlagsMask)); @@ -201,13 +194,6 @@ void QBiPointer<T, T2>::setFlagValue(bool v) } template<typename T, typename T2> -QBiPointer<T, T2> &QBiPointer<T, T2>::operator=(const QBiPointer<T, T2> &o) -{ - ptr_value = o.ptr_value; - return *this; -} - -template<typename T, typename T2> QBiPointer<T, T2> &QBiPointer<T, T2>::operator=(T *o) { Q_ASSERT((quintptr(o) & FlagsMask) == 0); |