45 #include <QtCore/qbytearray.h> 63 explicit QBitArray(
int size,
bool val =
false);
66 #ifdef Q_COMPILER_RVALUE_REFS 68 {
qSwap(d, other.
d);
return *
this; }
75 int count(
bool on)
const;
81 void resize(
int size);
87 bool testBit(
int i)
const;
89 void setBit(
int i,
bool val);
91 bool toggleBit(
int i);
95 bool operator[](
int i)
const;
97 bool operator[](
uint i)
const;
107 inline bool fill(
bool val,
int size = -1);
108 void fill(
bool val,
int first,
int last);
110 inline void truncate(
int pos) {
if (pos < size()) resize(pos); }
118 { *
this =
QBitArray((asize < 0 ? this->size() : asize), aval);
return true; }
126 return (*(reinterpret_cast<const uchar*>(
d.constData())+1+(i>>3)) & (1 << (i & 7))) != 0; }
130 *(
reinterpret_cast<uchar*
>(
d.data())+1+(i>>3)) |=
uchar(1 << (i & 7)); }
134 *(
reinterpret_cast<uchar*
>(
d.data())+1+(i>>3)) &= ~
uchar(1 << (i & 7)); }
137 {
if (val) setBit(i);
else clearBit(i); }
156 inline operator bool()
const {
return a.
testBit(i); }
168 #ifndef QT_NO_DATASTREAM 180 #endif // QBITARRAY_H void clear()
Clears the contents of the bit array and makes it empty.
QBitArray()
Constructs an empty bit array.
uint qHash(const QProcEnvKey &key)
QBitRef & operator=(const QBitRef &val)
Sets the value referenced by the QBitRef to that referenced by QBitRef v.
void setBit(int i)
Sets the bit at index position i to 1.
#define QT_END_NAMESPACE
This macro expands to.
#define at(className, varName)
The QByteArray class provides an array of bytes.
QBitRef(QBitArray &array, int idx)
Constructs a reference to element i in the QBitArray a.
QBitArray(const QBitArray &other)
Constructs a copy of other.
bool isNull() const
Returns true if this bit array is null; otherwise returns false.
long ASN1_INTEGER_get ASN1_INTEGER * a
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Q_DECLARE_TYPEINFO(QBitArray, Q_MOVABLE_TYPE)
#define Q_DECLARE_SHARED(TYPE)
Q_CORE_EXPORT QBitArray operator^(const QBitArray &, const QBitArray &)
bool fill(bool val, int size=-1)
Sets every bit in the bit array to value, returning true if successful; otherwise returns false...
#define QT_BEGIN_NAMESPACE
This macro expands to.
QBitRef & operator=(bool val)
Sets the value referenced by the QBitRef to v.
bool operator!=(const QBitArray &a) const
Returns true if other is not equal to this bit array; otherwise returns false.
bool toggleBit(int i)
Inverts the value of the bit at index position i, returning the previous value of that bit as either ...
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &, const QBitArray &)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QBitArray &)
bool isNull() const
Returns true if this byte array is null; otherwise returns false.
void swap(QBitArray &other)
Swaps bit array other with this bit array.
void qSwap(T &value1, T &value2)
The QBitArray class provides an array of bits.
const char * constData() const
Returns a pointer to the data stored in the byte array.
The QBitRef class is an internal class, used with QBitArray.
QByteArray::DataPtr DataPtr
bool operator==(const QBitArray &a) const
Returns true if other is equal to this bit array; otherwise returns false.
Q_CORE_EXPORT QBitArray operator &(const QBitArray &, const QBitArray &)
void truncate(int pos)
Truncates the bit array at index position pos.
int count() const
Same as size().
int size() const
Returns the number of bytes in this byte array.
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QBitRef operator[](int i)
Returns the bit at index position i as a modifiable reference.
The QDataStream class provides serialization of binary data to a QIODevice.
Q_CORE_EXPORT QBitArray operator|(const QBitArray &, const QBitArray &)
bool at(int i) const
Returns the value of the bit at index position i.
int size() const
Returns the number of bits stored in the bit array.
void clearBit(int i)
Sets the bit at index position i to 0.
QBitArray & operator=(const QBitArray &other)
Assigns other to this bit array and returns a reference to this bit array.
bool isEmpty() const
Returns true if this bit array has size 0; otherwise returns false.
void clear()
Clears the contents of the byte array and makes it empty.