Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraradermache2013-05-02 05:50:51 -0400
committeraradermache2013-05-02 05:50:51 -0400
commit0d087549a375c1aa8e3f9fcc3e2d05c1363daeec (patch)
tree7ffca6df7d085a77ef5c327621dae3423ec76f7d /extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util
parente6db544a6cf05a3a6568f93c786e2bce183a72cf (diff)
downloadorg.eclipse.papyrus-0d087549a375c1aa8e3f9fcc3e2d05c1363daeec.tar.gz
org.eclipse.papyrus-0d087549a375c1aa8e3f9fcc3e2d05c1363daeec.tar.xz
org.eclipse.papyrus-0d087549a375c1aa8e3f9fcc3e2d05c1363daeec.zip
Naming convention: prefix source packages in FCM and CPP profile with org.eclipse.papyrus.
Diffstat (limited to 'extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.mtl (renamed from extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeImplementation.mtl)38
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl4
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl12
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl4
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl14
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl2
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl2
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl18
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl8
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl2
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl2
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl4
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl4
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.mtl (renamed from extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperationDeclaration.mtl)35
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl10
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeDeclaration.mtl21
16 files changed, 96 insertions, 84 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeImplementation.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.mtl
index 57aae8be4d8..5c7d14b36ab 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeImplementation.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.mtl
@@ -1,35 +1,47 @@
-[module CppAttributeImplementation('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[module CppAttribute('http://www.eclipse.org/uml2/4.0.0/UML')/]
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
[import org::eclipse::papyrus::cpp::codegen::utils::Modifier/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
-[comment
-// for static implementation:
-// If attribute is aggregation then generate a pointer
- if (GenUtils.isAggregation(currentAttribute)) {
- // attributeName = "(*"+attributeName+")"; // this produce a pointer on a tab
- isAgg = "*"; // this produce a tab of pointers
- }
-/]
+[template public defaultValue(attribute : Property)]
+[if (defaultValue <> null) and isStatic] = [attribute.defaultValue.stringValue()/][/if]
+[/template]
+
+
+[template public staticValue(attribute : Property)]
+[if (attribute.isStatic)]static [/if]
+[/template]
+
+
+[template public CppAttributeDeclaration(attribute : Property)]
+[CppElementDoc()/]
+[staticValue()/][modConst()/][attribute.type.qualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/];
+[/template]
+
[template public CppAttributeImplementation(attribute : Property)]
[CppElementDoc()/]
- [modConst()/][attribute.type.qualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/];
+ [modConst()/][attribute.type.qualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/];
[/template]
[template public CppStaticAttributeImplementation(attribute : Property)]
- [CppElementDoc()/]
- [type.qualifiedName()/][modPtr()/][modRef()/][attribute.class.name/]::[attribute.name/][modArray()/];
+[CppElementDoc()/]
+[type.qualifiedName()/][modPtr()/][modRef()/] [attribute.class.name/]::[attribute.name/][modArray()/][defaultValue()/];
[/template]
+
[comment
Loop over attributes. Check that the attribute is not a static const.
Constant static attributes are declared within the class declaration/]
[template public CppStaticAttributes(classifier : Classifier)]
+[constStaticAttributes()/]
[for (classifier.attribute)]
[if(isStatic and (not hasStereotype(C_Cpp::Const)))]
- [CppStaticAttributeImplementation()/]
+[CppStaticAttributeImplementation()/]
+
[/if]
[/for]
[/template]
+
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl
index 644096558af..f5bb7f53e53 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl
@@ -3,8 +3,8 @@
[template public CppElementDoc(argument : Element)]
-/**
- * [getComments().replaceAll('\n', '\n * ')/]
+/**
+ * [getComments().replaceAll('\n', '\n * ')/]
*/
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl
index 97f7653d5c2..75f027b6d16 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl
@@ -1,14 +1,14 @@
-[module CppEnumerations('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[module CppEnumerations('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/]
[template public CppEnumerationDefinition(enum : Enumeration)]
[CppElementDoc()/]
enum [enum.name/] {
-[for (ownedLiteral)]/
+[for (ownedLiteral)]
[CppElementDoc()/]
- [name/][if hasStereotype(CppInit)] = [getApplication(CppInit).oclAsType(CppInit).value/][/if],
-[/for]
-};
-
+ [name/][if hasStereotype(CppInit)] = [getApplication(CppInit).oclAsType(CppInit).value/][/if],
+[/for]
+};
+
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl
index 28072961454..e8adc6eb5c6 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl
@@ -1,4 +1,4 @@
-[module CppPrimitiveTypes('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[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/]
@@ -25,5 +25,5 @@ typedef [getApplication(Typedef).oclAsType(Typedef).definition.replaceAll('typeN
/][if (not getApplication(Typedef).oclAsType(Typedef).definition.contains('typeName'))] [primitiveType.name/][/if];
[else]
[getStdtypes(primitiveType)/];
-[/if]
+[/if]
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl
index 0cb88942a45..d7c7786cc02 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl
@@ -17,10 +17,22 @@ endif
[template public templateSignature(class : Classifier)]
[if isTemplate()]
-template<[for (getTemplateParameters()) separator(', ')][getType()/][/for]> [/if]
+template<[for (getTemplateParameters()) separator(', ')][getType()/][/for]>
+[/if]
+[/template]
+
+
+[template public templateShortSignature(class : Classifier)]
+[if isTemplate()]
+<[for (getTemplateParameters()) separator(', ')][getName()/][/for]> [/if]
[/template]
[template public templateSignature(operation : Operation)]
[owner.oclAsType(Classifier).templateSignature()/]
+[/template]
+
+
+[template public templateShortSignature(operation : Operation)]
+[owner.oclAsType(Classifier).templateShortSignature()/]
[/template] \ No newline at end of file
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl
index 0b184a07bc2..b3e0089002a 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl
@@ -1,6 +1,6 @@
[module CppClassAttributesDeclaration('http://www.eclipse.org/uml2/4.0.0/UML')/]
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::util::property::CppAttributeDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppAttribute/]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl
index 8477e8483dc..8b7b07755d8 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl
@@ -3,7 +3,7 @@
[template public CppClassFriendDeclaration(friend : Classifier)]
-friend class [friend.qualifiedName()/];
+friend class [friend.qualifiedName()/];
[/template]
[template public CppClassIncludeFriendDeclaration(class : Classifier)]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl
index 8db26305532..c2e57b0864c 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl
@@ -1,13 +1,13 @@
-[module CppClassIncludeClassDeclaration('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[module CppClassIncludeClassDeclaration('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::utils::ClassUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeDeclaration/]
[comment USED??? /]
[template public CppClassIncludeClassDeclarationTemplate(class : Class)]
-[openNS()/]
-[if hasStereotype(class, 'CppTemplate.class')]template [/if]class [class.name/];
-[closeNS()/]
+[openNS()/]
+[if hasStereotype(class, 'CppTemplate.class')]template [/if]class [class.name/];
+[closeNS()/]
[/template]
@@ -21,7 +21,15 @@
[template public CppClassAllIncludesDeclaration(class : Classifier)]
-[for (cl : Classifier | includedClassifiers())]
+[CppClassAllIncludesDeclaration(includedClassifiers())/]
+[/template]
+
+[template public CppClassAllIncludesDeclarationBody(class : Classifier)]
+[CppClassAllIncludesDeclaration(getDependencies())/]
+[/template]
+
+[template public CppClassAllIncludesDeclaration(class : Classifier, list : Sequence(Classifier) )]
+[for (cl : Classifier | list)]
[comment Only add include if this is not for the current class and if it does not have the stereotype "CppNoCodeGen", unless
it has stereotype "CppExternalClass"/]
[if((cl <> class) and (not hasStereotype(NoCodeGen)) or hasStereotype(ExternClass))]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl
index 9634496107a..6086e5d1951 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl
@@ -1,4 +1,4 @@
-[module CppClassIncludeDeclaration('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[module CppClassIncludeDeclaration('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::preferences::CppCodeGenUtils/]
@@ -8,12 +8,14 @@ if (hasStereotype(Template)) then
getApplication(Template).oclAsType(Template).declaration
else
if (hasStereotype(ExternClass)) then getApplication(ExternClass).oclAsType(ExternClass).name
- else ne.name + '.' + getHeaderSuffix()
+ else
+ -- standard case (no stereotypes are applied)
+ getNearestPackage().getFullPath() + '/' + ne.name + '.' + getHeaderSuffix()
endif
endif
/]
[comment TODO: original code did not use nearest package, if stereotype CppRoot was applied/]
[template public CppClassIncludeDeclaration(ne : NamedElement)]
-#include <[getNearestPackage().getFullPath()/]/[ne.includeName()/]>
+#include <[ne.includeName()/]>
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl
index 22eb62b8de0..bc74fb1d96d 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl
@@ -1,4 +1,4 @@
-[module CppClassInheritedDeclarations('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[module CppClassInheritedDeclarations('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/]
[comment
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl
index e15580adddf..fc53a585cb6 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl
@@ -1,6 +1,6 @@
[module CppClassOperationsDeclaration('http://www.eclipse.org/uml2/4.0.0/UML')/]
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppOperationDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppOperations/]
[template public CppClassOperationsDeclaration(class : Classifier, visibilityFilter : VisibilityKind)]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl
index aeaf01f3fe6..c39be30ad8d 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl
@@ -1,6 +1,6 @@
-[module CppClassOperationsImplementation('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[module CppClassOperationsImplementation('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::operation::CppOperationDeclaration/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppOperations/]
[comment implementations of a classifier, parameter controls whether only inline (or only not inline) operations
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl
index 50f2a7c4928..aabc4832534 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl
@@ -1,4 +1,4 @@
-[module CppClassTypeAndEnum('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1')/]
+[module CppClassTypeAndEnum('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::CppPrimitiveTypes/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppEnumerations/]
@@ -20,7 +20,7 @@
protected:
[TypesAndEnumsForVisibility(VisibilityKind::protected)/]
private:
- [TypesAndEnumsForVisibility(VisibilityKind::private)/]
+ [TypesAndEnumsForVisibility(VisibilityKind::private)/]
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperationDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.mtl
index f37e2687c9d..81c80bce0db 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperationDeclaration.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.mtl
@@ -1,4 +1,4 @@
-[module CppOperationDeclaration('http://www.eclipse.org/uml2/4.0.0/UML', 'http://papyrus/C_CppProfile/1', 'http://www.eclipse.org/uml2/4.0.0/UML/Profile/L2')/]
+[module CppOperations('http://www.eclipse.org/uml2/4.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1', 'http://www.eclipse.org/uml2/4.0.0/UML/Profile/L2')/]
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
[import org::eclipse::papyrus::cpp::codegen::utils::Modifier/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
@@ -17,25 +17,22 @@
[query public ConsDestructorOrVoid(operation : Operation) : String =
-if (hasStereotype(l2::Create)) then
+if hasStereotype(l2::Create) or hasStereotype(l2::Destroy) then
''
else
- if (hasStereotype(l2::Destroy)) then
- '~'
- else
- 'void '
- endif
-endif
-/]
+ 'void '
+endif/]
-[template public CppReturnSpec(operation : Operation)]
-[modConst()/][if (type = null)][ConsDestructorOrVoid()/][else][type.qualifiedName()/] [/if][returnResult().modPtr()/][returnResult().modRef()/]
-[/template]
-
+[query public destructor(operation : Operation) : String =
+if hasStereotype(l2::Destroy) then
+ '~'
+else
+ ''
+endif/]
-[template public CppConstOp(operation : Operation)]
-[if (hasStereotype(operation, 'Const'))] const[/if]
+[template public CppReturnSpec(operation : Operation)]
+[if (type = null)][ConsDestructorOrVoid()/][else][returnResult().modConst()/] [type.qualifiedName()/] [/if][returnResult().modPtr()/][returnResult().modRef()/]
[/template]
@@ -49,8 +46,8 @@ endif
[/template]
[template public CppOperationDeclaration(operation : Operation)]
-[CppOperationDoc()/]
-[InlineTxt()/][virtualTxt()/][staticTxt()/][CppReturnSpec()/] [operation.name/]([CppOperationParameters()/])[CppConstOp()/][virtualSuffix()/];
+[CppOperationDoc()/]
+[InlineTxt()/][virtualTxt()/][staticTxt()/][CppReturnSpec()/] [destructor()/][operation.name/]([CppOperationParameters(true)/])[modConst()/][virtualSuffix()/];
[/template]
@@ -68,11 +65,11 @@ endif
[template public CppOperationImplementation(operation : Operation)]
[CppOperationDoc()/]
[if (operation.name = 'main')]
-[CppReturnSpec()/][operation.name/]([CppOperationParameters()/]) {
+[CppReturnSpec()/][operation.name/]([CppOperationParameters(false)/]) {
[getBody('C/C++')/]
}
[else]
-[templateSignature()/][InlineTxt()/][CppReturnSpec()/][operation.class.name/]::[operation.name/]([CppOperationParameters()/])[CppConstOp()/][CppConstInit()/] {
+[templateSignature()/][InlineTxt()/][CppReturnSpec()/][operation.class.name/][templateShortSignature()/]::[destructor()/][operation.name/]([CppOperationParameters(false)/])[modConst()/][CppConstInit()/] {
[getBodyInTemplate('C/C++')/]
}
[/if]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl
index 5b5e08e92ca..bf013aa089f 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl
@@ -8,11 +8,13 @@
[if (hasStereotype(C_Cpp::Default))] = [getApplication(C_Cpp::Default).oclAsType(C_Cpp::Default).value/][/if]
[/template]
-[template public CppParameter(parameter : Parameter)]
-[modConst()/][parameter.type.qualifiedName()/][modPtr()/][modRef()/] [parameter.name/][modArray()/][defaultValue()/]
+[comment C++ parameter. Default values are added, if parameter showDefault is true (implementation signature
+ may not repeat default value)/]
+[template public CppParameter(parameter : Parameter, showDefault : Boolean)]
+[modConst()/][parameter.type.qualifiedName()/][modPtr()/][modRef()/] [parameter.name/][modArray()/][if (showDefault)][defaultValue()/][/if]
[/template]
-[template public CppOperationParameters(operation : Operation)]
-[for (ownedParameter->select(direction <> ParameterDirectionKind::return)) separator(', ')][CppParameter()/][/for]
+[template public CppOperationParameters(operation : Operation, showDefault : Boolean)]
+[for (ownedParameter->select(direction <> ParameterDirectionKind::return)) separator(', ')][CppParameter(showDefault)/][/for]
[/template] \ No newline at end of file
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeDeclaration.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeDeclaration.mtl
deleted file mode 100644
index 9a22ee68143..00000000000
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/property/CppAttributeDeclaration.mtl
+++ /dev/null
@@ -1,21 +0,0 @@
-[module CppAttributeDeclaration('http://www.eclipse.org/uml2/4.0.0/UML')/]
-[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
-[import org::eclipse::papyrus::cpp::codegen::utils::Modifier/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
-
-
-
-
-[template public defaultValue(attribute : Property)]
-[if (defaultValue <> null) and isStatic] = [attribute.defaultValue.stringValue()/][/if]
-[/template]
-
-[template public staticValue(attribute : Property)]
-[if (attribute.isStatic)]static [/if]
-[/template]
-
-[template public CppAttributeDeclaration(attribute : Property)]
-[CppElementDoc()/]
-[staticValue()/][modConst()/][attribute.type.qualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/][defaultValue()/];
-[/template]
-

Back to the top