Previewing element code

 

Objecteering C++ Developer provides a convenient new feature used to preview the C++ code that will be generated for a selected model element.

 

To preview code, all you have to do is click on the  "Preview" button in the element's C++ edition dialog box.  Objecteering C++ Developer then renders the C++ code according to the element properties that are currently set in the dialog box.  This means that you can immediately observe the effect of your input on the generated code and consequently avoid errors during the early stages of C++ application development.

 

For example, let's edit the properties of the "subTask" association end in the "Task" class.   We will first preview the code that will be generated for this element (Figure 27).

 

Figure 27. Previewing the code that will be generated for the "subTask" association end

 

 

We will now add the pointer specifier to this element, and change the collection type to list. By clicking on the  "Preview" button, we can immediately observe the effect of this change on the "subTask" declaration (Figure 28).

 

Note 1:   The code preview function is implemented by specific code preview templates.  These preview templates are consistent with code generation templates, so preview is always consistent with the generated code, even if the generation templates are modified.

 

Note 2:   You can define your own code preview templates using the Objecteering C++ Developer platform development feature.

 

Figure 28. Previewing the code that will be generated for the "subTask" association end after modification