The following table lists the stereotypes of the profile and their related properties and types.
| Stereotype | Applies to | Properties | Type |
|---|---|---|---|
| «cpp_assignment» | Operations | isInline | Boolean with a default value of false |
| «cpp_body_comment» | Comments that you want to appear in the source code, such as comments for functions and static variables | ||
| «cpp_constructor» | Operations | isExplicit, isInline | Boolean with a default value of false |
| «cpp_copy_constructor» | Operations | isExplicit, isInline | Boolean with a default value of false |
| «cpp_dependency» | Dependency relationships | isInclusionInHeader | Boolean with a default value of false; if the value is set to true, it generates an #include directive in the header file |
| «cpp_destructor» | Operations | isVirtual, isInline | Boolean with a default value of false |
| «cpp_friend» | Dependency relationships | Generates an #include directive in the header file | |
| «cpp_generalization» | Generalization relationships, InterfaceRealization relationships | GeneralizationKind | Enumeration with public, protected, private, and default values (0-public, 1-protected, 2-private, 3-default) |
| isVirtual | Boolean with a default value of false; indicates virtual inheritances | ||
| «cpp_namespace» | Packages | NamespaceName | String |
| «cpp_operation» | Operations | isInline | Boolean with a default value of false; if the value is set to true, it generates the operation as inline and adds the operation body to the corresponding header file |
| isVirtual | Boolean with a default value of false; if the value is set to true, it generates the operation as a virtual function | ||
| isFriend | Boolean with a default value of false; if the value is set to true, it generates a friend operation | ||
| «cpp_properties» | Classes, Interfaces, or Enumerations | bodyFileExtension | C++ body file with the specified extension |
| headerFileExtension | C++ header file with the specified extension For
example, to generate code for a C++ template class in a header file that has
.inc as a file name extension, you can apply this stereotype to the class,
and set this property to ".inc".
Note: You must associate the .inc file name
extension to a C++ header file so that the C/C++ Development Tools recognize .inc as a valid C++ file name extension.
|
||
| «cpp_struct» | Classes | ||
| «cpp_type» | Properties, Parameters | arrayDimensions | String; typically used for specifying multidimensional
arrays that are not supported in UML 2.0. For example, for a property: [10][20]; for a non-return type parameter: [][10] |
| InitializerKind | Enumeration with constructor and assignment
values (0-constructor) If InitializerKind is set to 0, the transformation generates a constructor initializer If InitializerKind is set to 1, the transformation generates an assignment statement in the constructor |
||
| isAuto, isMutable, isRegister, isVolatile | Boolean with a default value of false | ||
| qualifier | String; contains the part of a C++ type that
cannot be modeled in UML, and that appears before the variable name and after
the type, such as ** and & For example, const int **a[12][33] can
be represented by these items:
|
||
| «cpp_typedef» | Classes | arrayDimensions | String |
| ImplementationType | Specifies the type to which the typedef refers;
can be a primitive type or a user-defined type. User-defined types can be fully qualified or not. If a type name is not fully qualified, the scope of the typedef is applied to the user-defined type. |
||
| qualifier | Specifies pointer types, constants, and so
on For example, the transformation generates const int **Typedef1[12][13] for
the following UML element:
|
||
| «cpp_union» | Classes | isAnonymousUnion | Boolean with a default value of false |
| UML element | Transformation output |
|---|---|
![]() |
Class1.cpp:#include "Class1.h"
//Begin section for file Class1.cpp
//TODO: Add definitions that you want preserved
//End section for file Class1.cpp
//@generated "UML to C++ (com.ibm.xtools.transform.uml2.cpp.CPPTransformation)"
Class1::Class1() :
attribute1(5)
{
//TODO Auto-generated method stub
attribute2 = true;
}
|