Ignore:
Timestamp:
Sep 9, 2022, 8:20:25 PM (22 months ago)
Author:
chronos
Message:
  • Modified: Removed TemplateGenerics package. Generics usage replaced by standard Generics.Collections.
Location:
trunk/Packages/PersistentData
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/PersistentData/Backend/UPDClientMemory.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UPDClient, SpecializedList;
     6  Classes, SysUtils, UPDClient, Generics.Collections;
    77
    88type
     
    1919    function SearchObject(Id: Integer): TObjectProxy;
    2020  public
    21     Objects: TListObject;
     21    Objects: TObjectList<TObjectProxy>;
    2222    procedure ObjectLoad(AObject: TObjectProxy); override;
    2323    procedure ObjectSave(AObject: TObjectProxy); override;
     
    9696    else begin
    9797      AObject.Id := GetNewObjectId;
    98       Obj := TObjectProxy(Objects.AddNew(TObjectProxy.Create));
     98      Obj := TObjectProxy(Objects.Add(TObjectProxy.Create));
    9999      Obj.Assign(AObject);
    100100    end;
     
    118118  NewObject: TObjectProxy;
    119119  Table: string;
     120  Item: TPair<string, string>;
    120121begin
    121122  AList.Objects.Clear;
     
    131132
    132133      if AList.ColummsFilterUse then begin
    133         for P := 0 to Properties.Count - 1 do
    134         if AList.ColumnsFilter.IndexOf(Properties.Keys[I]) <> -1 then
    135           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);
    136137      end else NewObject.Properties.Assign(Properties);
    137138    end;
     
    172173begin
    173174  inherited;
    174   Objects := TListObject.Create;
     175  Objects := TObjectList<TObjectProxy>.Create;
    175176  BackendName := 'Memory';
    176177end;
  • trunk/Packages/PersistentData/Backend/UPDClientMySQL.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, USqlDatabase, UPDClient, SpecializedDictionary;
     6  Classes, SysUtils, USqlDatabase, UPDClient, UGenerics;
    77
    88type
  • trunk/Packages/PersistentData/PersistentData.lpk

    r87 r138  
    1 <?xml version="1.0"?>
     1<?xml version="1.0" encoding="UTF-8"?>
    22<CONFIG>
    3   <Package Version="4">
     3  <Package Version="5">
    44    <PathDelim Value="\"/>
    55    <Name Value="PersistentData"/>
     6    <Type Value="RunAndDesignTime"/>
    67    <Author Value="Chronos"/>
    78    <CompilerOptions>
     
    1213        <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
    1314      </SearchPaths>
     15      <Parsing>
     16        <SyntaxOptions>
     17          <SyntaxMode Value="Delphi"/>
     18          <CStyleOperator Value="False"/>
     19          <AllowLabel Value="False"/>
     20          <CPPInline Value="False"/>
     21        </SyntaxOptions>
     22      </Parsing>
    1423      <CodeGeneration>
    1524        <Checks>
     
    2029        </Checks>
    2130      </CodeGeneration>
    22       <Other>
    23         <CompilerMessages>
    24           <MsgFileName Value=""/>
    25         </CompilerMessages>
    26         <CompilerPath Value="$(CompPath)"/>
    27       </Other>
    2831    </CompilerOptions>
    2932    <Description Value="Generic data persistence layer"/>
     
    6568      </Item8>
    6669    </Files>
    67     <Type Value="RunAndDesignTime"/>
     70    <CompatibilityMode Value="True"/>
    6871    <RequiredPkgs Count="2">
    6972      <Item1>
  • trunk/Packages/PersistentData/UPDClient.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, SpecializedList, SpecializedDictionary;
     6  Classes, SysUtils, Generics.Collections, UGenerics;
    77
    88const
     
    5757    ObjectName: string;
    5858    Path: string;
    59     Objects: TListObject; // TListObject<TObjectProxy>
     59    Objects: TObjectList<TObjectProxy>;
    6060    procedure Clear;
    6161    constructor Create;
     
    7474  { TPDTypePropertyList }
    7575
    76   TPDTypePropertyList = class(TListObject)
     76  TPDTypePropertyList = class(TObjectList<TPDTypeProperty>)
    7777    Client: TPDClient;
    7878    procedure AddSimple(Name: string; TypeName: string; Unique: Boolean = False;
     
    100100  { TPDTypeList }
    101101
    102   TPDTypeList = class(TListObject)
     102  TPDTypeList = class(TObjectList<TPDType>)
    103103    Client: TPDClient;
    104104    function AddType(Name: string; DbType: string = ''): TPDType;
     
    147147  TPDClientClass = class of TPDClient;
    148148
    149   resourcestring
    150     SClientNotSet = 'Client not set';
    151     SNotSupported = 'Not supported';
    152     SVersionMismatch = 'Version mismatch, client: %0:s, server: %1:s. Please upgrade database.';
    153     SCantLoadObjectWithoutId = 'Can''t load object without id';
     149resourcestring
     150  SClientNotSet = 'Client not set';
     151  SNotSupported = 'Not supported';
     152  SVersionMismatch = 'Version mismatch, client: %0:s, server: %1:s. Please upgrade database.';
     153  SCantLoadObjectWithoutId = 'Can''t load object without id';
    154154
    155155
     
    163163  NewProperty: TPDTypeProperty;
    164164begin
    165   NewProperty := TPDTypeProperty(AddNew(TPDTypeProperty.Create));
     165  NewProperty := TPDTypeProperty(Add(TPDTypeProperty.Create));
    166166  NewProperty.Name := Name;
    167167  NewProperty.DbType := Client.Types.SearchByName(TypeName);
     
    175175function TPDTypeList.AddType(Name: string; DbType: string = ''): TPDType;
    176176begin
    177   Result := TPDType(AddNew(TPDType.Create));
     177  Result := TPDType(Add(TPDType.Create));
    178178  Result.Client := Client;
    179179  Result.Name := Name;
     
    280280begin
    281281  ColumnsFilter := TListString.Create;
    282   Objects := TListObject.Create;
     282  Objects := TObjectList<TObjectProxy>.Create;
    283283end;
    284284
     
    345345    NewObject.Load;
    346346
    347     DbVersion := NewObject.Properties.Values['Version'];
     347    DbVersion := NewObject.Properties.Items['Version'];
    348348    if Version <> DbVersion then
    349349      raise Exception.Create(Format(SVersionMismatch, [Version, DbVersion]));
     
    395395    Tables.Count := NewProxy.Objects.Count;
    396396    for I := 0 to NewProxy.Objects.Count - 1 do
    397       Tables[I] := TObjectProxy(NewProxy.Objects[I]).Properties.Values['TABLE_NAME'];
     397      Tables[I] := TObjectProxy(NewProxy.Objects[I]).Properties.Items['TABLE_NAME'];
    398398
    399399    for I := 0 to Types.Count - 1 do
  • trunk/Packages/PersistentData/UPersistentData.pas

    r137 r138  
    44
    55uses
    6   Classes, SysUtils, UPDClient, SpecializedList;
     6  Classes, SysUtils, UPDClient, Generics.Collections;
    77
    88type
     
    1616  TPDManager = class(TComponent)
    1717  public
    18     Items: TListObject;
     18    Items: TObjectList<TPDManagerItem>;
    1919    procedure Register(ClientClass: TPDClientClass);
    2020    procedure LoadToStrings(Strings: TStrings);
     
    7676begin
    7777  inherited;
    78   Items := TListObject.Create;
     78  Items := TObjectList<TPDManagerItem>.Create;
    7979end;
    8080
Note: See TracChangeset for help on using the changeset viewer.