Ignore:
Timestamp:
Sep 10, 2022, 6:24:58 PM (2 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/PersistentData/UPDClient.pas

    r138 r142  
    3131    destructor Destroy; override;
    3232    procedure Assign(Source: TObjectProxy);
     33  end;
     34
     35  { TObjectProxies }
     36
     37  TObjectProxies = class(TObjectList<TObjectProxy>)
     38    function AddProxy: TObjectProxy;
    3339  end;
    3440
     
    7278  end;
    7379
    74   { TPDTypePropertyList }
    75 
    76   TPDTypePropertyList = class(TObjectList<TPDTypeProperty>)
     80  { TPDTypeProperties }
     81
     82  TPDTypeProperties = class(TObjectList<TPDTypeProperty>)
    7783    Client: TPDClient;
    78     procedure AddSimple(Name: string; TypeName: string; Unique: Boolean = False;
    79       Index: Boolean = False);
     84    function AddSimple(Name: string; TypeName: string; Unique: Boolean = False;
     85      Index: Boolean = False): TPDTypeProperty;
    8086  end;
    8187
     
    8995    Name: string;
    9096    DbType: string;
    91     Properties: TPDTypePropertyList;
     97    Properties: TPDTypeProperties;
    9298    function IsDefined: Boolean;
    9399    procedure Define;
     
    98104  end;
    99105
    100   { TPDTypeList }
    101 
    102   TPDTypeList = class(TObjectList<TPDType>)
     106  { TPDTypes }
     107
     108  TPDTypes = class(TObjectList<TPDType>)
    103109    Client: TPDClient;
    104110    function AddType(Name: string; DbType: string = ''): TPDType;
     
    119125    procedure SetConnectionString(AValue: string); virtual;
    120126  public
    121     Types: TPDTypeList;
     127    Types: TPDTypes;
    122128    Version: string;
    123129    BackendName: string;
     
    156162implementation
    157163
    158 { TPDTypePropertyList }
    159 
    160 procedure TPDTypePropertyList.AddSimple(Name: string; TypeName: string;
    161   Unique: Boolean = False; Index: Boolean = False);
    162 var
    163   NewProperty: TPDTypeProperty;
    164 begin
    165   NewProperty := TPDTypeProperty(Add(TPDTypeProperty.Create));
    166   NewProperty.Name := Name;
    167   NewProperty.DbType := Client.Types.SearchByName(TypeName);
    168   NewProperty.Unique := Unique;
    169   NewProperty.Index := Index;
    170 end;
    171 
    172 
    173 { TPDTypeList }
    174 
    175 function TPDTypeList.AddType(Name: string; DbType: string = ''): TPDType;
    176 begin
    177   Result := TPDType(Add(TPDType.Create));
     164{ TObjectProxies }
     165
     166function TObjectProxies.AddProxy: TObjectProxy;
     167begin
     168  Result := TObjectProxy.Create;
     169  Add(Result);
     170end;
     171
     172{ TPDTypeProperties }
     173
     174function TPDTypeProperties.AddSimple(Name: string; TypeName: string;
     175  Unique: Boolean = False; Index: Boolean = False): TPDTypeProperty;
     176begin
     177  Result := TPDTypeProperty.Create;
     178  Result.Name := Name;
     179  Result.DbType := Client.Types.SearchByName(TypeName);
     180  Result.Unique := Unique;
     181  Result.Index := Index;
     182  Add(Result);
     183end;
     184
     185{ TPDTypes }
     186
     187function TPDTypes.AddType(Name: string; DbType: string = ''): TPDType;
     188begin
     189  Result := TPDType.Create;
    178190  Result.Client := Client;
    179191  Result.Name := Name;
    180192  Result.DbType := DbType;
    181 end;
    182 
    183 function TPDTypeList.SearchByName(Name: string): TPDType;
     193  Add(Result);
     194end;
     195
     196function TPDTypes.SearchByName(Name: string): TPDType;
    184197var
    185198  I: Integer;
     
    218231constructor TPDType.Create;
    219232begin
    220   Properties := TPDTypePropertyList.Create;
     233  Properties := TPDTypeProperties.Create;
    221234end;
    222235
    223236destructor TPDType.Destroy;
    224237begin
    225   Properties.Free;
     238  FreeAndNil(Properties);
    226239  inherited;
    227240end;
     
    254267destructor TObjectProxy.Destroy;
    255268begin
    256   Properties.Free;
     269  FreeAndNil(Properties);
    257270  inherited;
    258271end;
     
    285298destructor TListProxy.Destroy;
    286299begin
    287   Objects.Free;
    288   ColumnsFilter.Free;
     300  FreeAndNil(Objects);
     301  FreeAndNil(ColumnsFilter);
    289302  inherited;
    290303end;
     
    311324procedure TPDClient.SetConnectionString(AValue: string);
    312325begin
    313 
    314326end;
    315327
     
    413425begin
    414426  inherited;
    415   Types := TPDTypeList.Create;
     427  Types := TPDTypes.Create;
    416428  Types.Client := Self;
    417429  InitSystemTypes;
     
    420432destructor TPDClient.Destroy;
    421433begin
    422   Types.Free;
     434  FreeAndNil(Types);
    423435  inherited;
    424436end;
     
    434446procedure TPDClient.Install;
    435447begin
    436 
    437448end;
    438449
     
    444455procedure TPDClient.Update;
    445456begin
    446 
    447457end;
    448458
Note: See TracChangeset for help on using the changeset viewer.