mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-30 21:39:18 +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;
|
TCollectionItemClass = class of TCollectionItem;
|
||||||
TCollectionNotification = (cnAdded, cnExtracting, cnDeleting);
|
TCollectionNotification = (cnAdded, cnExtracting, cnDeleting);
|
||||||
|
TCollectionSortCompare = function (Item1, Item2: TCollectionItem): Integer;
|
||||||
|
|
||||||
TCollection = class(TPersistent)
|
TCollection = class(TPersistent)
|
||||||
private
|
private
|
||||||
@ -467,6 +468,7 @@ type
|
|||||||
function GetNamePath: string; override;
|
function GetNamePath: string; override;
|
||||||
function Insert(Index: Integer): TCollectionItem;
|
function Insert(Index: Integer): TCollectionItem;
|
||||||
function FindItemID(ID: Integer): TCollectionItem;
|
function FindItemID(ID: Integer): TCollectionItem;
|
||||||
|
procedure Sort(Const Compare : TCollectionSortCompare);
|
||||||
property Count: Integer read GetCount;
|
property Count: Integer read GetCount;
|
||||||
property ItemClass: TCollectionItemClass read FItemClass;
|
property ItemClass: TCollectionItemClass read FItemClass;
|
||||||
property Items[Index: Integer]: TCollectionItem read GetItem write SetItem;
|
property Items[Index: Integer]: TCollectionItem read GetItem write SetItem;
|
||||||
|
@ -329,6 +329,17 @@ procedure TCollection.Notify(Item: TCollectionItem;Action: TCollectionNotificati
|
|||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCollection.Sort(Const Compare : TCollectionSortCompare);
|
||||||
|
|
||||||
|
begin
|
||||||
|
BeginUpdate;
|
||||||
|
try
|
||||||
|
FItems.Sort(TListSortCompare(Compare));
|
||||||
|
Finally
|
||||||
|
EndUpdate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{****************************************************************************}
|
{****************************************************************************}
|
||||||
{* TOwnedCollection *}
|
{* TOwnedCollection *}
|
||||||
|
Loading…
Reference in New Issue
Block a user