Specifying code generation preferences for UML-to-C++ transformations

You can set preferences for the output of UML-to-C++ transformations. For example, you can specify that the transformation suppresses the full path name of header files in the include directives in the generated code, and specify that the transformation generates header and source files in separate folders in the target project.

To specify preferences for the output of UML-to-C++ transformations:

  1. In the Project Explorer view, right-click a transformation configuration file; then click Open.
  2. Click the Properties tab.
  3. On the Properties page, in the Code generation properties section, complete one or more of the following steps:
    • To specify that the transformation suppresses the full path name of include files in the include directives in the generated code, select the Suppress path names in include directives check box.

      If you select this check box, the path name that you specify in the include option of the makefile is implied. For example, if the full path name of the header file is Package1/header1.h and you select this check box, the generated include directive is #include header1.h. If you do not select this check box, the generated include directive is #include Package1/header1.h.

    • To specify that the transformation generates header files and source files in different folders in the target project, select the Create separate folders for header and source files check box, and specify folder names in the Folder for header files and Folder for source files fields. If you specify folders that do not exist in the target project, the transformation creates these folders the next time that you run the transformation.
      Note: If you select the Create separate folders for header and source files check box, you must also select the Suppress path names in include directives check box.
  4. Click File > Save.
Note: If you create a new transformation configuration, you can specify this information on the Properties page of the New Transformation Configuration wizard.

If you select the Create separate folders for header and source files check box, in the source file folder that you specify, the transformation generates the files in the same hierarchy as the source UML model. The transformation does not preserve the source model hierarchy for header files. For example, assume a UML model contains a package called Package1, which contains a class called Class1. If you specify HeaderFolder and SourceFolder as the folder names for the generated header and source files, the transformation generates a file called Class1.h in the HeaderFolder folder structure of the target project, and a file called Class1.cpp in the SourceFolder/Package1 folder structure of the target project.

Related tasks
Running UML-to-C++ transformations
Running UML-to-C++ transformations in silent mode
Generating debugging information for UML-to-C++ transformations

Feedback