+ added .Sort() overloads with a SortingAlgorithm parameter to TFPGList,

TFPGObjectList, TFPGInterfacedObjectList and TFPSMap

git-svn-id: trunk@41196 -
This commit is contained in:
nickysn 2019-02-03 19:49:35 +00:00
parent 5c4af27a7a
commit 1d7ff66602

View File

@ -150,6 +150,7 @@ type
{$endif VER2_4} {$endif VER2_4}
function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif} function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
procedure Sort(Compare: TCompareFunc); procedure Sort(Compare: TCompareFunc);
procedure Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
property Items[Index: Integer]: T read Get write Put; default; property Items[Index: Integer]: T read Get write Put; default;
property List: PTypeList read GetList; property List: PTypeList read GetList;
end; end;
@ -190,6 +191,7 @@ type
{$endif VER2_4} {$endif VER2_4}
function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif} function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
procedure Sort(Compare: TCompareFunc); procedure Sort(Compare: TCompareFunc);
procedure Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
property Items[Index: Integer]: T read Get write Put; default; property Items[Index: Integer]: T read Get write Put; default;
property List: PTypeList read GetList; property List: PTypeList read GetList;
property FreeObjects: Boolean read FFreeObjects write FFreeObjects; property FreeObjects: Boolean read FFreeObjects write FFreeObjects;
@ -230,6 +232,7 @@ type
{$endif VER2_4} {$endif VER2_4}
function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif} function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
procedure Sort(Compare: TCompareFunc); procedure Sort(Compare: TCompareFunc);
procedure Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
property Items[Index: Integer]: T read Get write Put; default; property Items[Index: Integer]: T read Get write Put; default;
property List: PTypeList read GetList; property List: PTypeList read GetList;
end; end;
@ -272,6 +275,7 @@ type
procedure InsertKeyData(Index: Integer; AKey, AData: Pointer); procedure InsertKeyData(Index: Integer; AKey, AData: Pointer);
function Remove(AKey: Pointer): Integer; function Remove(AKey: Pointer): Integer;
procedure Sort; procedure Sort;
procedure Sort(SortingAlgorithm: PSortingAlgorithm);
property Duplicates: TDuplicates read FDuplicates write FDuplicates; property Duplicates: TDuplicates read FDuplicates write FDuplicates;
property KeySize: Integer read FKeySize; property KeySize: Integer read FKeySize;
property DataSize: Integer read FDataSize; property DataSize: Integer read FDataSize;
@ -996,6 +1000,12 @@ begin
inherited Sort(@ItemPtrCompare); inherited Sort(@ItemPtrCompare);
end; end;
procedure TFPGList.Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
begin
FOnCompare := Compare;
inherited Sort(@ItemPtrCompare, SortingAlgorithm);
end;
{****************************************************************************} {****************************************************************************}
{* TFPGObjectList *} {* TFPGObjectList *}
@ -1117,6 +1127,12 @@ begin
inherited Sort(@ItemPtrCompare); inherited Sort(@ItemPtrCompare);
end; end;
procedure TFPGObjectList.Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
begin
FOnCompare := Compare;
inherited Sort(@ItemPtrCompare, SortingAlgorithm);
end;
{****************************************************************************} {****************************************************************************}
{* TFPGInterfacedObjectList *} {* TFPGInterfacedObjectList *}
@ -1242,6 +1258,12 @@ begin
inherited Sort(@ItemPtrCompare); inherited Sort(@ItemPtrCompare);
end; end;
procedure TFPGInterfacedObjectList.Sort(Compare: TCompareFunc; SortingAlgorithm: PSortingAlgorithm);
begin
FOnCompare := Compare;
inherited Sort(@ItemPtrCompare, SortingAlgorithm);
end;
{**************************************************************************** {****************************************************************************
TFPSMap TFPSMap
****************************************************************************} ****************************************************************************}
@ -1476,6 +1498,11 @@ begin
inherited Sort(FOnKeyPtrCompare); inherited Sort(FOnKeyPtrCompare);
end; end;
procedure TFPSMap.Sort(SortingAlgorithm: PSortingAlgorithm);
begin
inherited Sort(FOnKeyPtrCompare, SortingAlgorithm);
end;
{**************************************************************************** {****************************************************************************
TFPGMap TFPGMap
****************************************************************************} ****************************************************************************}