Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e8adc6eb5c678f2a7726683b4ddff2b7ae6302a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
[module CppPrimitiveTypes('http://www.eclipse.org/uml2/4.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1')/]
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]


[comment
 * Support two different kinds of primitive types
 * (1) those that are native types of the programming language such as long
 *     For these, no additional definition has to be done and they should be referenced
 *     with their name only
 * (2) those that correspond to a typedef (e.g. typedef long ErrorType). These require
 *     a typedef definition within the package and need to be referenced with their
 *     fully qualified name (e.g. MyPackage::ErrorType)
 * (3) Sometimes the name of the type defined by a typedef does not appear at the end, e.g.
 *     when defining functionPointers such as "typedef int (*HandlerFct) (void*);"
 *	   (a function with a void* argument returning int)
 *     Support this case via a specific 'typeName' constant that gets replaced by the name of the
 *     type
 */
/]
[template public CppPrimitiveTypeDefinition(primitiveType : PrimitiveType)]
[CppElementDoc()/]
[if (hasStereotype(Typedef))]
typedef [getApplication(Typedef).oclAsType(Typedef).definition.replaceAll('typeName', primitiveType.name)
	/][if (not getApplication(Typedef).oclAsType(Typedef).definition.contains('typeName'))] [primitiveType.name/][/if];
[else]
[getStdtypes(primitiveType)/];
[/if]
[/template]

Back to the top