* Item class is now a class function in TDDFieldDefs

git-svn-id: trunk@14205 -
This commit is contained in:
michael 2009-11-17 20:30:53 +00:00
parent bf39a852b4
commit b732012438

View File

@ -108,6 +108,7 @@ Type
Property Hint : String Read FHint Write FHint; Property Hint : String Read FHint Write FHint;
Property ProviderFlags : TProviderFlags Read FProviderFlags Write FProviderFlags; Property ProviderFlags : TProviderFlags Read FProviderFlags Write FProviderFlags;
end; end;
TDDFieldDefClass = Class of TDDFieldDef;
{ TDDTableCollection } { TDDTableCollection }
TDDTableCollection = Class(TIniCollection) TDDTableCollection = Class(TIniCollection)
@ -135,6 +136,7 @@ Type
Public Public
Constructor Create(ATableDef : TDDTableDef); Constructor Create(ATableDef : TDDTableDef);
Constructor Create(ATableName : string); Constructor Create(ATableName : string);
Class Function FieldDefClass : TDDFieldDefClass; virtual;
Property TableDef : TDDTableDef Read FTableDef; Property TableDef : TDDTableDef Read FTableDef;
Property TableName : String Read GetTableName Write SetTableName; Property TableName : String Read GetTableName Write SetTableName;
Function AddField(AFieldName: String = '') : TDDFieldDef; Function AddField(AFieldName: String = '') : TDDFieldDef;
@ -1242,24 +1244,30 @@ end;
constructor TDDFieldDefs.Create(ATableDef: TDDTableDef); constructor TDDFieldDefs.Create(ATableDef: TDDTableDef);
begin begin
Inherited Create(TDDFieldDef); Inherited Create(FieldDefClass);
FPrefix:='Field'; FPrefix:='Field';
SetTableDef(ATableDef); SetTableDef(ATableDef);
end; end;
constructor TDDFieldDefs.Create(ATableName: String); constructor TDDFieldDefs.Create(ATableName: String);
begin begin
Inherited Create(TDDFieldDef); Inherited Create(FieldDefClass);
FPrefix:='Field'; FPrefix:='Field';
TableName:=ATableName; TableName:=ATableName;
end; end;
class function TDDFieldDefs.FieldDefClass: TDDFieldDefClass;
begin
Result:=TDDFieldDef
end;
function TDDFieldDefs.GetField(Index : Integer): TDDFieldDef; function TDDFieldDefs.GetField(Index : Integer): TDDFieldDef;
begin begin
Result:=TDDFieldDef(Items[Index]); Result:=TDDFieldDef(Items[Index]);
end; end;
procedure TDDFieldDefs.SetField(Index : Integer; const AValue: TDDFieldDef); procedure TDDFieldDefs.SetField(Index : Integer; const AValue: TDDFieldDef);
begin begin
Items[Index]:=AValue; Items[Index]:=AValue;