Qt 4.8
Public Functions | Private Functions | Properties | Friends | List of all members
QBitRef Class Reference

The QBitRef class is an internal class, used with QBitArray. More...

#include <qbitarray.h>

Public Functions

 operator bool () const
 Returns the value referenced by the QBitRef. More...
 
bool operator! () const
 
QBitRefoperator= (const QBitRef &val)
 Sets the value referenced by the QBitRef to that referenced by QBitRef v. More...
 
QBitRefoperator= (bool val)
 Sets the value referenced by the QBitRef to v. More...
 

Private Functions

 QBitRef (QBitArray &array, int idx)
 Constructs a reference to element i in the QBitArray a. More...
 

Properties

QBitArraya
 
int i
 

Friends

class QBitArray
 

Detailed Description

The QBitRef class is an internal class, used with QBitArray.

Note
This class or function is reentrant.
Warning
This function is not part of the public interface.

The QBitRef is required by the indexing [] operator on bit arrays. It is not for use in any other context.

Definition at line 148 of file qbitarray.h.

Constructors and Destructors

◆ QBitRef()

QBitRef::QBitRef ( QBitArray a,
int  i 
)
inlineprivate

Constructs a reference to element i in the QBitArray a.

This is what QBitArray::operator[] constructs its return value with.

Definition at line 153 of file qbitarray.h.

153 : a(array), i(idx) {}
int i
Definition: qbitarray.h:152
QBitArray & a
Definition: qbitarray.h:151

Functions

◆ operator bool()

QBitRef::operator bool ( ) const
inline

Returns the value referenced by the QBitRef.

Definition at line 156 of file qbitarray.h.

156 { return a.testBit(i); }
int i
Definition: qbitarray.h:152
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Definition: qbitarray.h:124
QBitArray & a
Definition: qbitarray.h:151

◆ operator!()

bool QBitRef::operator! ( ) const
inline
Warning
This function is not part of the public interface.

Definition at line 157 of file qbitarray.h.

157 { return !a.testBit(i); }
int i
Definition: qbitarray.h:152
bool testBit(int i) const
Returns true if the bit at index position i is 1; otherwise returns false.
Definition: qbitarray.h:124
QBitArray & a
Definition: qbitarray.h:151

◆ operator=() [1/2]

QBitRef & QBitRef::operator= ( const QBitRef val)
inline

Sets the value referenced by the QBitRef to that referenced by QBitRef v.

Definition at line 158 of file qbitarray.h.

158 { a.setBit(i, val); return *this; }
void setBit(int i)
Sets the bit at index position i to 1.
Definition: qbitarray.h:128
int i
Definition: qbitarray.h:152
QBitArray & a
Definition: qbitarray.h:151

◆ operator=() [2/2]

QBitRef & QBitRef::operator= ( bool  v)
inline

Sets the value referenced by the QBitRef to v.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 159 of file qbitarray.h.

159 { a.setBit(i, val); return *this; }
void setBit(int i)
Sets the bit at index position i to 1.
Definition: qbitarray.h:128
int i
Definition: qbitarray.h:152
QBitArray & a
Definition: qbitarray.h:151

Friends and Related Functions

◆ QBitArray

friend class QBitArray
friend

Definition at line 154 of file qbitarray.h.

Properties

◆ a

QBitArray& QBitRef::a
private

Definition at line 151 of file qbitarray.h.

◆ i

int QBitRef::i
private

Definition at line 152 of file qbitarray.h.


The documentation for this class was generated from the following files: