function NewBits: PBits;
Creates variable-length bits array object.
type
PBits = ^TBits;
TBits = object( TObj )
Variable-length bits array object. Created using function NewBits.
property Bits[ Idx: Integer ]: Boolean;
property Size: Integer;
Size in bytes of the array. To get know number of bits, use property Count.
property Count: Integer;
Number of bits an the array.
property Capacity: Integer;
Number of bytes allocated. Can be set before assigning bit values to improve performance (minimizing amount of memory allocation operations).
function Copy( From, BitsCount: Integer ): PBits;
Use this property to get a sub-range of bits starting from given bit and of BitsCount bits count.
function IndexOf( Value: Boolean ): Integer;
Returns index of first bit with given value (True or False).
function OpenBit: Integer;
Returns index of the first bit not set to true.
procedure Clear;
Clears bits array. Count, Size and Capacity become 0.
function LoadFromStream( strm: PStream ): Integer;
Loads bits from the stream. Data should be stored in the stream earlier using SaveToStream method. While loading, previous bits data are discarded and replaced with new one totally. In part, Count of bits also is changed. Count of bytes read from the stream while loading data is returned.
function SaveToStream( strm: PStream ): Integer;
Saves entire array of bits to the stream. First, Count of bits in the array is saved, then all bytes containing bits data.
function Range( Idx, N: Integer ): PBits;
Creates and returns new TBits object instance containing N bits starting from index Idx. If you call this method, you are responsible for destroying returned object when it become not necessary.
procedure AssignBits( ToIdx: Integer; FromBits: PBits; FromIdx, N: Integer );
Assigns bits from another bits array object. N bits are assigned starting at index ToIdx.
procedure InstallBits( FromIdx, N: Integer; Value: Boolean );
Sets new Value for all bits in range [ FromIdx, FromIdx+Count-1 ].
function CountTrueBits: Integer;
Returns count of bits equal to TRUE.