Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: Sébastien P on June 24, 2011, 08:01:16 pm
-
Hi,
I would like to use the code generation with a customized C++ language.
So I created a new language included in a MDG technology.
The customization of C++ Code Template with specific naming rules is not easy but it is working, except Import Section in header and implement file.
For default C++ I get generation of dependencies in header file from Class diagram, and also dependencies and namespaces in implement file.
However for my custom language I can't get any include files or namespaces, even if I add manually include data in Imports or Headers Code Gen dialog.
It seems Field Substitution Macros %fileImports% and %fileHeaders% in Code Generation Template are not supported in my custom language.
Does anyone already get this issue?
Sébastien
-
Use a list over import templates.
-
Simon,
By default for c++ code generation, in the "Import Section" template there is no list.
Only the field substitution macro %fileImport% is used, as shown in the following piece of code:
$COMMENT="WARNING: THIS IS AN ADVANCED TEMPLATE"
$COMMENT="DO NOT MODIFY UNLESS YOU ARE AN"
$COMMENT="ADVANCED USER!"
%fileImports%
Even if I would use a list, I don't really see a list of what I need to do.
I would like to use the field substitution macro %fileImport% in my custom C++, as it works in the default C++ language. Why it is not working in my custom language?
Here is the extract of the definition of fileImports:
Code Gen dialog: Imports. For supported languages this also includes dependencies derived from associations.
As said in the help there is 2 contents:
- the static content of Code Gen dialog -> Imports.
- the dynamic content from associations
As a first exercise, I would like to be able to retrieve in my generate source code the static content I wrote in Imports dialog of my class from the class diagram.
The field substitution macro is not specific to the default C++ language. That should works in every others languages (custom or not), isn't it?
Sebastien
-
PHP uses the list.
-
Ok I succeeded to retrieve my static "include" file and dynamic dependency files with the piece of code from PHP.
I'm preempted by more urgent works, so I didn't take the time to well format my generated code but I believe it's Ok.
Thanks Simon