TStrListEx( unit KOL.pas ) ï TStrList ï TObj ï _TObj
TStrListEx = object( TStrList )
Extended string list object. Has additional capability to associate numbers or objects with string list items.
property Objects[ Idx: Integer ]: DWORD;
Objects are just 32-bit values. You can treat and use it as pointers to
any other data in the memory. But it is your task to free allocated
memory in such case therefore.
If the last item of a string list is deleted vis DeleteLast method (but
not via Delete method), it's object still is preserved. As well, it is
possible to set Objects[idx] for idx >= Count.
To get know object's count, rather then strings count, use ObjectCount
property.
property ObjectCount: Integer;
Ñ
Returns number of objects available. This value can differ from Count
after some operations: objects are stored in the independant list and
only synchronization is provided while using methods Delete, Insert,
Add, AddObject, InsertObject while changing the list.
destructor Destroy; virtual;
procedure AddStrings( Strings: PStrListEx );
Merges string list with given one. Very fast - more preferrable to
use than any loop with calling Add method.
procedure Assign( Strings: PStrListEx );
Fills string list with strings from other one. The same as AddStrings,
but Clear is called first.
procedure Clear;
Makes string list empty.
procedure Delete( Idx: integer );
Deletes string with given index (it *must* exist).
procedure DeleteLast;
Deletes the last string and correspondent object in the list.
procedure Move( CurIndex, NewIndex: integer );
Moves string to another location.
procedure Swap( Idx1, Idx2: Integer );
Swaps to strings with given indeces.
procedure Sort( CaseSensitive: Boolean );
Call it to sort string list.
procedure AnsiSort( CaseSensitive: Boolean );
Call it to sort ANSI string list.
function LastObj: DWORD;
Object assotiated with the last string.
function AddObject( const S: AnsiString; Obj: DWORD ): Integer;
Adds a string and associates given number with it. Index of the item added
is returned.
procedure InsertObject( Before: Integer; const S: AnsiString; Obj: DWORD );
Inserts a string together with object associated.
function IndexOfObj( Obj: Pointer ): Integer;
Returns an index of a string associated with the object passed as a
parameter. If there are no such strings, -1 is returned.
[ Index ]
This help is generated 14-Jun-2010 by KOL Help generator, (C) 2000-2001 by Vladimir Kladov
Modified (C) 2003 by Alexander Bartov