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
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')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/Architecture3+paper.win.pdfbin0 -> 21816 bytes
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.acceleo2
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl18
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl17
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl7
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl54
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl90
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.mtl34
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl74
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/IncludeUtils.mtl28
-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
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppModelElementsCreator.java14
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.java3
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.java41
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.mtl5
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.java65
31 files changed, 338 insertions, 294 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/Architecture3+paper.win.pdf b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/Architecture3+paper.win.pdf
new file mode 100644
index 00000000000..64fee47b4f1
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/Architecture3+paper.win.pdf
Binary files differ
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.acceleo b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.acceleo
index 8c148cc5dcd..d3da6605d49 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.acceleo
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/build.acceleo
@@ -18,7 +18,7 @@
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
- dependencies="${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;"
+ dependencies="${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.ui.workbench;${target.folder}/../../org.eclipse.papyrus.acceleo;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl
index 2aea121b9e5..32c94e672bb 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl
@@ -2,35 +2,35 @@
[module Constants('http://www.eclipse.org/uml2/4.0.0/UML')]
-[template public includeHFile(dummy : Element)]
+[template public constIncludeHFile(dummy : Element)]
// include associated header file
[/template]
-[template public IncludeHeaderStart(dummy : Element)]
+[template public constIncludeHeaderStart(dummy : Element)]
// Include from Include stereotype (header)
[/template]
-[template public IncludePreBodyStart(dummy : Element)]
+[template public constIncludePreBodyStart(dummy : Element)]
// Include from Include stereotype (pre-body)
[/template]
-[template public IncludePreBodyEnd(dummy : Element)]
+[template public constIncludePreBodyEnd(dummy : Element)]
// End of Include stereotype (pre-body)
[/template]
-[template public IncludeBodyStart(dummy : Element)]
+[template public constIncludeBodyStart(dummy : Element)]
// Include from Include declaration (body)
[/template]
-[template public IncludeHeaderEnd(dummy : Element)]
+[template public constIncludeHeaderEnd(dummy : Element)]
// End of Include stereotype (header)
[/template]
-[template public IncludeBodyEnd(dummy : Element)]
+[template public constIncludeBodyEnd(dummy : Element)]
// End of Include stereotype (body)
[/template]
-[template public derivedIncludes(dummy : Element)]
+[template public constDerivedIncludes(dummy : Element)]
// Derived includes directives
[/template]
@@ -38,7 +38,7 @@
// forward declarations
[/template]
-[template public staticAttributes(dummy : Element)]
+[template public constStaticAttributes(dummy : Element)]
// static attributes (if any)
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl
index da720a05838..a5c2d6f9a17 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl
@@ -1,7 +1,7 @@
[module CppBindBody('http://www.eclipse.org/uml2/4.0.0/UML')/]
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::IncludeUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::CppIncludeUtils/]
[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/]
@@ -15,23 +15,24 @@
[class.name/] template binding body
************************************************************/
-[IncludePreBody()/]
+[CppIncludePreBody()/]
-[includeHFile()/]
-#include <[_package.getFullPath()/][class.name/].[getHeaderSuffix()/]>
+[constIncludeHFile()/]
+#include <[_package.getFullPath()/]/[class.name/].[getHeaderSuffix()/]>
-[IncludeBody()/]
+[CppIncludeBody()/]
[openNS()/]
-[derivedIncludes()/]
+[constDerivedIncludes()/]
[CppClassAllIncludesDeclaration()/]
/************************************************************/
[let tb : TemplateBinding = getTemplateBindings()]
-[let templateElement : Classifier = tb.target->asSequence()->first()]
-template class [templateElement.name/] <[for (tb.parameterSubstitution)][CppTemplateBindingParameter()/][/for]> [class.name/];
+[let templateElement : Element = tb.target->asSequence()->first()]
+template class [templateElement.owner.oclAsType(NamedElement).name/]<[for (tb.parameterSubstitution)][CppTemplateBindingParameter()/][/for]>;
[/let][/let]
+
[closeNS()/]
/************************************************************
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
index 99148264afc..3277519319a 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl
@@ -3,6 +3,7 @@
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/]
[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::CppIncludeUtils/]
[template public CppBindHeader(class : Class)]
@@ -17,15 +18,15 @@
[CppClassAllIncludesDeclaration()/]
-[getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).header/]
+[CppIncludeHeader()/]
[let tb : TemplateBinding = getTemplateBindings()]
-[let templateElement : Classifier = tb.target->asSequence()->first()]
+[let templateElement : Element = tb.target->asSequence()->first()]
#include <[_package.getFullPath()/]/[templateElement.owner.oclAsType(NamedElement).name/].[getHeaderSuffix()/]>
[openNS()/]
/************************************************************/
-typedef [templateElement.name/] <[for (tb.parameterSubstitution)][CppTemplateBindingParameter()/][/for]> [class.name/];
+typedef [templateElement.owner.oclAsType(NamedElement).name/]<[for (tb.parameterSubstitution)][CppTemplateBindingParameter()/][/for]> [class.name/];
[closeNS()/]
[/let][/let]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl
index cf2e1f70034..cf80c016c20 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl
@@ -2,36 +2,38 @@
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::IncludeUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::CppIncludeUtils/]
[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassOperationsImplementation/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::util::property::CppAttributeImplementation/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppAttribute/]
[template public CppClassBody(class : Classifier)]
-#define [getFullName()/]_BODY
-
-/************************************************************
- [class.name/] class body
- ************************************************************/
-
-[IncludePreBody()/]
-
-[includeHFile()/]
-#include <[_package.getFullPath()/]/[class.name/].[getHeaderSuffix()/]>
-
-[IncludeBody()/]
-
-[derivedIncludes()/]
-[CppClassAllIncludesDeclaration()/]
-
-[openNS(class)/]
-[CppStaticAttributes(class)/]
-[CppClassOperationsImplementation(false)/]
-[closeNS(class)/]
-
-/************************************************************
- End of [class.name/] class body
- ************************************************************/
+#define [getFullName()/]_BODY
+
+/************************************************************
+ [class.name/] class body
+ ************************************************************/
+
+[CppIncludePreBody()/]
+
+[constIncludeHFile()/]
+#include <[_package.getFullPath()/]/[class.name/].[getHeaderSuffix()/]>
+
+[CppIncludeBody()/]
+
+[constDerivedIncludes()/]
+[CppClassAllIncludesDeclarationBody()/]
+
+[openNS(class)/]
+[CppStaticAttributes(class)/]
+[if not isTemplate()]
+[CppClassOperationsImplementation(false)/]
+[/if]
+[closeNS(class)/]
+
+/************************************************************
+ End of [class.name/] class body
+ ************************************************************/
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl
index 54920cec07c..16288f40778 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl
@@ -2,7 +2,7 @@
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::IncludeUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::CppIncludeUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassTypeAndEnum/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassFriendDeclaration/]
@@ -40,55 +40,55 @@ in C++ 011/]
[template public CppClassHeader(class : Classifier)]
-#ifndef [getFullNameUC()/]_H
-#define [getFullNameUC()/]_H
-
-/************************************************************
- [class.name/] class header
- ************************************************************/
-
-[_package.CppOwnerPackageIncludeDeclaration()/]
-
-[CppClassAllIncludesDeclaration()/]
-
-[IncludeHeader()/]
-
-[openNS()/]
-[_package.CppClassTypeAndEnumPackage()/]
-/************************************************************/
+#ifndef [getFullNameUC()/]_H
+#define [getFullNameUC()/]_H
+
+/************************************************************
+ [class.name/] class header
+ ************************************************************/
+
+[_package.CppOwnerPackageIncludeDeclaration()/]
+
+[CppClassAllIncludesDeclaration()/]
+
+[CppIncludeHeader()/]
+
+[openNS()/]
+
+/************************************************************/
[CppElementDoc()/]
-[templateSignature()/][classUnionOrStruct()/] [class.name/][CppClassInheritedDeclarations()/] {
-[CppClassIncludeFriendDeclaration()/][CppClassTypeAndEnum()/]
-
- public:
-[defaultInitializer()/][CppClassAttributesDeclaration(VisibilityKind::public)/][CppClassOperationsDeclaration(VisibilityKind::public)/]
-
- protected:
-[CppClassAttributesDeclaration(VisibilityKind::protected)/][CppClassOperationsDeclaration(VisibilityKind::protected)/]
-
- private:
-[CppClassAttributesDeclaration(VisibilityKind::private)/][CppClassOperationsDeclaration(VisibilityKind::private)/]
-
-};
-/************************************************************/
-/* External declarations (package visibility) */
-[CppClassAttributesDeclaration(VisibilityKind::_package)/]
-[CppClassOperationsDeclaration(VisibilityKind::_package)/]
+[templateSignature()/][classUnionOrStruct()/] [class.name/][CppClassInheritedDeclarations()/] {
+[CppClassIncludeFriendDeclaration()/][CppClassTypeAndEnum()/]
+
+ public:
+[defaultInitializer()/][CppClassAttributesDeclaration(VisibilityKind::public)/][CppClassOperationsDeclaration(VisibilityKind::public)/]
+
+ protected:
+[CppClassAttributesDeclaration(VisibilityKind::protected)/][CppClassOperationsDeclaration(VisibilityKind::protected)/]
+
+ private:
+[CppClassAttributesDeclaration(VisibilityKind::private)/][CppClassOperationsDeclaration(VisibilityKind::private)/]
+
+};
+/************************************************************/
+/* External declarations (package visibility) */
+[CppClassAttributesDeclaration(VisibilityKind::_package)/]
+[CppClassOperationsDeclaration(VisibilityKind::_package)/]
/************************************************************/
-[if (isTemplate())]
+[if isTemplate()]
/************************************************************/
/* Template functions */
[CppClassOperationsImplementation(false)/]
[/if]
-
-/* Inline functions */
-[CppClassOperationsImplementation(true)/]
-[closeNS()/]
-
-/************************************************************
- End of [class.name/] class header
- ************************************************************/
-
-#endif
+
+/* Inline functions */
+[CppClassOperationsImplementation(true)/]
+[closeNS()/]
+
+/************************************************************
+ End of [class.name/] class header
+ ************************************************************/
+
+#endif
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.mtl
new file mode 100644
index 00000000000..e2b71dc69de
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.mtl
@@ -0,0 +1,34 @@
+[comment encoding = UTF-8 /]
+[module CppIncludeUtils('http://www.eclipse.org/uml2/4.0.0/UML')]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
+
+[template public CppIncludeHeader(ne : NamedElement)]
+[if (hasStereotype(C_Cpp::Include))]
+[let header : String = getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).header]
+[if (header <> null) and (header.size() > 0)]
+[constIncludeHeaderStart()/]
+[header.cleanCR()/]
+[constIncludeHeaderEnd()/]
+[/if][/let][/if]
+[/template]
+
+[template public CppIncludeBody(ne : NamedElement)]
+[if (hasStereotype(C_Cpp::Include))]
+[let _body : String = getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include)._body]
+[if (_body <> null) and (_body.size() > 0)]
+[constIncludeBodyStart()/]
+[_body.cleanCR()/]
+[constIncludeBodyEnd()/]
+[/if][/let][/if]
+[/template]
+
+[template public CppIncludePreBody(ne : NamedElement)]
+[if (hasStereotype(C_Cpp::Include))]
+[let preBody : String = getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).preBody]
+[if (preBody <> null) and (preBody.size() > 0)]
+[constIncludePreBodyStart()/]
+[preBody.cleanCR()/]
+[constIncludePreBodyEnd()/]
+[/if][/let][/if]
+[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl
index 95a0f6b8e65..a52674ea982 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl
@@ -2,7 +2,7 @@
[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::IncludeUtils/]
+[import org::eclipse::papyrus::cpp::codegen::acceleo::CppIncludeUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassTypeAndEnum/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassFriendDeclaration/]
@@ -12,41 +12,41 @@
[template public CppPackageHeader(pkg : Package)]
-#ifndef PKG_[getFullNameUC()/]
-#define PKG_[getFullNameUC()/]
-
-/************************************************************
- Pkg_[name/] package header
- ************************************************************/
-
-[nestingPackage.CppOwnerPackageIncludeDeclaration()/]
-
-#ifndef _IN_
-#define _IN_
-#endif
-#ifndef _OUT_
-#define _OUT_
-#endif
-#ifndef _INOUT_
-#define _INOUT_
-#endif
-
-
-/* Package dependency header include */
-[for (getUsedPackages())]
-#include <[getFullPath()/]/Pkg_[name/].[getHeaderSuffix()/]>
-[/for]
-
-[IncludeHeader()/]
-
-[openNS()/]
+#ifndef PKG_[getFullNameUC()/]
+#define PKG_[getFullNameUC()/]
+
+/************************************************************
+ Pkg_[name/] package header
+ ************************************************************/
+
+[nestingPackage.CppOwnerPackageIncludeDeclaration()/]
+
+#ifndef _IN_
+#define _IN_
+#endif
+#ifndef _OUT_
+#define _OUT_
+#endif
+#ifndef _INOUT_
+#define _INOUT_
+#endif
+
+
+/* Package dependency header include */
+[for (getUsedPackages())]
+#include <[getFullPath()/]/Pkg_[name/].[getHeaderSuffix()/]>
+[/for]
+
+[CppIncludeHeader()/]
+
+[openNS()/]
[packageTypes()/]
-[CppClassTypeAndEnumPackage()/]
-[closeNS()/]
-
-/************************************************************
- End of Pkg_[name/] package header
- ************************************************************/
-
-#endif
+[CppClassTypeAndEnumPackage()/]
+[closeNS()/]
+
+/************************************************************
+ End of Pkg_[name/] package header
+ ************************************************************/
+
+#endif
[/template]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/IncludeUtils.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/IncludeUtils.mtl
deleted file mode 100644
index cd81da94794..00000000000
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/IncludeUtils.mtl
+++ /dev/null
@@ -1,28 +0,0 @@
-[comment encoding = UTF-8 /]
-[module IncludeUtils('http://www.eclipse.org/uml2/4.0.0/UML')]
-[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
-[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
-
-[template public IncludeHeader(ne : NamedElement)]
-[if (hasStereotype(C_Cpp::Include) and (getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).header.size() > 0))]
-[IncludeHeaderStart()/]
-[getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).header/]
-[IncludeHeaderEnd()/]
-[/if]
-[/template]
-
-[template public IncludeBody(ne : NamedElement)]
-[if (hasStereotype(C_Cpp::Include) and (getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include)._body <> null))]
-[IncludeBodyStart()/]
-[getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include)._body/]
-[IncludeBodyEnd()/]
-[/if]
-[/template]
-
-[template public IncludePreBody(ne : NamedElement)]
-[if (hasStereotype(C_Cpp::Include))]
-[IncludePreBodyStart()/]
-[getApplication(C_Cpp::Include).oclAsType(C_Cpp::Include).preBody/]
-[IncludePreBodyEnd()/]
-[/if]
-[/template]
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]
-
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppModelElementsCreator.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppModelElementsCreator.java
index 7eb3b2ad5d8..c2fdc6c21c7 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppModelElementsCreator.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/transformation/CppModelElementsCreator.java
@@ -15,6 +15,12 @@ import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.papyrus.C_Cpp.CppRoot;
+import org.eclipse.papyrus.C_Cpp.ExternClass;
+import org.eclipse.papyrus.C_Cpp.Include;
+import org.eclipse.papyrus.C_Cpp.ManualGeneration;
+import org.eclipse.papyrus.C_Cpp.NoCodeGen;
+import org.eclipse.papyrus.C_Cpp.Template;
import org.eclipse.papyrus.acceleo.AcceleoDriver;
import org.eclipse.papyrus.acceleo.ModelElementsCreator;
import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils;
@@ -26,13 +32,6 @@ import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Namespace;
import org.eclipse.uml2.uml.Package;
-import C_Cpp.CppRoot;
-import C_Cpp.ExternClass;
-import C_Cpp.Include;
-import C_Cpp.ManualGeneration;
-import C_Cpp.NoCodeGen;
-import C_Cpp.Template;
-
/**
@@ -120,6 +119,7 @@ public class CppModelElementsCreator extends ModelElementsCreator {
// Template Bound Class
if(GenUtils.isTemplateBoundElement(classifier)) {
+ // TODO: Acceleo template is only defined for class (not for all classifiers)
String fileContent = commentHeader + AcceleoDriver.evaluateURI(CppBindHeader, classifier);
createFile(container, classifier.getName() + "." + hppExt, fileContent, true);
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.java
index 301851b5be8..2937137eff4 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.java
@@ -13,11 +13,10 @@ package org.eclipse.papyrus.cpp.codegen.utils;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.UniqueEList;
+import org.eclipse.papyrus.C_Cpp.Include;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
-import C_Cpp.Include;
-
/**
* A set of utility functions related to classes.
*
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.java
index 262f936116c..22f8be68f2b 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.java
@@ -20,6 +20,10 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.C_Cpp.ExternClass;
+import org.eclipse.papyrus.C_Cpp.NoCodeGen;
+import org.eclipse.papyrus.C_Cpp.Typedef;
+import org.eclipse.papyrus.C_Cpp.Visibility;
import org.eclipse.papyrus.cpp.codegen.Constants;
import org.eclipse.uml2.uml.AggregationKind;
import org.eclipse.uml2.uml.Behavior;
@@ -52,11 +56,6 @@ import org.eclipse.uml2.uml.TemplateParameter;
import org.eclipse.uml2.uml.TemplateSignature;
import org.eclipse.uml2.uml.Type;
-import C_Cpp.ExternClass;
-import C_Cpp.NoCodeGen;
-import C_Cpp.Typedef;
-import C_Cpp.Visibility;
-
/**
@@ -88,14 +87,19 @@ public class GenUtils {
return binding;
}
+ /**
+ * Check whether the passed classifier has a template binding with itself as bound element
+ *
+ * @param cl
+ * @return
+ */
public static boolean isTemplateBoundElement(Classifier cl) {
boolean result = false;
- EList<TemplateBinding> tb = cl.getTemplateBindings();
- if(tb != null) {
- Iterator<TemplateBinding> itb = tb.iterator();
- while(itb.hasNext()) {
- TemplateBinding currentTb = itb.next();
- result = currentTb.getBoundElement() == cl;
+ EList<TemplateBinding> tbs = cl.getTemplateBindings();
+ if(tbs.size() > 0) {
+ for (TemplateBinding tb : tbs) {
+ // TODO: will only work for single element in template binding list
+ result = tb.getBoundElement() == cl;
}
}
return result;
@@ -525,7 +529,7 @@ public class GenUtils {
String commentText = "";
for(Comment comment : element.getOwnedComments()) {
// remove eventual CRs (avoid confusion in Acceleo template which adds " *" after line breaks)
- commentText += comment.getBody().replace("\r", "");
+ commentText += cleanCR(comment.getBody());
}
return commentText;
}
@@ -735,8 +739,8 @@ public class GenUtils {
for(String language : ob.getLanguages()) {
String body = bodies.next();
if(language.equals(selectedLanguage)) {
- // additional "\r" confuse Acceleo
- return body.replace("\r", "");
+ // additional "\r" confuses Acceleo
+ return cleanCR(body);
}
}
}
@@ -745,6 +749,15 @@ public class GenUtils {
}
/**
+ * Remove <CR> from a String. These confuse Acceleo's indentation
+ * @param str
+ * @return
+ */
+ public static String cleanCR(String str) {
+ return str.replace("\r", "");
+ }
+
+ /**
* Return the C++ visibility (on generalizations) in text form. Return public, if no stereotype
* visibility exists
*
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.mtl
index c0bc93115e4..9393cad7538 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.mtl
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/GenUtils.mtl
@@ -52,7 +52,7 @@
[query public getComments(arg0 : Element) : String
= invoke('org.eclipse.papyrus.cpp.codegen.utils.GenUtils', 'getComments(org.eclipse.uml2.uml.Element)', Sequence{arg0}) /]
-[query public getDependencies(arg0 : Classifier) : Sequence(Dependency)
+[query public getDependencies(arg0 : Classifier) : Sequence(Classifier)
= invoke('org.eclipse.papyrus.cpp.codegen.utils.GenUtils', 'getDependencies(org.eclipse.uml2.uml.Classifier)', Sequence{arg0}) /]
[query public setStereotype(arg0 : Element, arg1 : String, arg2 : Boolean) : OclVoid
@@ -102,3 +102,6 @@
[query public getUsedClassifiers(arg0 : Classifier) : Sequence(Classifier)
= invoke('org.eclipse.papyrus.cpp.codegen.utils.GenUtils', 'getUsedClassifiers(org.eclipse.uml2.uml.Classifier)', Sequence{arg0}) /]
+
+[query public cleanCR(arg0 : String) : String
+ = invoke('org.eclipse.papyrus.cpp.codegen.utils.GenUtils', 'cleanCR(java.lang.String)', Sequence{arg0}) /]
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.java b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.java
index c9579d7aead..0120620a565 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/Modifier.java
@@ -11,19 +11,19 @@
package org.eclipse.papyrus.cpp.codegen.utils;
+import org.eclipse.papyrus.C_Cpp.Array;
+import org.eclipse.papyrus.C_Cpp.Const;
+import org.eclipse.papyrus.C_Cpp.Ptr;
+import org.eclipse.papyrus.C_Cpp.Ref;
import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils;
import org.eclipse.uml2.uml.AggregationKind;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.MultiplicityElement;
+import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Parameter;
import org.eclipse.uml2.uml.ParameterDirectionKind;
import org.eclipse.uml2.uml.Property;
-import C_Cpp.Array;
-import C_Cpp.Const;
-import C_Cpp.Ptr;
-import C_Cpp.Ref;
-
/**
* Utility functions managing the "modifier" of an element, i.e. additional information whether a passed
@@ -65,66 +65,73 @@ public class Modifier {
/**
* Create instance and initialize the ptr/ref/array/isConst attributes.
*
- * @param propertyOrParameter
+ * @param propertyOperationOrParameter
*/
- public static void update(Element propertyOrParameter) {
+ public static void update(Element propertyOperationOrParameter) {
// Pointer
- Ptr cppPtr = GenUtils.getApplication(propertyOrParameter, Ptr.class);
+ Ptr cppPtr = GenUtils.getApplication(propertyOperationOrParameter, Ptr.class);
if(cppPtr != null) {
- ptr = (cppPtr.getDeclaration() != null) ? cppPtr.getDeclaration() : "*";
+ ptr = (cppPtr.getDeclaration() != null) ? cppPtr.getDeclaration() : "*"; //$NON-NLS-1$
} else {
- ptr = "";
+ ptr = ""; //$NON-NLS-1$
}
- if (propertyOrParameter instanceof Property) {
- if (((Property) propertyOrParameter).getAggregation() == AggregationKind.SHARED_LITERAL) {
- ptr += "*";
+ if (propertyOperationOrParameter instanceof Property) {
+ if (((Property) propertyOperationOrParameter).getAggregation() == AggregationKind.SHARED_LITERAL) {
+ ptr += "*"; //$NON-NLS-1$
}
}
// Ref
- ref = GenUtils.hasStereotype(propertyOrParameter, Ref.class) ? "&" : "";
- boolean ptrOrRef = GenUtils.hasStereotype(propertyOrParameter, Ref.class) ||
- GenUtils.hasStereotype(propertyOrParameter, Ptr.class);
+ ref = GenUtils.hasStereotype(propertyOperationOrParameter, Ref.class) ? "&" : ""; //$NON-NLS-1$ //$NON-NLS-2$
+ boolean ptrOrRef = GenUtils.hasStereotype(propertyOperationOrParameter, Ref.class) ||
+ GenUtils.hasStereotype(propertyOperationOrParameter, Ptr.class);
// Array
- Array cppArray = GenUtils.getApplication(propertyOrParameter, Array.class);
+ Array cppArray = GenUtils.getApplication(propertyOperationOrParameter, Array.class);
if(cppArray != null) {
// explicit array definition
- array = (cppArray.getDefinition() != null) ? cppArray.getDefinition() : "[]";
+ array = (cppArray.getDefinition() != null) ? cppArray.getDefinition() : "[]"; //$NON-NLS-1$
} else {
// calculate array from multiplicity definition
int multiplicity = 1;
- if(propertyOrParameter instanceof MultiplicityElement) {
- multiplicity = ((MultiplicityElement)propertyOrParameter).getUpper();
+ if(propertyOperationOrParameter instanceof MultiplicityElement) {
+ multiplicity = ((MultiplicityElement)propertyOperationOrParameter).getUpper();
}
- array = "";
+ array = ""; //$NON-NLS-1$
if(multiplicity == -1) {
- ptr += "*";
+ ptr += "*"; //$NON-NLS-1$
} else if(multiplicity > 1) {
- array = "[" + multiplicity + "]";
+ array = "[" + multiplicity + "]"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
// out an inout parameter are realized by means of a pointer
- if(propertyOrParameter instanceof Parameter) {
- ParameterDirectionKind directionKind = ((Parameter)propertyOrParameter).getDirection();
+ if(propertyOperationOrParameter instanceof Parameter) {
+ ParameterDirectionKind directionKind = ((Parameter)propertyOperationOrParameter).getDirection();
if(directionKind == ParameterDirectionKind.IN_LITERAL) {
- ptr += " _IN_";
+ ptr += " _IN_"; //$NON-NLS-1$
}
else if(directionKind == ParameterDirectionKind.OUT_LITERAL) {
- ptr += " _OUT_";
+ ptr += " _OUT_"; //$NON-NLS-1$
if(!ptrOrRef) {
ptr += CppCodeGenUtils.getOutInoutOp();
}
}
else if(directionKind == ParameterDirectionKind.INOUT_LITERAL) {
- ptr += " _INOUT_";
+ ptr += " _INOUT_"; //$NON-NLS-1$
if(!ptrOrRef) {
ptr += CppCodeGenUtils.getOutInoutOp();
}
}
}
// Const
- isConst = GenUtils.hasStereotype(propertyOrParameter, Const.class) ? "const " : "";
+ if (GenUtils.hasStereotype(propertyOperationOrParameter, Const.class)) {
+ isConst = (propertyOperationOrParameter instanceof Operation) ?
+ " const" : // added at the end of operation, prefix with " " //$NON-NLS-1$
+ "const "; // before operation or parameter, postfix with " " //$NON-NLS-1$
+ }
+ else {
+ isConst = ""; //$NON-NLS-1$
+ }
}
}

Back to the top