فهرست منبع

* CLASSESINLINE -> FGLINLINE
* inlining enabled

git-svn-id: trunk@35072 -

florian 8 سال پیش
والد
کامیت
55d9fea401
1فایلهای تغییر یافته به همراه78 افزوده شده و 74 حذف شده
  1. 78 74
      rtl/objpas/fgl.pp

+ 78 - 74
rtl/objpas/fgl.pp

@@ -15,9 +15,13 @@
  **********************************************************************}
 {$mode objfpc}
 
-{.$define CLASSESINLINE}
+{$define FGLINLINE}
 
 { be aware, this unit is a prototype and subject to be changed heavily }
+{$ifdef FGLINLINE}
+{$inline on}
+{$endif FGLINLINE}
+
 unit fgl;
 
 interface
@@ -49,7 +53,7 @@ type
     procedure Deref(FromIndex, ToIndex: Integer); overload;
     function Get(Index: Integer): Pointer;
     procedure InternalExchange(Index1, Index2: Integer);
-    function  InternalGet(Index: Integer): Pointer; {$ifdef CLASSESINLINE} inline; {$endif}
+    function  InternalGet(Index: Integer): Pointer; {$ifdef FGLINLINE} inline; {$endif}
     procedure InternalPut(Index: Integer; NewItem: Pointer);
     procedure Put(Index: Integer; Item: Pointer);
     procedure QuickSort(L, R: Integer; Compare: TFPSListCompareFunc);
@@ -119,29 +123,29 @@ type
       FOnCompare: TCompareFunc;
     procedure CopyItem(Src, Dest: Pointer); override;
     procedure Deref(Item: Pointer); override;
-    function  Get(Index: Integer): T; {$ifdef CLASSESINLINE} inline; {$endif}
-    function  GetList: PTypeList; {$ifdef CLASSESINLINE} inline; {$endif}
+    function  Get(Index: Integer): T; {$ifdef FGLINLINE} inline; {$endif}
+    function  GetList: PTypeList; {$ifdef FGLINLINE} inline; {$endif}
     function  ItemPtrCompare(Item1, Item2: Pointer): Integer;
-    procedure Put(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetLast: T; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure SetLast(const Value: T); {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetFirst: T; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure SetFirst(const Value: T); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure Put(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
+    function GetLast: T; {$ifdef FGLINLINE} inline; {$endif}
+    procedure SetLast(const Value: T); {$ifdef FGLINLINE} inline; {$endif}
+    function GetFirst: T; {$ifdef FGLINLINE} inline; {$endif}
+    procedure SetFirst(const Value: T); {$ifdef FGLINLINE} inline; {$endif}
   public
     Type
       TFPGListEnumeratorSpec = specialize TFPGListEnumerator<T>;
     constructor Create;
-    function Add(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Extract(const Item: T): T; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Add(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Extract(const Item: T): T; {$ifdef FGLINLINE} inline; {$endif}
     property First: T read GetFirst write SetFirst;
-    function GetEnumerator: TFPGListEnumeratorSpec; {$ifdef CLASSESINLINE} inline; {$endif}
+    function GetEnumerator: TFPGListEnumeratorSpec; {$ifdef FGLINLINE} inline; {$endif}
     function IndexOf(const Item: T): Integer;
-    procedure Insert(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure Insert(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
     property Last: T read GetLast write SetLast;
 {$ifndef VER2_4}
     procedure Assign(Source: TFPGList);
 {$endif VER2_4}
-    function Remove(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
     procedure Sort(Compare: TCompareFunc);
     property Items[Index: Integer]: T read Get write Put; default;
     property List: PTypeList read GetList;
@@ -160,27 +164,27 @@ type
       FFreeObjects: Boolean;
     procedure CopyItem(Src, Dest: Pointer); override;
     procedure Deref(Item: Pointer); override;
-    function  Get(Index: Integer): T; {$ifdef CLASSESINLINE} inline; {$endif}
-    function  GetList: PTypeList; {$ifdef CLASSESINLINE} inline; {$endif}
+    function  Get(Index: Integer): T; {$ifdef FGLINLINE} inline; {$endif}
+    function  GetList: PTypeList; {$ifdef FGLINLINE} inline; {$endif}
     function  ItemPtrCompare(Item1, Item2: Pointer): Integer;
-    procedure Put(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetLast: T; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure SetLast(const Value: T); {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetFirst: T; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure SetFirst(const Value: T); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure Put(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
+    function GetLast: T; {$ifdef FGLINLINE} inline; {$endif}
+    procedure SetLast(const Value: T); {$ifdef FGLINLINE} inline; {$endif}
+    function GetFirst: T; {$ifdef FGLINLINE} inline; {$endif}
+    procedure SetFirst(const Value: T); {$ifdef FGLINLINE} inline; {$endif}
   public
     constructor Create(FreeObjects: Boolean = True);
-    function Add(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Extract(const Item: T): T; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Add(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Extract(const Item: T): T; {$ifdef FGLINLINE} inline; {$endif}
     property First: T read GetFirst write SetFirst;
-    function GetEnumerator: TFPGListEnumeratorSpec; {$ifdef CLASSESINLINE} inline; {$endif}
+    function GetEnumerator: TFPGListEnumeratorSpec; {$ifdef FGLINLINE} inline; {$endif}
     function IndexOf(const Item: T): Integer;
-    procedure Insert(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure Insert(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
     property Last: T read GetLast write SetLast;
 {$ifndef VER2_4}
     procedure Assign(Source: TFPGObjectList);
 {$endif VER2_4}
-    function Remove(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
     procedure Sort(Compare: TCompareFunc);
     property Items[Index: Integer]: T read Get write Put; default;
     property List: PTypeList read GetList;
@@ -199,27 +203,27 @@ type
       FOnCompare: TCompareFunc;
     procedure CopyItem(Src, Dest: Pointer); override;
     procedure Deref(Item: Pointer); override;
-    function  Get(Index: Integer): T; {$ifdef CLASSESINLINE} inline; {$endif}
-    function  GetList: PTypeList; {$ifdef CLASSESINLINE} inline; {$endif}
+    function  Get(Index: Integer): T; {$ifdef FGLINLINE} inline; {$endif}
+    function  GetList: PTypeList; {$ifdef FGLINLINE} inline; {$endif}
     function  ItemPtrCompare(Item1, Item2: Pointer): Integer;
-    procedure Put(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetLast: T; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure SetLast(const Value: T); {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetFirst: T; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure SetFirst(const Value: T); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure Put(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
+    function GetLast: T; {$ifdef FGLINLINE} inline; {$endif}
+    procedure SetLast(const Value: T); {$ifdef FGLINLINE} inline; {$endif}
+    function GetFirst: T; {$ifdef FGLINLINE} inline; {$endif}
+    procedure SetFirst(const Value: T); {$ifdef FGLINLINE} inline; {$endif}
   public
     constructor Create;
-    function Add(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Extract(const Item: T): T; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Add(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Extract(const Item: T): T; {$ifdef FGLINLINE} inline; {$endif}
     property First: T read GetFirst write SetFirst;
-    function GetEnumerator: TFPGListEnumeratorSpec; {$ifdef CLASSESINLINE} inline; {$endif}
+    function GetEnumerator: TFPGListEnumeratorSpec; {$ifdef FGLINLINE} inline; {$endif}
     function IndexOf(const Item: T): Integer;
-    procedure Insert(Index: Integer; const Item: T); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure Insert(Index: Integer; const Item: T); {$ifdef FGLINLINE} inline; {$endif}
     property Last: T read GetLast write SetLast;
 {$ifndef VER2_4}
     procedure Assign(Source: TFPGInterfacedObjectList);
 {$endif VER2_4}
-    function Remove(const Item: T): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Remove(const Item: T): Integer; {$ifdef FGLINLINE} inline; {$endif}
     procedure Sort(Compare: TCompareFunc);
     property Items[Index: Integer]: T read Get write Put; default;
     property List: PTypeList read GetList;
@@ -290,26 +294,26 @@ type
     procedure CopyData(Src, Dest: Pointer); override;
     procedure Deref(Item: Pointer); override;
     procedure InitOnPtrCompare; override;
-    function GetKey(Index: Integer): TKey; {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetKeyData(const AKey: TKey): TData; {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetData(Index: Integer): TData; {$ifdef CLASSESINLINE} inline; {$endif}
+    function GetKey(Index: Integer): TKey; {$ifdef FGLINLINE} inline; {$endif}
+    function GetKeyData(const AKey: TKey): TData; {$ifdef FGLINLINE} inline; {$endif}
+    function GetData(Index: Integer): TData; {$ifdef FGLINLINE} inline; {$endif}
     function KeyCompare(Key1, Key2: Pointer): Integer;
     function KeyCustomCompare(Key1, Key2: Pointer): Integer;
     //function DataCompare(Data1, Data2: Pointer): Integer;
     function DataCustomCompare(Data1, Data2: Pointer): Integer;
-    procedure PutKey(Index: Integer; const NewKey: TKey); {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure PutKeyData(const AKey: TKey; const NewData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure PutData(Index: Integer; const NewData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure PutKey(Index: Integer; const NewKey: TKey); {$ifdef FGLINLINE} inline; {$endif}
+    procedure PutKeyData(const AKey: TKey; const NewData: TData); {$ifdef FGLINLINE} inline; {$endif}
+    procedure PutData(Index: Integer; const NewData: TData); {$ifdef FGLINLINE} inline; {$endif}
     procedure SetOnKeyCompare(NewCompare: TKeyCompareFunc);
     procedure SetOnDataCompare(NewCompare: TDataCompareFunc);
   public
     constructor Create;
-    function Add(const AKey: TKey; const AData: TData): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Add(const AKey: TKey): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Find(const AKey: TKey; out Index: Integer): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
-    function TryGetData(const AKey: TKey; out AData: TData): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure AddOrSetData(const AKey: TKey; const AData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
-    function IndexOf(const AKey: TKey): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Add(const AKey: TKey; const AData: TData): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Add(const AKey: TKey): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Find(const AKey: TKey; out Index: Integer): Boolean; {$ifdef FGLINLINE} inline; {$endif}
+    function TryGetData(const AKey: TKey; out AData: TData): Boolean; {$ifdef FGLINLINE} inline; {$endif}
+    procedure AddOrSetData(const AKey: TKey; const AData: TData); {$ifdef FGLINLINE} inline; {$endif}
+    function IndexOf(const AKey: TKey): Integer; {$ifdef FGLINLINE} inline; {$endif}
     function IndexOfData(const AData: TData): Integer;
     procedure InsertKey(Index: Integer; const AKey: TKey);
     procedure InsertKeyData(Index: Integer; const AKey: TKey; const AData: TData);
@@ -338,27 +342,27 @@ type
     procedure CopyData(Src, Dest: Pointer); override;
     procedure Deref(Item: Pointer); override;
     procedure InitOnPtrCompare; override;
-    function GetKey(Index: Integer): TKey; {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetKeyData(const AKey: TKey): TData; {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetData(Index: Integer): TData; {$ifdef CLASSESINLINE} inline; {$endif}
+    function GetKey(Index: Integer): TKey; {$ifdef FGLINLINE} inline; {$endif}
+    function GetKeyData(const AKey: TKey): TData; {$ifdef FGLINLINE} inline; {$endif}
+    function GetData(Index: Integer): TData; {$ifdef FGLINLINE} inline; {$endif}
     function KeyCompare(Key1, Key2: Pointer): Integer;
     function KeyCustomCompare(Key1, Key2: Pointer): Integer;
     //function DataCompare(Data1, Data2: Pointer): Integer;
     function DataCustomCompare(Data1, Data2: Pointer): Integer;
-    procedure PutKey(Index: Integer; const NewKey: TKey); {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure PutKeyData(const AKey: TKey; const NewData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure PutData(Index: Integer; const NewData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure PutKey(Index: Integer; const NewKey: TKey); {$ifdef FGLINLINE} inline; {$endif}
+    procedure PutKeyData(const AKey: TKey; const NewData: TData); {$ifdef FGLINLINE} inline; {$endif}
+    procedure PutData(Index: Integer; const NewData: TData); {$ifdef FGLINLINE} inline; {$endif}
     procedure SetOnKeyCompare(NewCompare: TKeyCompareFunc);
     procedure SetOnDataCompare(NewCompare: TDataCompareFunc);
   public
     constructor Create(AFreeObjects: Boolean);
     constructor Create;
-    function Add(const AKey: TKey; const AData: TData): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Add(const AKey: TKey): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Find(const AKey: TKey; out Index: Integer): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
-    function TryGetData(const AKey: TKey; out AData: TData): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure AddOrSetData(const AKey: TKey; const AData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
-    function IndexOf(const AKey: TKey): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Add(const AKey: TKey; const AData: TData): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Add(const AKey: TKey): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Find(const AKey: TKey; out Index: Integer): Boolean; {$ifdef FGLINLINE} inline; {$endif}
+    function TryGetData(const AKey: TKey; out AData: TData): Boolean; {$ifdef FGLINLINE} inline; {$endif}
+    procedure AddOrSetData(const AKey: TKey; const AData: TData); {$ifdef FGLINLINE} inline; {$endif}
+    function IndexOf(const AKey: TKey): Integer; {$ifdef FGLINLINE} inline; {$endif}
     function IndexOfData(const AData: TData): Integer;
     procedure InsertKey(Index: Integer; const AKey: TKey);
     procedure InsertKeyData(Index: Integer; const AKey: TKey; const AData: TData);
@@ -386,26 +390,26 @@ type
     procedure CopyData(Src, Dest: Pointer); override;
     procedure Deref(Item: Pointer); override;
     procedure InitOnPtrCompare; override;
-    function GetKey(Index: Integer): TKey; {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetKeyData(const AKey: TKey): TData; {$ifdef CLASSESINLINE} inline; {$endif}
-    function GetData(Index: Integer): TData; {$ifdef CLASSESINLINE} inline; {$endif}
+    function GetKey(Index: Integer): TKey; {$ifdef FGLINLINE} inline; {$endif}
+    function GetKeyData(const AKey: TKey): TData; {$ifdef FGLINLINE} inline; {$endif}
+    function GetData(Index: Integer): TData; {$ifdef FGLINLINE} inline; {$endif}
     function KeyCompare(Key1, Key2: Pointer): Integer;
     function KeyCustomCompare(Key1, Key2: Pointer): Integer;
     //function DataCompare(Data1, Data2: Pointer): Integer;
     function DataCustomCompare(Data1, Data2: Pointer): Integer;
-    procedure PutKey(Index: Integer; const NewKey: TKey); {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure PutKeyData(const AKey: TKey; const NewData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure PutData(Index: Integer; const NewData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
+    procedure PutKey(Index: Integer; const NewKey: TKey); {$ifdef FGLINLINE} inline; {$endif}
+    procedure PutKeyData(const AKey: TKey; const NewData: TData); {$ifdef FGLINLINE} inline; {$endif}
+    procedure PutData(Index: Integer; const NewData: TData); {$ifdef FGLINLINE} inline; {$endif}
     procedure SetOnKeyCompare(NewCompare: TKeyCompareFunc);
     procedure SetOnDataCompare(NewCompare: TDataCompareFunc);
   public
     constructor Create;
-    function Add(const AKey: TKey; const AData: TData): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Add(const AKey: TKey): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
-    function Find(const AKey: TKey; out Index: Integer): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
-    function TryGetData(const AKey: TKey; out AData: TData): Boolean; {$ifdef CLASSESINLINE} inline; {$endif}
-    procedure AddOrSetData(const AKey: TKey; const AData: TData); {$ifdef CLASSESINLINE} inline; {$endif}
-    function IndexOf(const AKey: TKey): Integer; {$ifdef CLASSESINLINE} inline; {$endif}
+    function Add(const AKey: TKey; const AData: TData): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Add(const AKey: TKey): Integer; {$ifdef FGLINLINE} inline; {$endif}
+    function Find(const AKey: TKey; out Index: Integer): Boolean; {$ifdef FGLINLINE} inline; {$endif}
+    function TryGetData(const AKey: TKey; out AData: TData): Boolean; {$ifdef FGLINLINE} inline; {$endif}
+    procedure AddOrSetData(const AKey: TKey; const AData: TData); {$ifdef FGLINLINE} inline; {$endif}
+    function IndexOf(const AKey: TKey): Integer; {$ifdef FGLINLINE} inline; {$endif}
     function IndexOfData(const AData: TData): Integer;
     procedure InsertKey(Index: Integer; const AKey: TKey);
     procedure InsertKeyData(Index: Integer; const AKey: TKey; const AData: TData);