2
0
Эх сурвалжийг харах

+ added .Sort() overloads with a SortingAlgorithm parameter to TFPGList,
TFPGObjectList, TFPGInterfacedObjectList and TFPSMap

git-svn-id: trunk@41196 -

nickysn 6 жил өмнө
parent
commit
1d7ff66602
1 өөрчлөгдсөн 27 нэмэгдсэн , 0 устгасан
  1. 27 0
      rtl/objpas/fgl.pp

+ 27 - 0
rtl/objpas/fgl.pp

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