Changeset 560


Ignore:
Timestamp:
Sep 10, 2022, 11:35:01 AM (2 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
  • Added: Implode and explode method.
  • Added: Custom specialized generic classes.
Location:
Common
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • Common/Common.lpk

    r559 r560  
    4242    <License Value="Copy left."/>
    4343    <Version Minor="10"/>
    44     <Files Count="31">
     44    <Files Count="32">
    4545      <Item1>
    4646        <Filename Value="StopWatch.pas"/>
     
    179179        <UnitName Value="UTestCase"/>
    180180      </Item31>
     181      <Item32>
     182        <Filename Value="UGenerics.pas"/>
     183        <UnitName Value="UGenerics"/>
     184      </Item32>
    181185    </Files>
    182186    <CompatibilityMode Value="True"/>
  • Common/Common.pas

    r559 r560  
    1414  UPersistentForm, UFindFile, UScaleDPI, UTheme, UStringTable, UMetaCanvas,
    1515  UGeometric, UTranslator, ULanguages, UFormAbout, UAboutDialog,
    16   UPixelPointer, UDataFile, UTestCase, LazarusPackageIntf;
     16  UPixelPointer, UDataFile, UTestCase, UGenerics, LazarusPackageIntf;
    1717
    1818implementation
  • Common/UCommon.pas

    r558 r560  
    77  {$IFDEF UNIX}baseunix,{$ENDIF}
    88  Classes, SysUtils, StrUtils, Dialogs, Process, LCLIntf, Graphics,
    9   FileUtil; //, ShFolder, ShellAPI;
     9  FileUtil, Generics.Collections; //, ShFolder, ShellAPI;
    1010
    1111type
     
    6565function GetFileFilterItemExt(Filter: string; Index: Integer): string;
    6666function IntToBin(Data: Int64; Count: Byte): string;
     67function Implode(Separator: Char; List: TList<string>): string;
    6768function LastPos(const SubStr: String; const S: String): Integer;
    6869function LoadFileToStr(const FileName: TFileName): AnsiString;
     
    313314end;
    314315
     316function Implode(Separator: Char; List: TList<string>): string;
     317var
     318  I: Integer;
     319begin
     320  Result := '';
     321  for I := 0 to List.Count - 1 do begin
     322    Result := Result + List[I];
     323    if I < List.Count - 1 then Result := Result + Separator;
     324  end;
     325end;
     326
    315327{$IFDEF WINDOWS}
    316328function GetUserName: string;
  • Common/UFindFile.pas

    r558 r560  
    8585begin
    8686  s.Free;
    87   inherited Destroy;
     87  inherited;
    8888end;
    8989
  • Common/UFormAbout.pas

    r558 r560  
    2020    PanelButtons: TPanel;
    2121    procedure ButtonHomePageClick(Sender: TObject);
    22     procedure FormCreate(Sender: TObject);
    2322    procedure FormShow(Sender: TObject);
    24   private
    25     { private declarations }
    2623  public
    2724    AboutDialog: TObject; //TAboutDialog
     
    7774end;
    7875
    79 procedure TFormAbout.FormCreate(Sender: TObject);
    80 begin
    81 end;
    82 
    8376end.
    8477
  • Common/UJobProgressView.pas

    r558 r560  
    641641begin
    642642  FLock.Free;
    643   inherited Destroy;
     643  inherited;
    644644end;
    645645
  • Common/UListViewSort.pas

    r558 r560  
    149149destructor TListViewEx.Destroy;
    150150begin
    151   inherited Destroy;
     151  inherited;
    152152end;
    153153
  • Common/UMemory.pas

    r558 r560  
    4949procedure TPositionMemory.SetSize(AValue: Integer);
    5050begin
    51   inherited SetSize(AValue);
     51  inherited;
    5252  if FPosition > FSize then FPosition := FSize;
    5353end;
     
    106106begin
    107107  Size := 0;
    108   inherited Destroy;
     108  inherited;
    109109end;
    110110
  • Common/UPool.pas

    r558 r560  
    106106constructor TThreadedPool.Create;
    107107begin
    108   inherited Create;
     108  inherited;
    109109  Lock := TCriticalSection.Create;
    110110end;
     
    114114  TotalCount := 0;
    115115  Lock.Free;
    116   inherited Destroy;
     116  inherited;
    117117end;
    118118
  • Common/UResetableThread.pas

    r558 r560  
    165165  FreeAndNil(FStopEvent);
    166166  FreeAndNil(FLock);
    167   inherited Destroy;
     167  inherited;
    168168end;
    169169
     
    284284constructor TThreadPool.Create;
    285285begin
    286   inherited Create;
     286  inherited;
    287287end;
    288288
     
    291291  TotalCount := 0;
    292292  WaitForEmpty;
    293   inherited Destroy;
     293  inherited;
    294294end;
    295295
  • Common/USyncCounter.pas

    r558 r560  
    6868begin
    6969  Lock.Free;
    70   inherited Destroy;
     70  inherited;
    7171end;
    7272
  • Common/UThreading.pas

    r558 r560  
    292292  end;
    293293  FThread.Free;
    294   inherited Destroy;
     294  inherited;
    295295end;
    296296
  • Common/UURI.pas

    r558 r560  
    182182begin
    183183  Items.Free;
    184   inherited Destroy;
     184  inherited;
    185185end;
    186186
     
    231231begin
    232232  Path.Free;
    233   inherited Destroy;
     233  inherited;
    234234end;
    235235
     
    242242    Fragment := TURI(Source).Fragment;
    243243    Query := TURI(Source).Query;
    244   end else inherited Assign(Source);
     244  end else inherited;
    245245end;
    246246
     
    290290destructor TURL.Destroy;
    291291begin
    292   inherited Destroy;
     292  inherited;
    293293end;
    294294
     
    343343begin
    344344  Directory.Free;
    345   inherited Destroy;
    346 end;
    347 
     345  inherited;
     346end;
    348347
    349348end.
Note: See TracChangeset for help on using the changeset viewer.