3 <title>KOL Help: TBits object (main frame)
</title>
7 <body bgcolor=
"#FFFFEF" text=
"#000000" link=
"#008080" vlink=
"#008000" alink=
"#808000">
8 <p><font face=
"Courier" color=
"#800080"><b>TBits( unit
<a href=kol_pas.htm
>KOL.pas
</a> )
9 <font face=
"Wingdings">ï
</font> <a href=tobj.htm
>TObj
</a>
10 <font face=
"Wingdings">ï
</font> <a href=_tobj.htm
>_TObj
</a>
13 TBits = object(
<a href=tobj.htm
target=
"_top">TObj
</a> )
15 Variable-length bits array object. Created using function
<a href=kol_pas.htm#newbits
target=
"_top">NewBits
</a>. See also
16 <a href=
"kol_pas.htm#Small bit arrays (max 32 bits in array)">
17 Small bit arrays (max
32 bits in array)
19 <h3 align=
"center"><font color=
"#FF8080">TBits properties
</font></h3>
22 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Bits
</b></font>[ Idx:
<b>Integer
</b> ]:
<b>Boolean
</b>;
</font>
27 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Size
</b></font>:
<b>Integer
</b>;
</font>
28 <font face=
"Webdings" size=
7>Ñ</font>
30 Size in bytes of the array. To get know number of bits, use property
<a href=#count
target=
"main">Count
</a>.
34 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Count
</b></font>:
<b>Integer
</b>;
</font>
35 <font face=
"Webdings" size=
7>Ñ</font>
37 Number of bits an the array.
39 <a name=
"capacity"></a>
41 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Capacity
</b></font>:
<b>Integer
</b>;
</font>
43 Number of bytes allocated. Can be set before assigning bit values
44 to improve performance (minimizing amount of memory allocation
47 <h4 align=
"center"><font color=
"black">Properties, inherited from
<a href=
"tobj.htm" target=
"_top">TObj
</a></font></h4>
48 <h3 align=
"center"><font color=
"#FF8080">TBits methods
</font></h3>
49 <a name=
"destroy"></a>
51 <font face=
"Courier" color=
"#800080"><b>destructor
</b> <font color=
"#808000"><b>Destroy
</b></font>;
<b>virtual
</b>;
</font>
56 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>Copy
</b></font>( From, BitsCount:
<b>Integer
</b> ): PBits;
</font>
58 Use this property to get a sub-range of bits starting from given bit
59 and of BitsCount bits count.
61 <a name=
"indexof"></a>
63 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>IndexOf
</b></font>( Value:
<b>Boolean
</b> ):
<b>Integer
</b>;
</font>
65 Returns index of first bit with given value (True or False).
67 <a name=
"openbit"></a>
69 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>OpenBit
</b></font>:
<b>Integer
</b>;
</font>
71 Returns index of the first bit not set to true.
75 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Clear
</b></font>;
</font>
77 Clears bits array.
<a href=#count
target=
"main">Count
</a>,
<a href=#size
target=
"main">Size
</a> and
<a href=#capacity
target=
"main">Capacity
</a> become
0.
79 <a name=
"loadfromstream"></a>
81 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>LoadFromStream
</b></font>( strm: PStream ):
<b>Integer
</b>;
</font>
83 Loads bits from the stream. Data should be stored in the stream
84 earlier using
<a href=#savetostream
target=
"main">SaveToStream
</a> method. While loading, previous bits
85 data are discarded and replaced with new one totally. In part,
86 <a href=#count
target=
"main">Count
</a> of bits also is changed.
<a href=#count
target=
"main">Count
</a> of bytes read from the stream
87 while loading data is returned.
89 <a name=
"savetostream"></a>
91 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>SaveToStream
</b></font>( strm: PStream ):
<b>Integer
</b>;
</font>
93 Saves entire array of bits to the stream. First,
<a href=#count
target=
"main">Count
</a> of bits
94 in the array is saved, then all bytes containing bits data.
98 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>Range
</b></font>( Idx, N:
<b>Integer
</b> ): PBits;
</font>
100 Creates and returns new TBits object instance containing N bits
101 starting from index Idx. If you call this method, you are responsible
102 for destroying returned object when it become not neccessary.
104 <a name=
"assignbits"></a>
106 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>AssignBits
</b></font>( ToIdx:
<b>Integer
</b>; FromBits: PBits; FromIdx, N:
<b>Integer
</b> );
</font>
108 Assigns bits from another bits array object. N bits are assigned
109 starting at index ToIdx.
111 <h4 align=
"center"><font color=
"black">Methods, inherited from
<a href=
"tobj.htm" target=
"_top">TObj
</a></font></h4>
112 <h3 align=
"center"><font color=
"#FF8080">TBits events
</font></h3>
113 <h4 align=
"center"><font color=
"black">Events, inherited from
<a href=
"tobj.htm" target=
"_top">TObj
</a></font></h4>
114 <h3 align=
"center"><font color=
"#FF8080">TBits fields
</font></h3>
115 <h4 align=
"center"><font color=
"black">Fields, inherited from
<a href=
"tobj.htm" target=
"_top">TObj
</a></font></h4>
117 <p align=
"center">[
<a href=index.htm
>Index
</a> ]
</p>
118 <p align=
"center"><font face=
"Comic Sans MS"><small>This help is generated
22-Sep-
2005 by KOL Help generator, (C)
2000-
2001 by Vladimir Kladov
<br>Modified (C)
2003 by Alexander Bartov
</small></font></p>