diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/corelib/compat/removed_api.cpp | 1 | ||||
| -rw-r--r-- | src/corelib/tools/qbitarray.cpp | 10 | ||||
| -rw-r--r-- | src/corelib/tools/qbitarray.h | 13 |
3 files changed, 18 insertions, 6 deletions
diff --git a/src/corelib/compat/removed_api.cpp b/src/corelib/compat/removed_api.cpp index 9b7ad483842..c8cc969f819 100644 --- a/src/corelib/compat/removed_api.cpp +++ b/src/corelib/compat/removed_api.cpp @@ -929,6 +929,7 @@ QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode) #endif // QT_CORE_REMOVED_SINCE(6, 7) #if QT_CORE_REMOVED_SINCE(6, 8) +#include "qbitarray.h" // inlined API #include "qbytearray.h" // inlined API diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp index e311fee51f1..e4276d383d1 100644 --- a/src/corelib/tools/qbitarray.cpp +++ b/src/corelib/tools/qbitarray.cpp @@ -23,6 +23,8 @@ QT_BEGIN_NAMESPACE \ingroup shared \reentrant + \compares equality + A QBitArray is an array that gives access to individual bits and provides operators (\l{operator&()}{AND}, \l{operator|()}{OR}, \l{operator^()}{XOR}, and \l{operator~()}{NOT}) that work on @@ -499,17 +501,17 @@ quint32 QBitArray::toUInt32(QSysInfo::Endian endianness, bool *ok) const noexcep fast and never fails. */ -/*! \fn bool QBitArray::operator==(const QBitArray &other) const +/*! \fn bool QBitArray::operator==(const QBitArray &lhs, const QBitArray &rhs) - Returns \c true if \a other is equal to this bit array; otherwise + Returns \c true if \a lhs is equal to \a rhs bit array; otherwise returns \c false. \sa operator!=() */ -/*! \fn bool QBitArray::operator!=(const QBitArray &other) const +/*! \fn bool QBitArray::operator!=(const QBitArray &lhs, const QBitArray &rhs) - Returns \c true if \a other is not equal to this bit array; + Returns \c true if \a lhs is not equal to \a rhs bit array; otherwise returns \c false. \sa operator==() diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h index 4f99e693eb8..b9c36b5320b 100644 --- a/src/corelib/tools/qbitarray.h +++ b/src/corelib/tools/qbitarray.h @@ -116,8 +116,10 @@ public: QBitArray operator~() const; #endif - inline bool operator==(const QBitArray &other) const { return d == other.d; } - inline bool operator!=(const QBitArray &other) const { return d != other.d; } +#if QT_CORE_REMOVED_SINCE(6, 8) + inline bool operator==(const QBitArray &other) const { return comparesEqual(d, other.d); } + inline bool operator!=(const QBitArray &other) const { return !operator==(other); } +#endif bool fill(bool aval, qsizetype asize = -1) { *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; } @@ -134,6 +136,13 @@ public: typedef QByteArray::DataPointer DataPtr; inline DataPtr &data_ptr() { return d.data_ptr(); } inline const DataPtr &data_ptr() const { return d.data_ptr(); } + +private: + friend bool comparesEqual(const QBitArray &lhs, const QBitArray &rhs) noexcept + { + return lhs.d == rhs.d; + } + Q_DECLARE_EQUALITY_COMPARABLE(QBitArray) }; class QT6_ONLY(Q_CORE_EXPORT) QBitRef |
