initial commit
[rofl0r-KOL.git] / main_tbits.htm
blobcc3dd26a7516e10f0a7380cb0009358d19df3105
1 <html>
2 <head>
3 <title>KOL Help: TBits object (main frame)</title>
4 <base target="_top">
5 </head>
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>
11 </b></font></p>
12 <p><b>
13 TBits = object( <a href=tobj.htm target="_top">TObj</a> )
14 </b></p>
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)
18 </a>.
19 <h3 align="center"><font color="#FF8080">TBits properties</font></h3>
20 <a name="bits"></a>
21 <p>
22 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Bits</b></font>[ Idx: <b>Integer</b> ]: <b>Boolean</b>;</font>
23 <br>
24 </p>
25 <a name="size"></a>
26 <p>
27 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Size</b></font>: <b>Integer</b>;</font>
28 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#209;</font>&nbsp;&nbsp;&nbsp;
29 <br>
30 Size in bytes of the array. To get know number of bits, use property <a href=#count target="main">Count</a>.
31 </p>
32 <a name="count"></a>
33 <p>
34 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Count</b></font>: <b>Integer</b>;</font>
35 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#209;</font>&nbsp;&nbsp;&nbsp;
36 <br>
37 Number of bits an the array.
38 </p>
39 <a name="capacity"></a>
40 <p>
41 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Capacity</b></font>: <b>Integer</b>;</font>
42 <br>
43 Number of bytes allocated. Can be set before assigning bit values
44 to improve performance (minimizing amount of memory allocation
45 operations).
46 </p>
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>
50 <p>
51 <font face="Courier" color="#800080"><b>destructor</b> <font color="#808000"><b>Destroy</b></font>; <b>virtual</b>;</font>
52 <br>
53 </p>
54 <a name="copy"></a>
55 <p>
56 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>Copy</b></font>( From, BitsCount: <b>Integer</b> ): PBits;</font>
57 <br>
58 Use this property to get a sub-range of bits starting from given bit
59 and of BitsCount bits count.
60 </p>
61 <a name="indexof"></a>
62 <p>
63 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>IndexOf</b></font>( Value: <b>Boolean</b> ): <b>Integer</b>;</font>
64 <br>
65 Returns index of first bit with given value (True or False).
66 </p>
67 <a name="openbit"></a>
68 <p>
69 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>OpenBit</b></font>: <b>Integer</b>;</font>
70 <br>
71 Returns index of the first bit not set to true.
72 </p>
73 <a name="clear"></a>
74 <p>
75 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Clear</b></font>;</font>
76 <br>
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.
78 </p>
79 <a name="loadfromstream"></a>
80 <p>
81 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>LoadFromStream</b></font>( strm: PStream ): <b>Integer</b>;</font>
82 <br>
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.
88 </p>
89 <a name="savetostream"></a>
90 <p>
91 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>SaveToStream</b></font>( strm: PStream ): <b>Integer</b>;</font>
92 <br>
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.
95 </p>
96 <a name="range"></a>
97 <p>
98 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>Range</b></font>( Idx, N: <b>Integer</b> ): PBits;</font>
99 <br>
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.
103 </p>
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>
107 <br>
108 Assigns bits from another bits array object. N bits are assigned
109 starting at index ToIdx.
110 </p>
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>
116 <hr>
117 <p align="center">[&nbsp;<a href=index.htm>Index</a>&nbsp;]</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>
119 </body>
120 </html>