mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-19 11:09:22 +02:00
* Added sort method to TCollection
git-svn-id: trunk@12901 -
This commit is contained in:
parent
02bfd45775
commit
a43bda5052
@ -428,6 +428,7 @@ type
|
||||
|
||||
TCollectionItemClass = class of TCollectionItem;
|
||||
TCollectionNotification = (cnAdded, cnExtracting, cnDeleting);
|
||||
TCollectionSortCompare = function (Item1, Item2: TCollectionItem): Integer;
|
||||
|
||||
TCollection = class(TPersistent)
|
||||
private
|
||||
@ -467,6 +468,7 @@ type
|
||||
function GetNamePath: string; override;
|
||||
function Insert(Index: Integer): TCollectionItem;
|
||||
function FindItemID(ID: Integer): TCollectionItem;
|
||||
procedure Sort(Const Compare : TCollectionSortCompare);
|
||||
property Count: Integer read GetCount;
|
||||
property ItemClass: TCollectionItemClass read FItemClass;
|
||||
property Items[Index: Integer]: TCollectionItem read GetItem write SetItem;
|
||||
|
@ -329,6 +329,17 @@ procedure TCollection.Notify(Item: TCollectionItem;Action: TCollectionNotificati
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TCollection.Sort(Const Compare : TCollectionSortCompare);
|
||||
|
||||
begin
|
||||
BeginUpdate;
|
||||
try
|
||||
FItems.Sort(TListSortCompare(Compare));
|
||||
Finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************}
|
||||
{* TOwnedCollection *}
|
||||
|
Loading…
Reference in New Issue
Block a user