The following code generation elements have customizable templates:
Template |
Supported Elements |
Note |
Class |
Class |
|
Include |
"Usage" relationship, auto-inclusions (generalizations, instantiated classes) |
Header: forward reference template; Body: inclusion template |
Include from Namespace |
Same as "Include", but for included objects that reside in explicitly defined namespaces |
Same as "Include" |
Enumeration |
Enumeration |
Header only |
Instantiated Class |
Class with "Binding" relationship |
Header only |
Typedef Declaration |
Class with cpp_typedef stereotype |
Header only |
Namespace |
Package, Model |
Header only |
File |
Generated header files |
Header only |
Visibility |
Change of visibility in the class definition |
Header only |
Property |
Class attribute |
Body portion is applied to definitions of static attributes placed in the body files |
Operation |
Class operation |
|
Inline operation |
Class operations with isInline set to true |
Header only |
Constructor |
Class operation with stereotype cpp_constructor |
|
Inline Constructor |
Class operation with stereotype cpp_constructor and property isInline set to true |
Header only |
Copy Constructor |
Class operation with stereotype cpp_copy_constructor |
|
Inline Copy Constructor |
Class operation with stereotype cpp_copy_constructor and property isInline set to true |
Header only |
Destructor |
Class operation with stereotype cpp_destructor |
|
Inline Destructor |
Class operation with stereotype cpp_destructor and property isInline set to true |
Header only |
Assignment operation |
Class operation with stereotype cpp_assignment |
|
Inline Assignment operation |
Class operation with stereotype cpp_assignment and property isInline set to true |
Header only |
You can use the following tags in code templates:
Common tags
Name |
Description |
Used by templates |
name |
Object name |
All header templates, inclusion body, namespace inclusion body, property body |
body |
Object body (can be created from the set of other templates or hard-coded) |
Class header and body, enumeration header, namespace header, file body |
comment |
Comments |
Headers of: class, enumeration, property, operation, instantiated class, typedef header |
del |
The line should be deleted as long as it only contains white spaces and this tag |
All |
left |
Lines generated for this tag will be left-aligned in the scope of it's template |
All |
Special tags
Name |
Description |
Used by templates |
includes |
Inclusion declarations |
Class header and, instantiated class, typedef header |
template |
Template declaration |
Class header, operation body |
class |
"Class" keyword (class/ union/ struct/ enum) |
Class header, inclusion header and body, namespace inclusion header and body, instantiated class header |
inheritance |
Inheritance string(s) |
Class header |
definitions |
Declarations of static attributes |
Class body |
params |
Actual template class parameters |
Instantiated class header |
type |
C++ type of the object |
Property header, property body, operation header, operation body |
array |
Array definition (for example, [5]) |
Property header |
initial_value |
Initial value of the property |
Property body |
prefix |
Operation prefix declaration: [inline] [friend|static|virtual] |
Operation header |
arguments |
List of operation's arguments |
Operation header and body |
qualifier |
Operation suffix declaration:[const] [= 0] |
Operation header and body |
long_name |
Operation's name including the containing class(es) |
Operation body |
initialize |
Constructor's initialization string |
Constructors: headers and bodies |
assignment |
Assignment operator assignment block |
Assignment operator header and body |
return |
Default return statement |
Operation header and body |
namespace_name |
Name of the namespace in which the included object resides |
Namespace inclusion header and body |