The user can view C++ code generated for a selected model element by using the
"Edit header" and
"Edit body" buttons in the “C++” property view.
The “Edit header” and “Edit body” buttons in the “C++” property view
Let’s use these buttons to view the code generated for our “SimpleProject” class. We can see C++ constructors, operators and destructors generated from the model-level Coplien pattern, as well as “TODO” notes.
First of all, click on the "Edit header"
button to view the header file code generated for the “SimpleProject” class.
Code editor on the header file
Next, click on the "Edit body" button to
view the body file code generated for the “SimpleProject” class.
Code editor on the body file
The //begin of modifiable zone....
type of comment provides the markup
used to ensure model/code consistency. You can enter your code between
markups, and this code is then transferred back into the model to the
respective C++ code notes when the editor is saved. The code is read only
outside the marked zone, preventing unwanted modifications in the model.
Note: We recommend that the “Edit header” and “Edit body” buttons be used to enter implementation code, and that the code preview function be used to examine how UML model elements and their C++ properties (entered manually or deduced automatically) are translated to C++ code.