3 <title>KOL Help: TList object (main frame)
</title>
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>
13 TList = object(
<a href=tobj.htm
target=
"_top">TObj
</a> )
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>
21 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Count
</b></font>:
<b>Integer
</b>;
</font>
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).
27 <a name=
"capacity"></a>
29 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>Capacity
</b></font>:
<b>Integer
</b>;
</font>
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
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>
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
46 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>AddBy
</b></font>:
<b>Integer
</b>;
</font>
48 Value to increment capacity when new items are added or inserted
49 and capacity need to be increased.
51 <a name=
"datamemory"></a>
53 <font face=
"Courier" color=
"#800080"><b>property
</b> <font color=
"#808000"><b>DataMemory
</b></font>: PPointerList;
</font>
54 <font face=
"Webdings" size=
7>Ñ</font>
56 Raw data memory. Can be used for direct access to items of a list.
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>
62 <font face=
"Courier" color=
"#800080"><b>destructor
</b> <font color=
"#808000"><b>Destroy
</b></font>;
<b>virtual
</b>;
</font>
63 <font face=
"Webdings" size=
7>N</font>
65 Destroys list, freeing memory, allocated for pointers. Programmer
66 is resposible for destroying of data, referenced by the pointers.
70 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Clear
</b></font>;
</font>
72 Makes
<a href=#count
target=
"main">Count
</a> equal to
0. Not responsible for freeing (or destroying)
73 data, referenced by released pointers.
77 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Add
</b></font>( Value:
<b>Pointer
</b> );
</font>
79 Adds pointer to the end of list, increasing
<a href=#count
target=
"main">Count
</a> by one.
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>
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.
90 <a name=
"indexof"></a>
92 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>IndexOf
</b></font>( Value:
<b>Pointer
</b> ):
<b>Integer
</b>;
</font>
94 Searches first (from start) item pointer with given value and returns
95 its index (zero-based) if found. If not found, returns -
1.
99 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Delete
</b></font>( Idx:
<b>Integer
</b> );
</font>
101 Deletes given (by index) pointer item from the list, shifting all
102 follow item indeces up by one.
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>
108 Deletes Len items starting from Idx.
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>
114 Removes first entry of a Value in the list.
118 <font face=
"Courier" color=
"#800080"><b>function
</b> <font color=
"#808000"><b>Last
</b></font>:
<b>Pointer
</b>;
</font>
120 Returns the last item (or nil, if the list is empty).
124 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Swap
</b></font>( Idx1, Idx2:
<b>Integer
</b> );
</font>
126 Swaps two items in list directly (fast, but without testing of
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>
133 Moves item to new position. Pass NewIdx
>=
<a href=#count
target=
"main">Count
</a> to move item
136 <a name=
"release"></a>
138 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>Release
</b></font>;
</font>
140 Especially for lists of pointers to dynamically allocated memory.
141 Releases all pointed memory blocks and destroys object itself.
143 <a name=
"releaseobjects"></a>
145 <font face=
"Courier" color=
"#800080"><b>procedure
</b> <font color=
"#808000"><b>ReleaseObjects
</b></font>;
</font>
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.
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>
155 Copies all source list items.
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>
163 <p align=
"center">[
<a href=index.htm
>Index
</a> ]
</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>