Setting C++ in Astah

Astah Professional and UML support modeling in Java, C++, and C#.
If you are modeling in C++, set so in Astah first.

  1. Select a root package on a tree and check [C++] in the bottom pane.

    2. Setting this as C# will enable you to C#-specific attributes for Classes, Attributes, and Operations in the [Language] tab.
    C++ in Astah

Import C++ Source Code

You can import C# source code by using this C++ Reverse Plug-in (free).

section divider

Export C++ Source Code

Astah generates C++ Skeleton Code from selected Diagram Elements.
The definitions of classes and operations are exported as Documentation Comments.

1. Go to [Tools] – [C++] – [Export C++] in the Main Menu.
Export CPlus Menu

2. Select the target folder, target classes you’d like to export by moving them to the “Selected List” from the “Candidate List”. Click [OK]. And make sure you choose the correct charset.
Export C++ code in Astah

3. The source code files would be generated.
If there are source code files that have the same name, the source code files would be completely replaced with what you last export.
If you do not want the latest export to overwrite the whole source code and you want to keep any modifications you’ve made to the .java files, check [When overwriting, keep the information of existing code that is not in the model.] option.
C++ Code Option

C++ Options



Export #ifndef, #define, #endif in header file.
Export #ifndef, #define and #endif to a header file.
Include list
Export a list divided by , (comma) to a header file and a resource file

i.e.)When exporting string, vector:

#include <string>

#include <vector>
Header file extension
Specify the header file extension (h, hxx)
Source file extension
Specify the source file extension (cpp, cxx)