summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qendian_p.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-07 10:19:03 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-07-09 09:00:16 +0000
commit6be94e8f6d95091944e1a752362eb92e566de390 (patch)
treed0657e8d8422c864086d018a6675b85a4390bca0 /src/corelib/global/qendian_p.h
parent74fc88f6387b16064289962d72d85f34de8df189 (diff)
Move endian-specific integer types to public qtendian header
The classes have recently been cleaned up to be ready for being made public, and this change adds the final documentation. The classes are already used in qjson, qtdeclarative and some image format decoders. Change-Id: Ib6df89f1119162c5bad7a08e9b6f843a2db4040f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qendian_p.h')
-rw-r--r--src/corelib/global/qendian_p.h81
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.