IdeIntf: Simplify function FieldNameToPascalIdentifier in FieldsList.

git-svn-id: trunk@59090 -
This commit is contained in:
juha 2018-09-20 08:18:49 +00:00
parent 71029bd79e
commit e2bbe1a4d4

View File

@ -36,7 +36,7 @@ uses
// LCL // LCL
Forms, Dialogs, Buttons, StdCtrls, Forms, Dialogs, Buttons, StdCtrls,
// IdeIntf // IdeIntf
ObjInspStrConsts, ComponentEditors, IDEWindowIntf; ObjInspStrConsts, PropEdits, ComponentEditors, IDEWindowIntf;
type type
@ -93,20 +93,14 @@ var
i : integer; i : integer;
begin begin
Result := ''; Result := '';
// FieldName is an ansistring
for i := 1 to Length(AName) do for i := 1 to Length(AName) do
if AName[i] in ['0'..'9','a'..'z','A'..'Z','_'] then if AName[i] in ['0'..'9','a'..'z','A'..'Z','_'] then
Result := Result + AName[i]; Result := Result + AName[i];
if (Length(Result) > 0) and (not (Result[1] in ['0'..'9'])) then if (Result = '') or (Result[1] in ['0'..'9']) then
Exit; if Assigned(FieldDef.FieldClass) then // Try with FieldDef
if Assigned(FieldDef.FieldClass) then Result := ClassNameToComponentName(FieldDef.FieldClass.ClassName) + Result
begin else
Result := FieldDef.FieldClass.ClassName + Result; Result := 'Field' + Result;
if Copy(Result, 1, 1) = 'T' then
Result := Copy(Result, 2, Length(Result) - 1);
end
else
Result := 'Field' + Result;
end; end;
function CreateFieldName(Owner: TComponent; const AName: string): string; function CreateFieldName(Owner: TComponent; const AName: string): string;