QBitArray: move a few methods more into the class body

This reduces the size of the header. I renamed the arguments for fill()
because "size" would shadow a member function.

Change-Id: I85b3fc2dd45c4693be13fffd1795b706b92e0965
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
bb10
Thiago Macieira 2023-11-08 09:47:53 -08:00
parent b3958d26ca
commit 6bd2358105
1 changed files with 4 additions and 7 deletions

View File

@ -69,9 +69,9 @@ public:
return cl;
}
bool at(qsizetype i) const;
bool at(qsizetype i) const { return testBit(i); }
QBitRef operator[](qsizetype i);
bool operator[](qsizetype i) const;
bool operator[](qsizetype i) const { return testBit(i); }
QBitArray &operator&=(const QBitArray &);
QBitArray &operator|=(const QBitArray &);
@ -81,7 +81,8 @@ public:
inline bool operator==(const QBitArray &other) const { return d == other.d; }
inline bool operator!=(const QBitArray &other) const { return d != other.d; }
inline bool fill(bool val, qsizetype size = -1);
bool fill(bool aval, qsizetype asize = -1)
{ *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; }
void fill(bool val, qsizetype first, qsizetype last);
inline void truncate(qsizetype pos) { if (pos < size()) resize(pos); }
@ -96,15 +97,11 @@ public:
inline DataPtr &data_ptr() { return d.data_ptr(); }
};
inline bool QBitArray::fill(bool aval, qsizetype asize)
{ *this = QBitArray((asize < 0 ? this->size() : asize), aval); return true; }
Q_CORE_EXPORT QBitArray operator&(const QBitArray &, const QBitArray &);
Q_CORE_EXPORT QBitArray operator|(const QBitArray &, const QBitArray &);
Q_CORE_EXPORT QBitArray operator^(const QBitArray &, const QBitArray &);
inline bool QBitArray::operator[](qsizetype i) const { return testBit(i); }
inline bool QBitArray::at(qsizetype i) const { return testBit(i); }
class Q_CORE_EXPORT QBitRef
{