diff options
Diffstat (limited to 'src/qml/qml/ftw/qflagpointer_p.h')
-rw-r--r-- | src/qml/qml/ftw/qflagpointer_p.h | 152 |
1 files changed, 0 insertions, 152 deletions
diff --git a/src/qml/qml/ftw/qflagpointer_p.h b/src/qml/qml/ftw/qflagpointer_p.h index a10e57aeca..5cdf973352 100644 --- a/src/qml/qml/ftw/qflagpointer_p.h +++ b/src/qml/qml/ftw/qflagpointer_p.h @@ -66,43 +66,6 @@ template <> struct QFlagPointerAlignment<void> }; } -template<typename T> -class QFlagPointer { -public: - inline QFlagPointer(); - inline QFlagPointer(T *); - inline QFlagPointer(const QFlagPointer<T> &o); - - inline bool isNull() const; - - inline bool flag() const; - inline void setFlag(); - inline void clearFlag(); - inline void setFlagValue(bool); - - inline bool flag2() const; - inline void setFlag2(); - inline void clearFlag2(); - inline void setFlag2Value(bool); - - inline QFlagPointer<T> &operator=(const QFlagPointer &o); - inline QFlagPointer<T> &operator=(T *); - - inline T *operator->() const; - inline T *operator*() const; - - inline T *data() const; - - inline explicit operator bool() const; - -private: - quintptr ptr_value = 0; - - static const quintptr FlagBit = 0x1; - static const quintptr Flag2Bit = 0x2; - static const quintptr FlagsMask = FlagBit | Flag2Bit; -}; - template<typename T, typename T2> class QBiPointer { public: @@ -135,121 +98,6 @@ private: static const quintptr FlagsMask = FlagBit | Flag2Bit; }; -template<typename T> -QFlagPointer<T>::QFlagPointer() -{ -} - -template<typename T> -QFlagPointer<T>::QFlagPointer(T *v) -: ptr_value(quintptr(v)) -{ - Q_STATIC_ASSERT_X(Q_ALIGNOF(T) >= 4, "Type T does not have sufficient alignment"); - Q_ASSERT((ptr_value & FlagsMask) == 0); -} - -template<typename T> -QFlagPointer<T>::QFlagPointer(const QFlagPointer<T> &o) -: ptr_value(o.ptr_value) -{ -} - -template<typename T> -bool QFlagPointer<T>::isNull() const -{ - return 0 == (ptr_value & (~FlagsMask)); -} - -template<typename T> -bool QFlagPointer<T>::flag() const -{ - return ptr_value & FlagBit; -} - -template<typename T> -void QFlagPointer<T>::setFlag() -{ - ptr_value |= FlagBit; -} - -template<typename T> -void QFlagPointer<T>::clearFlag() -{ - ptr_value &= ~FlagBit; -} - -template<typename T> -void QFlagPointer<T>::setFlagValue(bool v) -{ - if (v) setFlag(); - else clearFlag(); -} - -template<typename T> -bool QFlagPointer<T>::flag2() const -{ - return ptr_value & Flag2Bit; -} - -template<typename T> -void QFlagPointer<T>::setFlag2() -{ - ptr_value|= Flag2Bit; -} - -template<typename T> -void QFlagPointer<T>::clearFlag2() -{ - ptr_value &= ~Flag2Bit; -} - -template<typename T> -void QFlagPointer<T>::setFlag2Value(bool v) -{ - if (v) setFlag2(); - else clearFlag2(); -} - -template<typename T> -QFlagPointer<T> &QFlagPointer<T>::operator=(const QFlagPointer &o) -{ - ptr_value = o.ptr_value; - return *this; -} - -template<typename T> -QFlagPointer<T> &QFlagPointer<T>::operator=(T *o) -{ - Q_ASSERT((quintptr(o) & FlagsMask) == 0); - - ptr_value = quintptr(o) | (ptr_value & FlagsMask); - return *this; -} - -template<typename T> -T *QFlagPointer<T>::operator->() const -{ - return (T *)(ptr_value & ~FlagsMask); -} - -template<typename T> -T *QFlagPointer<T>::operator*() const -{ - return (T *)(ptr_value & ~FlagsMask); -} - -template<typename T> -T *QFlagPointer<T>::data() const -{ - return (T *)(ptr_value & ~FlagsMask); -} - -template<typename T> -QFlagPointer<T>::operator bool() const -{ - return data() != nullptr; -} - template<typename T, typename T2> QBiPointer<T, T2>::QBiPointer() { |