Ignore:
Timestamp:
Sep 10, 2022, 6:26:39 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
  • Modified: Use Generics.Collections.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • PersistentData/Backend/UPDClientMemory.pas

    r387 r561  
    11unit UPDClientMemory;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, UPDClient, SpecializedList;
     6  Classes, SysUtils, UPDClient, Generics.Collections;
    97
    108type
     
    2119    function SearchObject(Id: Integer): TObjectProxy;
    2220  public
    23     Objects: TListObject;
     21    Objects: TObjectProxies;
    2422    procedure ObjectLoad(AObject: TObjectProxy); override;
    2523    procedure ObjectSave(AObject: TObjectProxy); override;
     
    4038resourcestring
    4139  SObjectNotFound = 'Object with id %s not found';
     40
    4241
    4342implementation
     
    9796    else begin
    9897      AObject.Id := GetNewObjectId;
    99       Obj := TObjectProxy(Objects.AddNew(TObjectProxy.Create));
     98      Obj := Objects.AddProxy;
    10099      Obj.Assign(AObject);
    101100    end;
     
    119118  NewObject: TObjectProxy;
    120119  Table: string;
     120  Item: TPair<string, string>;
    121121begin
    122122  AList.Objects.Clear;
     
    132132
    133133      if AList.ColummsFilterUse then begin
    134         for P := 0 to Properties.Count - 1 do
    135         if AList.ColumnsFilter.IndexOf(Properties.Keys[I]) <> -1 then
    136           NewObject.Properties.Add(Properties.Keys[I], Properties[I].Value);
     134        for Item in Properties do
     135        if AList.ColumnsFilter.IndexOf(Item.Key) <> -1 then
     136          NewObject.Properties.Add(Item.Key, Item.Value);
    137137      end else NewObject.Properties.Assign(Properties);
    138138    end;
     
    147147procedure TPDClientMemory.ListSave(AList: TListProxy);
    148148begin
    149 
    150149end;
    151150
    152151procedure TPDClientMemory.TypeDefine(AType: TPDType);
    153152begin
    154 
    155153end;
    156154
    157155procedure TPDClientMemory.TypeUndefine(AType: TPDType);
    158156begin
    159 
    160157end;
    161158
    162159function TPDClientMemory.TypeIsDefined(AType: TPDType): Boolean;
    163160begin
    164 
     161  Result := False;
    165162end;
    166163
    167164procedure TPDClientMemory.Install;
    168165begin
    169 
    170166end;
    171167
    172168procedure TPDClientMemory.Uninstall;
    173169begin
    174 
    175170end;
    176171
     
    178173begin
    179174  inherited;
    180   Objects := TListObject.Create;
     175  Objects := TObjectProxies.Create;
    181176  BackendName := 'Memory';
    182177end;
     
    184179destructor TPDClientMemory.Destroy;
    185180begin
    186   Objects.Free;
    187   inherited Destroy;
     181  FreeAndNil(Objects);
     182  inherited;
    188183end;
    189184
    190185procedure TPDClientMemory.Connect;
    191186begin
    192   inherited Connect;
     187  inherited;
    193188end;
    194189
    195190procedure TPDClientMemory.Disconnect;
    196191begin
    197   inherited Disconnect;
     192  inherited;
    198193end;
    199194
Note: See TracChangeset for help on using the changeset viewer.