diff options
Diffstat (limited to 'src/corelib/global/qendian_p.h')
-rw-r--r-- | src/corelib/global/qendian_p.h | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/src/corelib/global/qendian_p.h b/src/corelib/global/qendian_p.h index 42d91cf735..c830e65b54 100644 --- a/src/corelib/global/qendian_p.h +++ b/src/corelib/global/qendian_p.h @@ -55,87 +55,6 @@ QT_BEGIN_NAMESPACE -template<class S> -class QSpecialInteger -{ - typedef typename S::StorageType T; - T val; -public: - QSpecialInteger() = default; - explicit Q_DECL_CONSTEXPR QSpecialInteger(T i) : val(S::toSpecial(i)) {} - - QSpecialInteger &operator =(T i) { val = S::toSpecial(i); return *this; } - operator T() const { return S::fromSpecial(val); } - - bool operator ==(QSpecialInteger<S> i) const { return val == i.val; } - bool operator !=(QSpecialInteger<S> i) const { return val != i.val; } - - QSpecialInteger &operator +=(T i) - { return (*this = S::fromSpecial(val) + i); } - QSpecialInteger &operator -=(T i) - { return (*this = S::fromSpecial(val) - i); } - QSpecialInteger &operator *=(T i) - { return (*this = S::fromSpecial(val) * i); } - QSpecialInteger &operator >>=(T i) - { return (*this = S::fromSpecial(val) >> i); } - QSpecialInteger &operator <<=(T i) - { return (*this = S::fromSpecial(val) << i); } - QSpecialInteger &operator /=(T i) - { return (*this = S::fromSpecial(val) / i); } - QSpecialInteger &operator %=(T i) - { return (*this = S::fromSpecial(val) % i); } - QSpecialInteger &operator |=(T i) - { return (*this = S::fromSpecial(val) | i); } - QSpecialInteger &operator &=(T i) - { return (*this = S::fromSpecial(val) & i); } - QSpecialInteger &operator ^=(T i) - { return (*this = S::fromSpecial(val) ^ i); } -}; - -template<typename T> -class QLittleEndianStorageType { -public: - typedef T StorageType; - static Q_DECL_CONSTEXPR T toSpecial(T source) { return qToLittleEndian(source); } - static Q_DECL_CONSTEXPR T fromSpecial(T source) { return qFromLittleEndian(source); } -}; - -template<typename T> -class QBigEndianStorageType { -public: - typedef T StorageType; - static Q_DECL_CONSTEXPR T toSpecial(T source) { return qToBigEndian(source); } - static Q_DECL_CONSTEXPR T fromSpecial(T source) { return qFromBigEndian(source); } -}; - -template<typename T> -using QLEInteger = QSpecialInteger<QLittleEndianStorageType<T>>; - -template<typename T> -using QBEInteger = QSpecialInteger<QBigEndianStorageType<T>>; - -template <typename T> -class QTypeInfo<QLEInteger<T> > - : public QTypeInfoMerger<QLEInteger<T>, T> {}; - -template <typename T> -class QTypeInfo<QBEInteger<T> > - : public QTypeInfoMerger<QBEInteger<T>, T> {}; - -typedef QLEInteger<qint16> qint16_le; -typedef QLEInteger<qint32> qint32_le; -typedef QLEInteger<qint64> qint64_le; -typedef QLEInteger<quint16> quint16_le; -typedef QLEInteger<quint32> quint32_le; -typedef QLEInteger<quint64> quint64_le; - -typedef QBEInteger<qint16> qint16_be; -typedef QBEInteger<qint32> qint32_be; -typedef QBEInteger<qint64> qint64_be; -typedef QBEInteger<quint16> quint16_be; -typedef QBEInteger<quint32> quint32_be; -typedef QBEInteger<quint64> quint64_be; - // Note if using multiple of these bitfields in a union; the underlying storage type must // match. Since we always use an unsigned storage type, unsigned and signed versions may // be used together, but different bit-widths may not. |