Skip to content

Commit c8d6163

Browse files
authored
Merge pull request #8 from Embarcadero/cpp
Adding support to cpp #7
2 parents d0f69e3 + 7340c52 commit c8d6163

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Source/PythonTools.IOTAUtils.pas

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ TIOTAFormInfo = record
2121
TIOTAUtils = class
2222
private
2323
class function ModuleIsPas(const AModule: IOTAModule): boolean;
24+
class function ModuleIsCpp(const AModule: IOTAModule): boolean;
2425
class function ModuleIsForm(const AModule: IOTAModule): boolean;
2526

2627
class procedure EnumComps(const AFormEditor: IOTAFormEditor; const ACallback: TProc<TComponent>);
@@ -102,7 +103,7 @@ class procedure TIOTAUtils.EnumForms(const AProc: TProc<TIOTAFormInfo>);
102103
LModule := LModuleServices.Modules[I];
103104
LEditor := GetFormEditorFromModule(LModule);
104105

105-
if not (ModuleIsPas(LModule) and ModuleIsForm(LModule)) then
106+
if not ((ModuleIsPas(LModule) or ModuleIsCpp(LModule)) and ModuleIsForm(LModule)) then
106107
Continue;
107108

108109
LDesigner := (LEditor as INTAFormEditor).FormDesigner;
@@ -305,12 +306,20 @@ class function TIOTAUtils.HasForms: boolean;
305306
LModuleServices := (BorlandIDEServices as IOTAModuleServices);
306307
for I := 0 to LModuleServices.ModuleCount - 1 do begin
307308
LModule := LModuleServices.Modules[I];
308-
if ModuleIsPas(LModule) and ModuleIsForm(LModule) then
309+
if (ModuleIsPas(LModule) or ModuleIsCpp(LModule)) and ModuleIsForm(LModule) then
309310
Exit(true);
310311
end;
311312
Result := false;
312313
end;
313314

315+
class function TIOTAUtils.ModuleIsCpp(const AModule: IOTAModule): boolean;
316+
begin
317+
if SameText(ExtractFileExt(AModule.FileName), '.cpp') then
318+
Result := true
319+
else
320+
Result := false;
321+
end;
322+
314323
class function TIOTAUtils.ModuleIsForm(const AModule: IOTAModule): boolean;
315324
var
316325
LEditor: IOTAFormEditor;

0 commit comments

Comments
 (0)