Specifying the format of C++ code that the transformation generates

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 Modeling > Transform > Configure Transformations. 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:
  1. Click Window > Preferences.
  2. Expand Modeling, expand Transformations, and click UML to C++ Transformation.
  3. Click the Templates tab.
  4. On the Templates page, from the Configure generated code list, select a template.
  5. To edit the header section of a template, in the Header field, type your changes.
  6. To edit the body section of a template, in the Body field, type your changes.
  7. 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.
  8. Click OK.
The edited templates are applied the next time that you run this transformation configuration.
Related concepts
UML-to-C++ transformation
UML-to-C++ transformation templates
Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.