initial commit
[rofl0r-KOL.git] / main_tlist.htm
blobe4abe58a8c47900bb837cdc9c89e0d2f44ff28f1
1 <html>
2 <head>
3 <title>KOL Help: TList 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>TList( 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 TList = object( <a href=tobj.htm target="_top">TObj</a> )
14 </b></p>
15 Simple list of pointers. It is used in KOL instead of standard VCL
16 TList to store any kind data (or pointers to these ones). Can be created
17 calling function <a href=kol_pas.htm#newlist target="_top">NewList</a>.
18 <h3 align="center"><font color="#FF8080">TList properties</font></h3>
19 <a name="count"></a>
20 <p>
21 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Count</b></font>: <b>Integer</b>;</font>
22 <br>
23 Returns count of items in the list. It is possible to delete a number
24 of items at the end of the list, keeping only first Count items alive,
25 assigning new value to Count property (less then Count it is).
26 </p>
27 <a name="capacity"></a>
28 <p>
29 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Capacity</b></font>: <b>Integer</b>;</font>
30 <br>
31 Returns number of pointers which could be stored in the list
32 without reallocating of memory. It is possible change this value
33 for optimize usage of the list (for minimize number of reallocating
34 memory operations).
35 </p>
36 <a name="items"></a>
37 <p>
38 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>Items</b></font>[ Idx: <b>Integer</b> ]: <b>Pointer</b>; <b>default</b>;</font>
39 <br>
40 Provides access (read and write) to items of the list. Please note,
41 that TList is not responsible for freeing memory, referenced by stored
42 pointers.
43 </p>
44 <a name="addby"></a>
45 <p>
46 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>AddBy</b></font>: <b>Integer</b>;</font>
47 <br>
48 Value to increment capacity when new items are added or inserted
49 and capacity need to be increased.
50 </p>
51 <a name="datamemory"></a>
52 <p>
53 <font face="Courier" color="#800080"><b>property</b> <font color="#808000"><b>DataMemory</b></font>: PPointerList;</font>
54 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#209;</font>&nbsp;&nbsp;&nbsp;
55 <br>
56 Raw data memory. Can be used for direct access to items of a list.
57 </p>
58 <h4 align="center"><font color="black">Properties, inherited from <a href="tobj.htm" target="_top">TObj</a></font></h4>
59 <h3 align="center"><font color="#FF8080">TList methods</font></h3>
60 <a name="destroy"></a>
61 <p>
62 <font face="Courier" color="#800080"><b>destructor</b> <font color="#808000"><b>Destroy</b></font>; <b>virtual</b>;</font>
63 &nbsp;&nbsp;&nbsp;<font face="Webdings" size=7>&#78;</font>&nbsp;&nbsp;&nbsp;
64 <br>
65 Destroys list, freeing memory, allocated for pointers. Programmer
66 is resposible for destroying of data, referenced by the pointers.
67 </p>
68 <a name="clear"></a>
69 <p>
70 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Clear</b></font>;</font>
71 <br>
72 Makes <a href=#count target="main">Count</a> equal to 0. Not responsible for freeing (or destroying)
73 data, referenced by released pointers.
74 </p>
75 <a name="add"></a>
76 <p>
77 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Add</b></font>( Value: <b>Pointer</b> );</font>
78 <br>
79 Adds pointer to the end of list, increasing <a href=#count target="main">Count</a> by one.
80 </p>
81 <a name="insert"></a>
82 <p>
83 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Insert</b></font>( Idx: <b>Integer</b>; Value: <b>Pointer</b> );</font>
84 <br>
85 Inserts pointer before given item. Returns Idx, i.e. index of
86 inserted item in the list. Indeces of items, located after insertion
87 point, are increasing. To add item to the end of list, pass <a href=#count target="main">Count</a>
88 as index parameter. To insert item before first item, pass 0 there.
89 </p>
90 <a name="indexof"></a>
91 <p>
92 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>IndexOf</b></font>( Value: <b>Pointer</b> ): <b>Integer</b>;</font>
93 <br>
94 Searches first (from start) item pointer with given value and returns
95 its index (zero-based) if found. If not found, returns -1.
96 </p>
97 <a name="delete"></a>
98 <p>
99 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Delete</b></font>( Idx: <b>Integer</b> );</font>
100 <br>
101 Deletes given (by index) pointer item from the list, shifting all
102 follow item indeces up by one.
103 </p>
104 <a name="deleterange"></a>
106 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>DeleteRange</b></font>( Idx, Len: <b>Integer</b> );</font>
107 <br>
108 Deletes Len items starting from Idx.
109 </p>
110 <a name="remove"></a>
112 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Remove</b></font>( Value: <b>Pointer</b> );</font>
113 <br>
114 Removes first entry of a Value in the list.
115 </p>
116 <a name="last"></a>
118 <font face="Courier" color="#800080"><b>function</b> <font color="#808000"><b>Last</b></font>: <b>Pointer</b>;</font>
119 <br>
120 Returns the last item (or nil, if the list is empty).
121 </p>
122 <a name="swap"></a>
124 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Swap</b></font>( Idx1, Idx2: <b>Integer</b> );</font>
125 <br>
126 Swaps two items in list directly (fast, but without testing of
127 index bounds).
128 </p>
129 <a name="moveitem"></a>
131 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>MoveItem</b></font>( OldIdx, NewIdx: <b>Integer</b> );</font>
132 <br>
133 Moves item to new position. Pass NewIdx &gt;= <a href=#count target="main">Count</a> to move item
134 after the last one.
135 </p>
136 <a name="release"></a>
138 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Release</b></font>;</font>
139 <br>
140 Especially for lists of pointers to dynamically allocated memory.
141 Releases all pointed memory blocks and destroys object itself.
142 </p>
143 <a name="releaseobjects"></a>
145 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>ReleaseObjects</b></font>;</font>
146 <br>
147 Especially for a list of objects derived from <a href=tobj.htm target="_top">TObj</a>.
148 Calls <a href=#free target="main">Free</a> for every of the object in the list, and then calls
149 <a href=#free target="main">Free</a> for the object itself.
150 </p>
151 <a name="assign"></a>
153 <font face="Courier" color="#800080"><b>procedure</b> <font color="#808000"><b>Assign</b></font>( SrcList: <a href=kol_pas.htm#plist target="_top">PList</a> );</font>
154 <br>
155 Copies all source list items.
156 </p>
157 <h4 align="center"><font color="black">Methods, inherited from <a href="tobj.htm" target="_top">TObj</a></font></h4>
158 <h3 align="center"><font color="#FF8080">TList events</font></h3>
159 <h4 align="center"><font color="black">Events, inherited from <a href="tobj.htm" target="_top">TObj</a></font></h4>
160 <h3 align="center"><font color="#FF8080">TList fields</font></h3>
161 <h4 align="center"><font color="black">Fields, inherited from <a href="tobj.htm" target="_top">TObj</a></font></h4>
162 <hr>
163 <p align="center">[&nbsp;<a href=index.htm>Index</a>&nbsp;]</p>
164 <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>
165 </body>
166 </html>