Specifying the format of C++ code generated by the C++ transformation

Code templates are editable strings that you can use to specify formatting such as the white space and indentation of generated C++ code. You can also use code templates to control the actual code that the C++ 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.

To specify the format of C++ code generated by the C++ transformation:
  1. Click Window > Preferences.
  2. Expand Modeling, expand Transformations, click UML to C++ Transformation.
  3. Click the Templates tab.
  4. On the Templates page, in the Configure generated code list, click 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. To display a message when a new version of a modified template is available, select Show warning when an updated template set is available.
    Note: 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.

Parent topic: Generating C++ code from a model

Related concepts
C++ transformation
C++ transformation templates

Terms of use | Feedback
(C) Copyright IBM Corporation 2004, 2005. All Rights Reserved.