Setting preferences for UML-to-C++ transformations

You can set warning and code formatting preferences for UML-to-C++ transformations. For example, you can specify C++ preface and closing comments, and specify indentation style preferences.

You can specify the comments that the transformation inserts at the beginning and end of the files that it generates. The text that you specify is inserted into the source code exactly as it appears in the text area. You must include the appropriate C++ comment notation. For example, you can specify copyright information, or other authoring information that must appear in each source file. You can also select formatting preferences for tab spacing, the display order of class attributes and operations, and indentation styles.

To set preferences for the UML-to-C++ transformation:

  1. Click Window > Preferences.
  2. In the Preferences window, expand Modeling > Transformations.
  3. Optional: To specify comment and code formatting preferences, click UML to C++ transformation, and complete one or more of the following steps:
    • To specify file preface and closing comments, click the General tab, and type the comments in the appropriate text field.
    • To set code formatting preferences, click the Edit styles tab, and complete one or more of the following steps:
      • To display class attributes followed by operations, with both sorted by C++ visibility rules, click Sort by visibility.
      • To display class attributes and operations in the same order as they are stored in the UML model, click Sort by storage.
      • To specify an indentation style for the code that the transformation generates, click an option in the Indentation styles pane. The style that you select, combined with the value that you specify for the Tab spaces field, determines the actual indentation of the code that the transformation generates.
  4. Optional: To specify that the transformation display a warning message before replacing source UML model elements with pointers to the generated elements, click UML Visualization and select the Show warning when replacing UML elements check box.
    Note: If you select this check box, for the appropriate transformation configuration, on the Common page of the transformation configuration editor or wizard, you must also select the Replace UML elements check box.
  5. Click Apply and click OK.
The transformation applies the preferences the next time that you run the transformation.
Related concepts
UML-to-C++ transformations
Related tasks
Replacing source model elements with shortcuts to UML-to-C++ transformation output
Related reference
Interpretation of UML model elements by UML-to-C++ transformations

Feedback