[module CppPrimitiveTypes('http://www.eclipse.org/uml2/4.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1')/] [import org::eclipse::papyrus::acceleo::GenUtils/] [import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/] [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]