powerdesigner

How to keep certain regions of code in powerdesigner?


I have an OOM model with a few classes that will be transformed into C++ code.

I want certain sections (ie. custom #includes in .cpp files) to remain untouched when I re-generate the code from the model. However if I modify the model and generate the code again this defines & includes are lost.

Found nothing looking at the docs for macros or variables that may be of help.

Can anyone help?


Solution

  • In the Script tab of a class property sheet, there is a Imports subtab. Looking in the Object Language Definition, this attribute does not seem to be used anywhere.

    I managed to use it by editing the Profile\Class\Templates\Source\includes_cpp template in the Language definition, adding %Imports% at the end.

    After that, this Imports appears in the generated source:

    #include "Class_2.h"
    #include "Class_1.h"
    MY INCLUDES