Code templates are editable strings that you can use to specify
formatting such as the spacing and indentation of the C++ code that the UML-to-C++
transformation generates from a UML model. You can also use code templates
to control the code that the transformation generates at a basic level. For
example, you can use a code template that replaces tags in the header of a
class with values for the name and body of the class.
Before you apply the UML-to-C++ transformation, you should read the
information that is available at . From the
Transformations/Configurations list,
select
UML to C++. On the
Transformation
Description page, click
View Transformation Documentation.
You
must be in the Modeling perspective.
To specify the format of C++ code that the transformation generates:
- Click .
- Expand Modeling, expand Transformations,
and click UML to C++ Transformation.
- Click the Templates tab.
- On the Templates page, from the Configure
generated code list, select a template.
- To edit the header section of a template, in the Header field,
type your changes.
- To edit the body section of a template, in the Body field,
type your changes.
- Optional: To display a message when a new version of
a modified template is available, select the Show warning when
an updated template set is available check box. The message is displayed when you open the Templates page
of the Preferences window and when you run a C++ transformation.
- Click OK.
The edited templates are applied the next time that you run this transformation
configuration.