Changeset 128 for trunk/Packages/Common


Ignore:
Timestamp:
Apr 8, 2022, 9:43:55 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Use Generics.Collection instead of fgl for better Delphi compatibility.
Location:
trunk/Packages/Common
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Common.lpk

    r90 r128  
    3333      <Other>
    3434        <CompilerMessages>
    35           <IgnoredMessages idx6058="True" idx5024="True" idx3124="True" idx3123="True"/>
     35          <IgnoredMessages idx6058="True" idx5071="True" idx5024="True" idx3124="True" idx3123="True"/>
    3636        </CompilerMessages>
    3737      </Other>
  • trunk/Packages/Common/UDebugLog.pas

    r127 r128  
    44
    55uses
    6   Classes, SysUtils, FileUtil, fgl, SyncObjs;
     6  Classes, SysUtils, FileUtil, Generics.Collections, SyncObjs;
    77
    88type
     
    1313    Group: string;
    1414    Text: string;
     15  end;
     16
     17  TDebugLogItems = class(TObjectList<TDebugLogItem>)
    1518  end;
    1619
     
    2730    procedure SetMaxCount(const AValue: Integer);
    2831  public
    29     Items: TFPGObjectList<TDebugLogItem>;
     32    Items: TDebugLogItems;
    3033    Lock: TCriticalSection;
    3134    procedure Add(Text: string; Group: string = '');
     
    116119begin
    117120  inherited;
    118   Items := TFPGObjectList<TDebugLogItem>.Create;
     121  Items := TDebugLogItems.Create;
    119122  Lock := TCriticalSection.Create;
    120123  MaxCount := 100;
     
    125128destructor TDebugLog.Destroy;
    126129begin
    127   Items.Free;
    128   Lock.Free;
     130  FreeAndNil(Items);
     131  FreeAndNil(Lock);
    129132  inherited;
    130133end;
  • trunk/Packages/Common/UFindFile.pas

    r90 r128  
    3535  private
    3636    s : TStringList;
    37 
    3837    fSubFolder : boolean;
    3938    fAttr: TFileAttrib;
    4039    fPath : string;
    4140    fFileMask : string;
    42 
    4341    procedure SetPath(Value: string);
    4442    procedure FileSearch(const inPath : string);
     
    4644    constructor Create(AOwner: TComponent); override;
    4745    destructor Destroy; override;
    48 
    4946    function SearchForFiles: TStringList;
    5047  published
     
    6461
    6562procedure Register;
     63
    6664
    6765implementation
  • trunk/Packages/Common/UJobProgressView.pas

    r127 r128  
    55uses
    66  SysUtils, Variants, Classes, Graphics, Controls, Forms, Syncobjs,
    7   Dialogs, ComCtrls, StdCtrls, ExtCtrls, fgl, UThreading, Math,
     7  Dialogs, ComCtrls, StdCtrls, ExtCtrls, Generics.Collections, UThreading, Math,
    88  DateUtils;
    99
     
    6969  end;
    7070
    71   TJobs = class(TFPGObjectList<TJob>)
     71  TJobs = class(TObjectList<TJob>)
    7272  end;
    7373
  • trunk/Packages/Common/ULanguages.pas

    r127 r128  
    44
    55uses
    6   Classes, SysUtils, fgl;
     6  Classes, SysUtils, Generics.Collections;
    77
    88type
     
    1515  { TLanguages }
    1616
    17   TLanguages = class(TFPGObjectList<TLanguage>)
     17  TLanguages = class(TObjectList<TLanguage>)
    1818    function SearchByCode(ACode: string): TLanguage;
    1919    procedure AddNew(Code: string; Name: string);
  • trunk/Packages/Common/UListViewSort.pas

    r127 r128  
    77uses
    88  {$IFDEF Windows}Windows, CommCtrl, LMessages, {$ENDIF}Classes, Graphics, ComCtrls, SysUtils,
    9   Controls, DateUtils, Dialogs, fgl, Forms, Grids, StdCtrls, ExtCtrls,
    10   LclIntf, LclType, LResources;
     9  Controls, DateUtils, Dialogs, Forms, Grids, StdCtrls, ExtCtrls,
     10  LclIntf, LclType, LResources, Generics.Collections, Generics.Defaults;
    1111
    1212type
     
    1717  TCompareEvent = function (Item1, Item2: TObject): Integer of object;
    1818  TListFilterEvent = procedure (ListViewSort: TListViewSort) of object;
     19
     20  TObjects = TObjectList<TObject>;
    1921
    2022  { TListViewSort }
     
    5052    {$ENDIF}
    5153  public
    52     List: TFPGObjectList<TObject>;
    53     Source: TFPGObjectList<TObject>;
     54    Source: TObjects;
     55    List: TObjects;
    5456    constructor Create(AOwner: TComponent); override;
    5557    destructor Destroy; override;
     
    336338  ListViewSortCompare: TCompareEvent;
    337339
    338 function ListViewCompare(const Item1, Item2: TObject): Integer;
     340function ListViewCompare(constref Item1, Item2: TObject): Integer;
    339341begin
    340342  Result := ListViewSortCompare(Item1, Item2);
     
    347349  ListViewSortCompare := Compare;
    348350  if (List.Count > 0) then
    349     List.Sort(ListViewCompare);
     351    List.Sort(TComparer<TObject>.Construct(ListViewCompare));
    350352end;
    351353
     
    353355begin
    354356  if Assigned(FOnFilter) then FOnFilter(Self)
    355   else if Assigned(Source) then
    356     List.Assign(Source) else
     357  else if Assigned(Source) then begin
    357358    List.Clear;
     359    List.AddRange(Source);
     360  end else List.Clear;
    358361  if ListView.Items.Count <> List.Count then
    359362    ListView.Items.Count := List.Count;
     
    410413begin
    411414  inherited;
    412   List := TFPGObjectList<TObject>.Create;
    413   List.FreeObjects := False;
     415  List := TObjects.Create;
     416  List.OwnsObjects := False;
    414417end;
    415418
    416419destructor TListViewSort.Destroy;
    417420begin
    418   List.Free;
     421  FreeAndNil(List);
    419422  inherited;
    420423end;
  • trunk/Packages/Common/UMetaCanvas.pas

    r127 r128  
    44
    55uses
    6   Classes, SysUtils, Graphics, Types, fgl;
     6  Classes, SysUtils, Graphics, Types, Generics.Collections;
    77
    88type
     
    1717  end;
    1818
    19   TCanvasObjects = class(TFPGObjectList<TCanvasObject>)
     19  TCanvasObjects = class(TObjectList<TCanvasObject>)
    2020  end;
    2121
  • trunk/Packages/Common/UPool.pas

    r127 r128  
    44
    55uses
    6   Classes, SysUtils, syncobjs, fgl, UThreading;
     6  Classes, SysUtils, syncobjs, Generics.Collections, UThreading;
    77
    88type
     
    2020    function NewItemObject: TObject; virtual;
    2121  public
    22     Items: TFPGObjectList<TObject>;
    23     FreeItems: TFPGObjectList<TObject>;
     22    Items: TObjectList<TObject>;
     23    FreeItems: TObjectList<TObject>;
    2424    function Acquire: TObject; virtual;
    2525    procedure Release(Item: TObject); virtual;
     
    183183begin
    184184  inherited;
    185   Items := TFPGObjectList<TObject>.Create;
    186   FreeItems := TFPGObjectList<TObject>.Create;
    187   FreeItems.FreeObjects := False;
     185  Items := TObjectList<TObject>.Create;
     186  FreeItems := TObjectList<TObject>.Create;
     187  FreeItems.OwnsObjects := False;
    188188  FReleaseEvent := TEvent.Create(nil, False, False, '');
    189189end;
  • trunk/Packages/Common/UScaleDPI.pas

    r127 r128  
    66
    77uses
    8   Classes, Forms, Graphics, Controls, ComCtrls, LCLType, SysUtils, fgl;
     8  Classes, Forms, Graphics, Controls, ComCtrls, LCLType, SysUtils,
     9  Generics.Collections;
    910
    1011type
     
    2627  end;
    2728
    28   TControlDimensions = class(TFPGObjectList<TControlDimension>)
     29  TControlDimensions = class(TObjectList<TControlDimension>)
    2930  end;
    3031
  • trunk/Packages/Common/UTheme.pas

    r127 r128  
    55uses
    66  Classes, SysUtils, Graphics, ComCtrls, Controls, ExtCtrls, Menus, StdCtrls,
    7   Spin, Forms, fgl, Grids;
     7  Spin, Forms, Generics.Collections, Grids;
    88
    99type
     
    1919  { TThemes }
    2020
    21   TThemes = class(TFPGObjectList<TTheme>)
     21  TThemes = class(TObjectList<TTheme>)
    2222    function AddNew(Name: string): TTheme;
    2323    function FindByName(Name: string): TTheme;
  • trunk/Packages/Common/UThreading.pas

    r127 r128  
    44
    55uses
    6   Classes, SysUtils, Forms, fgl, SyncObjs;
     6  Classes, SysUtils, Forms, Generics.Collections, SyncObjs;
    77
    88type
     
    9999  { TThreadList }
    100100
    101   TThreadList = class(TFPGObjectList<TVirtualThread>)
     101  TThreadList = class(TObjectList<TVirtualThread>)
    102102    function FindById(Id: TThreadID): TVirtualThread;
    103103    constructor Create; virtual;
     
    358358ThreadListLock := TCriticalSection.Create;
    359359ThreadList := TThreadList.Create;
    360 ThreadList.FreeObjects := False;
     360ThreadList.OwnsObjects := False;
    361361
    362362finalization
  • trunk/Packages/Common/UTranslator.pas

    r127 r128  
    44
    55uses
    6   Classes, SysUtils, Forms, ExtCtrls, Controls, fgl, LazFileUtils, LazUTF8,
     6  Classes, SysUtils, Forms, ExtCtrls, Controls, LazFileUtils, LazUTF8,
    77  Translations, TypInfo, Dialogs, FileUtil, LCLProc, ULanguages, LCLType,
    8   LCLVersion;
     8  LCLVersion, Generics.Collections;
    99
    1010type
    1111  THandleStringEvent = function (AValue: string): string of object;
    1212
    13   TPoFiles = class(TFPGObjectList<TPOFile>)
     13  TPoFiles = class(TObjectList<TPOFile>)
    1414  end;
    1515
     
    2525  { TComponentExcludesList }
    2626
    27   TComponentExcludesList = class(TFPGObjectList<TComponentExcludes>)
     27  TComponentExcludesList = class(TObjectList<TComponentExcludes>)
    2828    function FindByClassType(AClassType: TClass): TComponentExcludes;
    2929    procedure DumpToStrings(Strings: TStrings);
     
    288288  Item := Component.ClassType;
    289289  while Assigned(Item) do begin
    290     //ShowMessage(Component.Name + ', ' + Component.ClassName + ', ' + Item.ClassName + ', ' + PropertyName);
    291290    Excludes := ComponentExcludes.FindByClassType(Item.ClassType);
    292291    if Assigned(Excludes) then begin
Note: See TracChangeset for help on using the changeset viewer.