mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 17:39:20 +02:00
IdeIntf: Simplify function FieldNameToPascalIdentifier in FieldsList.
git-svn-id: trunk@59090 -
This commit is contained in:
parent
71029bd79e
commit
e2bbe1a4d4
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user