Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: renato178 on June 11, 2019, 07:08:35 pm
-
Hi,
I'm trying to import a cpp code but the structure of my code that is defined as follow:
declarations.h
declarations.cpp
file1.cpp
file2.cpp
file3.cpp
...
most of the functions defined into file1.cpp, file2.cpp , file2.cpp, etc.. present their definitions in declarations.h
As indicated into "Notes on Source Code Import" for EA :"Enterprise Architect automatically searches for the .cpp implementation file based on the extension and search path set in the C++ options; when it finds the implementation file, it can use it to resolve parameter names and method notes as necessary."
In my case when I import the code, EA just only import the operation notes of the functions defined into declarations.cpp and doesn't recognize the operation notes of the functions defined into file1.cpp, file2.cpp, etc..
Is there any kind of configuration in order to solve it and import all of them?
-
The only way EA will be able to import notes from the functions defined in filen.cpp is if you put a comment in the header. EA uses matching pairs of header and implementation files when identifying implementations for functions.
-
Yes, I have comments in the header for all function declarations but the problem is that if the the function definition file name (*.cpp) doesn't present the same name of the function declaration file name (*.h) EA doesn't import the comment.
As I mentioned for the example:
declarations.h
declarations.cpp
file1.cpp
file2.cpp
file3.cpp
all notes (in declarations.h) of the functions defined in declarations.cpp are correctly imported, but the notes (in declarations.h) of the functions defined in file1.cpp, file2.cpp, file3.cpp are not imported.
-
I think what Eve means is that you have to have a file1.h file as well, even if it only contains comments.
Geert
-
When parsing C++ EA looks primarily at header files. When processing a header it will also search for a single matching implementation file, it then looks for a matching definition for any declarations it finds.
It will not find a definition (and therefore any comment associated with it) when the implementation file doesn't match the header file.
I suspect that EA is configured to only read notes from the implementation file.
Check the options in Start > Desktop > Preferences > Source Code Engineering > C++.
You'll find 'Method Notes in Header' and 'Method Notes in Implementation'.