From 1cae46ac29d814b0441f09f7da4e36802a02fd2d Mon Sep 17 00:00:00 2001 From: Ansgar Radermacher Date: Fri, 5 Sep 2014 14:40:19 +0200 Subject: 443404 - [C++ codegen] Code generation should be based on xtend (done via merge of branch ogurcan) --- .../papyrus/cpp/codegen/acceleo/Constants.emtl | 576 ---- .../papyrus/cpp/codegen/acceleo/Constants.mtl | 52 - .../papyrus/cpp/codegen/acceleo/CppBindBody.emtl | 1010 ------ .../papyrus/cpp/codegen/acceleo/CppBindBody.mtl | 45 - .../papyrus/cpp/codegen/acceleo/CppBindHeader.emtl | 1031 ------ .../papyrus/cpp/codegen/acceleo/CppBindHeader.mtl | 44 - .../papyrus/cpp/codegen/acceleo/CppClassBody.emtl | 885 ----- .../papyrus/cpp/codegen/acceleo/CppClassBody.mtl | 42 - .../cpp/codegen/acceleo/CppClassHeader.emtl | 2200 ------------ .../papyrus/cpp/codegen/acceleo/CppClassHeader.mtl | 122 - .../cpp/codegen/acceleo/CppIncludeUtils.emtl | 1253 ------- .../cpp/codegen/acceleo/CppIncludeUtils.mtl | 40 - .../cpp/codegen/acceleo/CppPackageHeader.emtl | 749 ----- .../cpp/codegen/acceleo/CppPackageHeader.mtl | 53 - .../cpp/codegen/acceleo/util/CppAttribute.emtl | 1702 ---------- .../cpp/codegen/acceleo/util/CppAttribute.mtl | 71 - .../cpp/codegen/acceleo/util/CppDocumentation.emtl | 645 ---- .../cpp/codegen/acceleo/util/CppDocumentation.mtl | 30 - .../cpp/codegen/acceleo/util/CppEnumerations.emtl | 450 --- .../cpp/codegen/acceleo/util/CppEnumerations.mtl | 14 - .../codegen/acceleo/util/CppPrimitiveTypes.emtl | 584 ---- .../cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl | 30 - .../cpp/codegen/acceleo/util/CppTemplates.emtl | 855 ----- .../cpp/codegen/acceleo/util/CppTemplates.mtl | 39 - .../util/clazz/CppClassAttributesDeclaration.emtl | 259 -- .../util/clazz/CppClassAttributesDeclaration.mtl | 10 - .../util/clazz/CppClassFriendDeclaration.emtl | 417 --- .../util/clazz/CppClassFriendDeclaration.mtl | 16 - .../clazz/CppClassIncludeClassDeclaration.emtl | 985 ------ .../util/clazz/CppClassIncludeClassDeclaration.mtl | 40 - .../util/clazz/CppClassIncludeDeclaration.emtl | 763 ----- .../util/clazz/CppClassIncludeDeclaration.mtl | 30 - .../util/clazz/CppClassInheritedDeclarations.emtl | 754 ----- .../util/clazz/CppClassInheritedDeclarations.mtl | 25 - .../util/clazz/CppClassOperationsDeclaration.emtl | 479 --- .../util/clazz/CppClassOperationsDeclaration.mtl | 17 - .../clazz/CppClassOperationsImplementation.emtl | 617 ---- .../clazz/CppClassOperationsImplementation.mtl | 23 - .../acceleo/util/clazz/CppClassTypeAndEnum.emtl | 944 ------ .../acceleo/util/clazz/CppClassTypeAndEnum.mtl | 27 - .../acceleo/util/operation/CppOperations.emtl | 3554 -------------------- .../acceleo/util/operation/CppOperations.mtl | 123 - .../acceleo/util/operation/CppParameter.emtl | 880 ----- .../acceleo/util/operation/CppParameter.mtl | 28 - .../cpp/codegen/preferences/CppCodeGenUtils.emtl | 244 -- .../cpp/codegen/preferences/CppCodeGenUtils.mtl | 13 - .../transformation/CppModelElementsCreator.java | 113 +- .../papyrus/cpp/codegen/utils/ClassUtils.emtl | 164 - .../papyrus/cpp/codegen/utils/ClassUtils.java | 4 +- .../papyrus/cpp/codegen/utils/ClassUtils.mtl | 6 - .../papyrus/cpp/codegen/xtend/CppAttribute.xtend | 70 + .../xtend/CppClassAttributesDeclaration.xtend | 15 + .../codegen/xtend/CppClassFriendDeclaration.xtend | 24 + .../xtend/CppClassIncludeClassDeclaration.xtend | 58 + .../codegen/xtend/CppClassIncludeDeclaration.xtend | 40 + .../xtend/CppClassInheritedDeclarations.xtend | 38 + .../xtend/CppClassOperationsDeclaration.xtend | 25 + .../xtend/CppClassOperationsImplementation.xtend | 29 + .../cpp/codegen/xtend/CppClassTypeAndEnum.xtend | 52 + .../cpp/codegen/xtend/CppClassifierGenerator.xtend | 329 ++ .../cpp/codegen/xtend/CppCodeGenerator.xtend | 66 + .../cpp/codegen/xtend/CppDocumentation.xtend | 37 + .../cpp/codegen/xtend/CppEnumerations.xtend | 22 + .../cpp/codegen/xtend/CppFileGenerator.xtend | 100 + .../papyrus/cpp/codegen/xtend/CppIncludeUtil.xtend | 72 + .../papyrus/cpp/codegen/xtend/CppOperations.xtend | 128 + .../codegen/xtend/CppPackageHeaderGenerator.xtend | 63 + .../papyrus/cpp/codegen/xtend/CppParameter.xtend | 35 + .../cpp/codegen/xtend/CppPrimitiveTypes.xtend | 38 + .../papyrus/cpp/codegen/xtend/CppTemplates.xtend | 47 + 70 files changed, 1312 insertions(+), 23033 deletions(-) delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.mtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.emtl delete mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.mtl create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppCodeGenerator.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppFileGenerator.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.xtend create mode 100644 extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.xtend (limited to 'extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src') diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.emtl deleted file mode 100644 index 5512989050b..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.emtl +++ /dev/null @@ -1,576 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 94614d3fedc..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/Constants.mtl +++ /dev/null @@ -1,52 +0,0 @@ -[comment encoding = UTF-8 /] -[module Constants('http://www.eclipse.org/uml2/5.0.0/UML')] - - -[template public constIncludeHFile(dummy : Element)] -// include associated header file -[/template] - -[template public constIncludeHeaderStart(dummy : Element)] -// Include from Include stereotype (header) -[/template] - -[template public constIncludePreBodyStart(dummy : Element)] -// Include from Include stereotype (pre-body) -[/template] - -[template public constIncludePreBodyEnd(dummy : Element)] -// End of Include stereotype (pre-body) -[/template] - -[template public constIncludeBodyStart(dummy : Element)] -// Include from Include declaration (body) -[/template] - -[template public constIncludeHeaderEnd(dummy : Element)] -// End of Include stereotype (header) -[/template] - -[template public constIncludeBodyEnd(dummy : Element)] -// End of Include stereotype (body) -[/template] - -[template public constDerivedIncludes(dummy : Element)] -// Derived includes directives -[/template] - -[template public forwardDecl(dummy : Element)] -// forward declarations -[/template] - -[template public constStaticAttributes(dummy : Element)] -// static attributes (if any) -[/template] - -[template public packageTypes(dummy : Element)] -// Types defined within the package -[/template] - - -[template public undefinedType(dummy : Element)] -undefined -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.emtl deleted file mode 100644 index 86c8b390bd2..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.emtl +++ /dev/null @@ -1,1010 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index bb2cf852f40..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindBody.mtl +++ /dev/null @@ -1,45 +0,0 @@ -[module CppBindBody('http://www.eclipse.org/uml2/5.0.0/UML')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/] -[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/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/] - - -[template public CppBindBody(class : Class)] -#define [getFullNameUC()/]_BODY - -/************************************************************ - [class.name/] template binding body - ************************************************************/ - -[CppIncludePreBody()/] - -[constIncludeHFile()/] -[IncludeDirective( _package.getFullPath() + '/' + class.name + '.' + getHeaderSuffix() )/] - -[CppIncludeBody()/] - -[openNS()/] - -[constDerivedIncludes()/] - -[for (path : String | CppClassAllIncludes()->flatten()->asOrderedSet())] -[path.IncludeDirective()/] -[/for] - -/************************************************************/ -[let tb : TemplateBinding = getTemplateBindings()] -[let templateElement : Element = tb.target->asSequence()->first()] -template class [templateElement.owner.oclAsType(NamedElement).name/]<[for (tb.parameterSubstitution)][CppTemplateBindingParameter()/][/for]>; -[/let][/let] - -[closeNS()/] - -/************************************************************ - End of [class.name/] template binding body - ************************************************************/ -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.emtl deleted file mode 100644 index f372ad6c3eb..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.emtl +++ /dev/null @@ -1,1031 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 007a48b1f47..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppBindHeader.mtl +++ /dev/null @@ -1,44 +0,0 @@ -[module CppBindHeader('http://www.eclipse.org/uml2/5.0.0/UML')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/] -[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)] -#ifndef [getFullNameUC()/]_H -#define [getFullNameUC()/]_H - -/************************************************************ - [class.name/] template binding header - ************************************************************/ - -[for (path : String | - Sequence{ _package.cppOwnerPackageIncludePath() } - ->addAll( CppClassAllIncludes() ) - ->flatten() - ->asOrderedSet())] -[path.IncludeDirective()/] -[/for] - -[CppIncludeHeader()/] - -[let tb : TemplateBinding = getTemplateBindings()] -[let templateElement : Element = tb.target->asSequence()->first()] -[IncludeDirective( _package.getFullPath() + '/' + templateElement.owner.oclAsType(NamedElement).name + '.' + getHeaderSuffix() )/] - -[openNS()/] -/************************************************************/ -typedef [templateElement.owner.oclAsType(NamedElement).name/]<[for (tb.parameterSubstitution)][CppTemplateBindingParameter()/][/for]> [class.name/]; - -[closeNS()/] -[/let][/let] - -/************************************************************ - End of [class.name/] template binding header - ************************************************************/ - -#endif -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.emtl deleted file mode 100644 index f3905cb70d3..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.emtl +++ /dev/null @@ -1,885 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index af47e965998..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassBody.mtl +++ /dev/null @@ -1,42 +0,0 @@ -[module CppClassBody('http://www.eclipse.org/uml2/5.0.0/UML')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/] -[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::CppAttribute/] - - -[template public CppClassBody(class : Classifier)] -#define [getFullName()/]_BODY - -/************************************************************ - [class.name/] class body - ************************************************************/ - -[CppIncludePreBody()/] - -[constIncludeHFile()/] -[IncludeDirective( getNearestPackage().getFullPath() + '/' + class.name + '.' + getHeaderSuffix() )/] - -[constDerivedIncludes()/] -[for (path : String | CppClassAllIncludesDeclarationBody()->flatten()->asOrderedSet())] -[path.IncludeDirective()/] -[/for] - -[CppIncludeBody()/] - -[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.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.emtl deleted file mode 100644 index 2fbf48e1a44..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.emtl +++ /dev/null @@ -1,2200 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index b89a0c84e7e..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppClassHeader.mtl +++ /dev/null @@ -1,122 +0,0 @@ -[module CppClassHeader('http://www.eclipse.org/uml2/5.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1', 'http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/] -[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/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassInheritedDeclarations/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassAttributesDeclaration/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassOperationsDeclaration/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassOperationsImplementation/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppOperations/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/] - -[template public classUnionOrStruct(classifier : Classifier)] -[if (hasStereotype(C_Cpp::Union))] - 'union' -[else] - [if (oclIsKindOf(DataType))] - [VisibilityKind::public.resetVisibility()/] - struct - [else] - [VisibilityKind::private.resetVisibility()/] - class - [/if] -[/if] -[/template] - -[comment default initializer for non-static attributes with a default value -TODO: should be disabled by default, since non-static members can be initialized directly -in C++ 011/] -[template public defaultInitializer(classifier : Classifier) post(trim())] -[comment -Bug 422373: The default initializer should not be generated if there are any user-defined - constructors. In plain C++ code, the existence of a constructor with parameters - means that the compiler will not synthesize a default one. - - E.g., this would be invalid in plain C++ code: - class T1 { }; - class T2 { public: T(int); }; - T1 * t1 = new T1; // OK, sythesized default constructor used - T2 * t2a = new T2(5); // OK, user-defined constructor used - T2 * t2b = new T2; // ERROR, default constructor was not synthesized - - Also, if the user has provided a default constructor in the code, we don't need - to generate a second copy here. A default constructor should only be generated - here if the compiler would have synthesized one anyhow. Otherwise the default - property values should be set in the constructors that are generated by - CppClassOperationsDeclaration. -/] -[if getOwnedOperations()->any(hasStereotype(standard::Create)) = null] - [let attributeList : OrderedSet(Property) = attribute->select( - (isStatic = false) and - (defaultValue <> null) and - (defaultValue.stringValue() <> null))] - [if not attributeList->isEmpty()] - [classifier.name/]() : [for (a : Property | attributeList) separator(', ') - ][name/]([defaultValue.stringValue()/])[/for] {} - [/if][/let] -[/if] -[/template] - - -[template public CppClassHeader(class : Classifier)] -#ifndef [getFullNameUC()/]_H -#define [getFullNameUC()/]_H - -/************************************************************ - [class.name/] class header - ************************************************************/ - -[for (path : String | - Sequence{ _package.cppOwnerPackageIncludePath() } - ->addAll( CppClassAllIncludes() ) - ->flatten() - ->asOrderedSet())] -[path.IncludeDirective()/] -[/for] - -[CppIncludeHeader()/] - -[openNS()/] - -/************************************************************/ -[CppElementDoc()/] -[templateSignature()/][classUnionOrStruct()/] [class.name/][CppClassInheritedDeclarations()/] { -[CppClassIncludeFriendDeclaration()/][CppClassTypeAndEnum()/] - [VisibilityKind::public.getSection(defaultInitializer())/] - [VisibilityKind::public.getSection(CppClassAttributesDeclaration(VisibilityKind::public))/] - [VisibilityKind::public.getSection(CppClassOperationsDeclaration(VisibilityKind::public))/] - - [VisibilityKind::protected.getSection(CppClassAttributesDeclaration(VisibilityKind::protected))/] - [VisibilityKind::protected.getSection(CppClassOperationsDeclaration(VisibilityKind::protected))/] - - [VisibilityKind::private.getSection(CppClassAttributesDeclaration(VisibilityKind::private))/] - [VisibilityKind::private.getSection(CppClassOperationsDeclaration(VisibilityKind::private))/] -}; -/************************************************************/ -/* External declarations (package visibility) */ -[CppClassAttributesDeclaration(VisibilityKind::_package)/] -[CppClassOperationsDeclaration(VisibilityKind::_package)/] -/************************************************************/ - -[if isTemplate()] -/************************************************************/ -/* Template functions */ -[CppClassOperationsImplementation(false)/] -[/if] - -/* 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.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.emtl deleted file mode 100644 index b32aedf7db3..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.emtl +++ /dev/null @@ -1,1253 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 4c6f033928d..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppIncludeUtils.mtl +++ /dev/null @@ -1,40 +0,0 @@ -[comment encoding = UTF-8 /] -[module CppIncludeUtils('http://www.eclipse.org/uml2/5.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1')] -[import org::eclipse::papyrus::acceleo::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] - -[template public IncludeDirective(path : String)] -[if (path <> null) and (path.size() > 0)] -#include "[path/]" -[/if] -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.emtl deleted file mode 100644 index 55fc473da7a..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.emtl +++ /dev/null @@ -1,749 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index cca687e2f9e..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/CppPackageHeader.mtl +++ /dev/null @@ -1,53 +0,0 @@ -[module CppPackageHeader('http://www.eclipse.org/uml2/5.0.0/UML')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/] -[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/] -[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/] - - -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/] - - -[template public CppPackageHeader(pkg : Package)] -#ifndef PKG_[getFullNameUC()/] -#define PKG_[getFullNameUC()/] - -/************************************************************ - Pkg_[name/] package header - ************************************************************/ - -[nestingPackage.cppOwnerPackageIncludePath().IncludeDirective()/] - -#ifndef _IN_ -#define _IN_ -#endif -#ifndef _OUT_ -#define _OUT_ -#endif -#ifndef _INOUT_ -#define _INOUT_ -#endif - - -/* Package dependency header include */ -[for (getUsedPackages())] -[IncludeDirective( getFullPath() + '/Pkg_' + name + '.' + getHeaderSuffix() )/] -[/for] - -[CppIncludeHeader()/] - -[openNS()/] -[packageTypes()/] -[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/util/CppAttribute.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.emtl deleted file mode 100644 index 03689dcf0f3..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.emtl +++ /dev/null @@ -1,1702 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.mtl deleted file mode 100644 index d94e14d709b..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppAttribute.mtl +++ /dev/null @@ -1,71 +0,0 @@ -[module CppAttribute('http://www.eclipse.org/uml2/5.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::utils::Modifier/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/] -[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()/][modCVQualifier()/][attribute.type.cppQualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/][if (hasStereotype(C_Cpp::Const))][defaultValue()/][/if]; -[/template] - - -[template public CppAttributeImplementation(attribute : Property)] - [CppElementDoc()/] - [modCVQualifier()/][attribute.type.cppQualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/]; -[/template] - -[template public CppStaticAttributeImplementation(attribute : Property)] -[CppElementDoc()/] -[type.cppQualifiedName()/][modPtr()/][modRef()/] [attribute.class.name/]::[attribute.name/][modArray()/][defaultValue()/]; -[/template] - - -[comment -return a list of owned attributes, since this is not supported directly on a classifier/] -[query public getOwnedAttributes(cl : Classifier) : Sequence(Property) = - if cl.oclIsKindOf(Class) then - oclAsType(Class).ownedAttribute - else - if cl.oclIsKindOf(DataType) then - oclAsType(DataType).ownedAttribute - else - if cl.oclIsKindOf(Interface) then - oclAsType(Interface).ownedAttribute - else - if cl.oclIsKindOf(Signal) then - oclAsType(Signal).ownedAttribute - else - Sequence{} - endif - endif - endif - endif -/] - - -[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 (getOwnedAttributes())] - [if(isStatic and (not hasStereotype(C_Cpp::Const)))] -[CppStaticAttributeImplementation()/] - - [/if] -[/for] -[/template] - diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.emtl deleted file mode 100644 index 6dad5303306..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.emtl +++ /dev/null @@ -1,645 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index c20f8ae17bf..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppDocumentation.mtl +++ /dev/null @@ -1,30 +0,0 @@ -[module CppDocumentation('http://www.eclipse.org/uml2/5.0.0/UML')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] - - -[template public CppElementDoc(argument : Element)] -/** - * [getComments().replaceAll('\n', '\n * ')/] - */ -[/template] - - -[template public CppOperationDoc(operation : Operation)] -/** - * [getComments().replaceAll('\n', '\n * ')/] - * [for (ownedParameter)][CppParamDoc()/][/for] - */ -[/template] - - -[template public CppBehaviorDoc(behavior : Behavior)] -/** - * [getComments().replaceAll('\n', '\n * ')/] - * [for (ownedParameter)][CppParamDoc()/][/for] - */ -[/template] - - -[template public CppParamDoc(parameter : Parameter)] -@param [name/] [getComments().replaceAll('\n', '\n * ')/] -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.emtl deleted file mode 100644 index 9e348de6a52..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.emtl +++ /dev/null @@ -1,450 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index f66666b9517..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppEnumerations.mtl +++ /dev/null @@ -1,14 +0,0 @@ -[module CppEnumerations('http://www.eclipse.org/uml2/5.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/] - -[template public CppEnumerationDefinition(enum : Enumeration)] -[CppElementDoc()/] -enum [enum.name/] { -[for (ownedLiteral)] - [CppElementDoc()/] - [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.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.emtl deleted file mode 100644 index 14bdcb4745a..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.emtl +++ /dev/null @@ -1,584 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 1450157608b..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppPrimitiveTypes.mtl +++ /dev/null @@ -1,30 +0,0 @@ -[module CppPrimitiveTypes('http://www.eclipse.org/uml2/5.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.oclAsType(String).replaceAll('typeName', primitiveType.name) - /][if (not getApplication(Typedef).oclAsType(Typedef).definition.oclAsType(String).contains('typeName'))] [primitiveType.name/][/if]; -[else] -[getStdtypes(primitiveType)/]; -[/if] -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.emtl deleted file mode 100644 index 3b7160af472..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.emtl +++ /dev/null @@ -1,855 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index b306948e75d..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl +++ /dev/null @@ -1,39 +0,0 @@ -[module CppTemplates('http://www.eclipse.org/uml2/5.0.0/UML')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/] - - -[query public CppTemplateBindingParameter(tps : TemplateParameterSubstitution) : String = -if (tps.actual.oclIsKindOf(LiteralInteger)) then - tps.actual.oclAsType(LiteralInteger).value -else - tps.actual.oclAsType(NamedElement).name -endif -/] - -[query public isTemplate(class : Classifier) : Boolean = - getTemplateParameters()->size() > 0 -/] - - -[template public templateSignature(class : Classifier)] -[if isTemplate()] -template<[for (getTemplateParameters()) separator(', ')][getTemplateTypeName()/][/for]> -[/if] -[/template] - - -[template public templateShortSignature(class : Classifier)] -[if isTemplate()] -<[for (getTemplateParameters()) separator(', ')][getTemplateName()/][/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.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.emtl deleted file mode 100644 index cc99b6c77b0..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.emtl +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index bb217ae9c3a..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassAttributesDeclaration.mtl +++ /dev/null @@ -1,10 +0,0 @@ -[module CppClassAttributesDeclaration('http://www.eclipse.org/uml2/5.0.0/UML')/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppAttribute/] - - -[template public CppClassAttributesDeclaration(class : Classifier, visibilityFilter : VisibilityKind)] -[for (getOwnedAttributes()->select(visibility = visibilityFilter))] - - [CppAttributeDeclaration()/] -[/for] -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.emtl deleted file mode 100644 index f500b4d11f5..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.emtl +++ /dev/null @@ -1,417 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 362e4924037..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassFriendDeclaration.mtl +++ /dev/null @@ -1,16 +0,0 @@ -[module CppClassFriendDeclaration('http://www.eclipse.org/uml2/5.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/] - - -[template public CppClassFriendDeclaration(friend : Classifier)] -friend class [friend.cppQualifiedName()/]; -[/template] - -[template public CppClassIncludeFriendDeclaration(class : Classifier)] -[for (getUsedClassifiers())] - [if hasStereotype(C_Cpp::Friend) and (not hasStereotype(C_Cpp::NoCodeGen))] - [CppClassFriendDeclaration()/] - [/if] -[/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/clazz/CppClassIncludeClassDeclaration.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.emtl deleted file mode 100644 index a6f29b07b66..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.emtl +++ /dev/null @@ -1,985 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index e94ed0680fc..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeClassDeclaration.mtl +++ /dev/null @@ -1,40 +0,0 @@ -[module CppClassIncludeClassDeclaration('http://www.eclipse.org/uml2/5.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::utils::ClassUtils/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::CppIncludeUtils/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeDeclaration/] - -[query public cppOwnerPackageIncludePath(pkg : Package) : String = -if ((pkg <> null) and (not hasStereotype(CppRoot))) then - getFullPath() + '/Pkg_' + pkg.name + '.h' -else - null -endif -/] - -[query public CppClassAllIncludes(class : Classifier) : Sequence(String) = - cppClassAllIncludes( class, includedClassifiers() ) -/] - -[query public CppClassAllIncludesDeclarationBody(class : Classifier) : Sequence(String) = - cppClassAllIncludes( class, getTypesViaDependencies() ) -/] - -[query private cppClassAllIncludes(class : Classifier, list : Sequence(Classifier)) : Sequence(String) = -list->collect( cl | - if((cl <> class) and (not hasStereotype(NoCodeGen)) or hasStereotype(External)) then - if(cl.oclIsKindOf(Enumeration) or cl.oclIsKindOf(PrimitiveType)) then - if (cl.owner <> null and cl.owner.oclIsKindOf(Package)) then - cl.owner.oclAsType(Package).cppOwnerPackageIncludePath() - else - null - endif - else - cl.cppClassIncludes() - endif - else - null - endif -)->flatten()->reject( str | str = null ) -/] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.emtl deleted file mode 100644 index 8684b1dd875..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.emtl +++ /dev/null @@ -1,763 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 71b8d63792c..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassIncludeDeclaration.mtl +++ /dev/null @@ -1,30 +0,0 @@ -[module CppClassIncludeDeclaration('http://www.eclipse.org/uml2/5.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::CppIncludeUtils/] -[import org::eclipse::papyrus::cpp::codegen::preferences::CppCodeGenUtils/] - - -[query public includeName(ne : NamedElement) : String = -if (hasStereotype(Template)) then - getApplication(Template).oclAsType(Template).declaration -else - if (hasStereotype(External)) then getApplication(External).oclAsType(External).name - 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/] -[query public cppClassIncludes(ne : NamedElement) : Sequence(String) = -if (hasStereotypeTree(ExternLibrary)) then - getApplicationTree(ExternLibrary).oclAsType(ExternLibrary).includes -else - ne.includeName() -endif -/] - -[template public CppClassIncludeDeclaration(ne : NamedElement)] -[ne.cppClassIncludes().IncludeDirective()/] -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.emtl deleted file mode 100644 index 065063e27cd..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.emtl +++ /dev/null @@ -1,754 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 66a0c4d223d..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassInheritedDeclarations.mtl +++ /dev/null @@ -1,25 +0,0 @@ -[module CppClassInheritedDeclarations('http://www.eclipse.org/uml2/5.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/] - -[comment -Return a list of relationships that are either Generalizations or InterfaceRealiazations -and the target does not point to a classifier that has the no-code-gen Stereotype -TODO: not sure if it makes sense NOT to declare an inheritance, since we do not generate code. -/] -[query public filteredRelationships(class : Classifier) : Set(DirectedRelationship) = - getSourceDirectedRelationships()->select( - (oclIsKindOf(Generalization) or oclIsKindOf(InterfaceRealization)) and - (not target->asSequence()->first().hasStereotype(NoCodeGen)) - ) -/] - -[query public getCppVisibility(relationship : Relationship) : String = -if (hasStereotype(Visibility)) then getApplication(Visibility).oclAsType(Visibility).value else 'public' endif -/] - -[template public CppClassInheritedDeclarations(class : Classifier)] -[if (filteredRelationships()->size() > 0)] : [/if] -[for (filteredRelationships()) separator(', \n')] - [getCppVisibility()/] [target->asSequence()->first().oclAsType(Classifier).cppQualifiedName()/][/for] -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.emtl deleted file mode 100644 index 482c027da43..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.emtl +++ /dev/null @@ -1,479 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 513dd1ed446..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsDeclaration.mtl +++ /dev/null @@ -1,17 +0,0 @@ -[module CppClassOperationsDeclaration('http://www.eclipse.org/uml2/5.0.0/UML')/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppOperations/] - - -[template public CppClassOperationsDeclaration(class : Classifier, visibilityFilter : VisibilityKind)] -[for (getOwnedOperations()->select(visibility = visibilityFilter))] - - [CppOperationDeclaration()/] -[/for] -[for (b : Behavior | eAllContents(OpaqueBehavior)->select(visibility = visibilityFilter))] - [if (b.specification = null)] - - // opaque behavior without specification (typically from state machine) - [CppBehaviorDeclaration()/] - [/if] -[/for] -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.emtl deleted file mode 100644 index d81f2c6d816..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.emtl +++ /dev/null @@ -1,617 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 33716ef6e61..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassOperationsImplementation.mtl +++ /dev/null @@ -1,23 +0,0 @@ -[module CppClassOperationsImplementation('http://www.eclipse.org/uml2/5.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[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 - are produced/] -[template public CppClassOperationsImplementation(class : Classifier, inline : Boolean)] -[for (getOwnedOperations()->select( - (not (hasStereotype(NoCodeGen) or isAbstract)) and - (hasStereotype(C_Cpp::Inline) = inline)))] - -[CppOperationImplementation()/] -[/for] -[for (b : OpaqueBehavior | eAllContents(OpaqueBehavior)->select( - (hasStereotype(C_Cpp::Inline) = inline)))] - [if (b.specification = null)] - -// opaque behavior without specification (typically from state machine) -[CppBehaviorImplementation()/] - [/if] -[/for] -[/template] diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.emtl deleted file mode 100644 index 1b7e59c0a31..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.emtl +++ /dev/null @@ -1,944 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index d90230149a4..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/clazz/CppClassTypeAndEnum.mtl +++ /dev/null @@ -1,27 +0,0 @@ -[module CppClassTypeAndEnum('http://www.eclipse.org/uml2/5.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::CppPrimitiveTypes/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppEnumerations/] - -[template public TypeAndEnumForVisibility(element : Element, visibilityFilter : VisibilityKind)] -[if (not hasStereotype(NoCodeGen) and oclIsKindOf(Classifier) and oclAsType(Classifier).visibility = visibilityFilter)] -[ if (oclIsKindOf(Enumeration))][oclAsType(Enumeration).CppEnumerationDefinition()/][/if] -[ if (oclIsKindOf(PrimitiveType))][oclAsType(PrimitiveType).CppPrimitiveTypeDefinition()/][/if] -[/if] -[/template] - -[template public TypesAndEnumsForVisibility(ne : Namespace, visibilityFilter : VisibilityKind)] -[for (ownedElement)][TypeAndEnumForVisibility(visibilityFilter)/][/for] -[/template] - -[template public CppClassTypeAndEnum(class : Classifier)] - [VisibilityKind::public.getSection(TypesAndEnumsForVisibility(VisibilityKind::public))/] - [VisibilityKind::protected.getSection(TypesAndEnumsForVisibility(VisibilityKind::protected))/] - [VisibilityKind::private.getSection(TypesAndEnumsForVisibility(VisibilityKind::private))/] -[/template] - -[template public CppClassTypeAndEnumPackage(pkg : Package)] -[TypesAndEnumsForVisibility(VisibilityKind::_package)/] -[TypesAndEnumsForVisibility(VisibilityKind::public)/] -[/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/operation/CppOperations.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.emtl deleted file mode 100644 index 151d49fa366..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.emtl +++ /dev/null @@ -1,3554 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.mtl deleted file mode 100644 index 99720c6e618..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppOperations.mtl +++ /dev/null @@ -1,123 +0,0 @@ -[module CppOperations('http://www.eclipse.org/uml2/5.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1', 'http://www.eclipse.org/uml2/5.0.0/UML/Profile/Standard')/] -[import org::eclipse::papyrus::acceleo::GenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/] -[import org::eclipse::papyrus::cpp::codegen::utils::Modifier/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::operation::CppParameter/] -[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/] - - -[comment -return a list of owned operations, since this is not supported directly on a classifier/] -[query public getOwnedOperations(cl : Classifier) : Sequence(Operation) = - if (cl.oclIsKindOf(Class)) then - oclAsType(Class).ownedOperation - else - if (cl.oclIsKindOf(DataType)) then - oclAsType(DataType).ownedOperation - else - if (cl.oclIsKindOf(Interface)) then - oclAsType(Interface).ownedOperation - else - Sequence{} - endif - endif - endif -/] - -[template public virtualTxt(operation : Operation)] -[if((operation.interface <> null) or (operation.isAbstract) or (operation.hasStereotype(Virtual)))]virtual [/if] -[/template] - - -[template public virtualSuffix(operation : Operation)] -[if((operation.interface <> null) or (operation.isAbstract))] = 0[/if] -[/template] - - -[query public isConsOrDestructor(operation : Operation) : Boolean = -hasStereotype(standard::Create) or hasStereotype(standard::Destroy) -/] - -[query public ConsDestructorOrVoid(operation : Operation) : String = -if isConsOrDestructor() then - '' -else - 'void ' -endif/] - - -[query public destructor(operation : Operation) : String = -if hasStereotype(standard::Destroy) and not operation.name.startsWith('~') then - '~' -else - '' -endif/] - -[template public CppReturnSpec(operation : Operation)] -[if (type = null) or isConsOrDestructor()][ConsDestructorOrVoid()/][else][returnResult().modCVQualifier()/] [type.cppQualifiedName()/][returnResult().modPtr()/][returnResult().modRef()/] [/if] -[/template] - - -[template public CppReturnSpec(behavior : Behavior)] -[if (returnResult() = null)]void [else][returnResult().modCVQualifier()/] [returnResult().type.cppQualifiedName()/][returnResult().modPtr()/][returnResult().modRef()/] [/if] -[/template] - - -[template public InlineTxt(element : Element)] -[if (hasStereotype(Inline))]inline [/if] -[/template] - - -[template public staticTxt(operation : Operation)] -[if (isStatic)]static [/if] -[/template] - -[template public CppOperationDeclaration(operation : Operation)] -[CppOperationDoc()/] -[InlineTxt()/][virtualTxt()/][staticTxt()/][CppReturnSpec()/][destructor()/][operation.name/]([CppOperationParameters(true)/])[modCVQualifier()/][virtualSuffix()/]; -[/template] - -[template public CppBehaviorDeclaration(behavior : Behavior)] -[CppBehaviorDoc()/] -[InlineTxt()/][CppReturnSpec()/][behavior.name/]([CppBehaviorParameters(true)/])[modCVQualifier()/]; -[/template] - -[template public CppConstInit(operation : Operation)] -[if (hasStereotype(ConstInit) and hasStereotype(standard::Create))] : [getApplication(ConstInit).oclAsType(ConstInit).initialisation/][/if] -[/template] - - -[comment wrapper for native query (otherwise Acceleo does not indent properly)/] -[template public getBodyInTemplate(operation : Operation, language : String)] -[getBody(language).trim()/] -[/template] - - -[template public throws(operation: Operation)] -[if (operation.raisedException->size() > 0)] -throws [for (raisedException) separator(',')][name/][/for] -[/if] -[/template] - - -[template public CppOperationImplementation(operation : Operation)] -[CppOperationDoc()/] -[if (operation.name = 'main')] -[CppReturnSpec()/][operation.name/]([CppOperationParameters(false)/]) { - [getBody('C/C++')/] -} -[else] -[templateSignature()/][InlineTxt()/][CppReturnSpec()/][operation.featuringClassifier.name/][templateShortSignature()/]::[destructor()/][operation.name/]([CppOperationParameters(false)/])[throws()/][modCVQualifier()/][CppConstInit()/] { - [getBodyInTemplate('C/C++')/] -} -[/if] -[/template] - - -[template public CppBehaviorImplementation(behavior : OpaqueBehavior)] -[CppBehaviorDoc()/] -[CppReturnSpec()/][behavior._context.name/]::[behavior.name/]([CppBehaviorParameters(false)/])[modCVQualifier()/] { - [getBodyFromOB('C/C++')/] -} -[/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/operation/CppParameter.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.emtl deleted file mode 100644 index d02d03ec0ae..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.emtl +++ /dev/null @@ -1,880 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 deleted file mode 100644 index 9f1a560d469..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/operation/CppParameter.mtl +++ /dev/null @@ -1,28 +0,0 @@ -[module CppParameter('http://www.eclipse.org/uml2/5.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::utils::Modifier/] - - - -[template public defaultValue(parameter : Parameter)] -[if (defaultValue <> null)] = [defaultValue.stringValue()/][/if] -[/template] - -[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)] -[modCVQualifier()/][parameter.type.cppQualifiedName()/][modPtr()/][modRef()/] [parameter.name/][modArray()/][if (showDefault)][defaultValue()/][/if] -[/template] - - -[template public CppOperationParameters(operation : Operation, showDefault : Boolean)] -[for (ownedParameter->select(direction <> ParameterDirectionKind::return)) separator(', ')][CppParameter(showDefault)/][/for] -[/template] - - -[comment signature for a given behavior (e.g. effect within state machine)/] -[template public CppBehaviorParameters(behavior : Behavior, 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/preferences/CppCodeGenUtils.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.emtl deleted file mode 100644 index 6a3055dab7b..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.emtl +++ /dev/null @@ -1,244 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.mtl deleted file mode 100644 index 79db6cdbb36..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/preferences/CppCodeGenUtils.mtl +++ /dev/null @@ -1,13 +0,0 @@ -[comment encoding = UTF-8 /] -[module CppCodeGenUtils('http://www.eclipse.org/uml2/5.0.0/UML')/] - -[query public getHeaderSuffix() : String - = invoke('org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils', 'getHeaderSuffix()', Sequence{}) /] - - -[query public getBodySuffix() : String - = invoke('org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils', 'getBodySuffix()', Sequence{}) /] - -[query public getCommentHeader() : String - = invoke('org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils', 'getCommentHeader()', Sequence{}) /] - 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 9e71bad4d07..52a72afd31f 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 @@ -26,54 +26,38 @@ import org.eclipse.jface.text.IDocument; import org.eclipse.papyrus.C_Cpp.CppRoot; import org.eclipse.papyrus.C_Cpp.ExternLibrary; import org.eclipse.papyrus.C_Cpp.External; -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.AcceleoException; import org.eclipse.papyrus.acceleo.GenUtils; import org.eclipse.papyrus.acceleo.ModelElementsCreator; import org.eclipse.papyrus.cpp.codegen.Activator; import org.eclipse.papyrus.cpp.codegen.Messages; import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils; +import org.eclipse.papyrus.cpp.codegen.xtend.CppClassifierGenerator; +import org.eclipse.papyrus.cpp.codegen.xtend.CppPackageHeaderGenerator; import org.eclipse.text.edits.MalformedTreeException; import org.eclipse.text.edits.TextEdit; -import org.eclipse.uml2.uml.Association; -import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Classifier; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.Namespace; import org.eclipse.uml2.uml.Package; -import org.eclipse.uml2.uml.util.UMLUtil; /** * Main class of code generator + * + * @author Önder GÜRCAN (onder.gurcan@cea.fr) */ public class CppModelElementsCreator extends ModelElementsCreator { - public static final String ACCELEO_PREFIX = "org::eclipse::papyrus::cpp::codegen::acceleo::"; //$NON-NLS-1$ - - public static final String CppClassBody = ACCELEO_PREFIX + "CppClassBody"; //$NON-NLS-1$ - - public static final String CppClassHeader = ACCELEO_PREFIX + "CppClassHeader"; //$NON-NLS-1$ - - public static final String CppBindBody = ACCELEO_PREFIX + "CppBindBody"; //$NON-NLS-1$ - - public static final String CppBindHeader = ACCELEO_PREFIX + "CppBindHeader"; //$NON-NLS-1$ - - public static final String CppPackageHeader = ACCELEO_PREFIX + "CppPackageHeader"; //$NON-NLS-1$ - public static final String DOT = "."; //$NON-NLS-1$ - + /** - * + * * Constructor. - * + * * @param project - * the project in which the generated code should be placed + * the project in which the generated code should be placed */ public CppModelElementsCreator(IProject project) { super(project, CppCodeGenUtils.getCommentHeader()); @@ -82,13 +66,13 @@ public class CppModelElementsCreator extends ModelElementsCreator { } /** - * + * * Constructor. - * + * * @param project - * the project in which the generated code should be placed + * the project in which the generated code should be placed * @param commentHeader - * Custom prefix for each generated file + * Custom prefix for each generated file */ public CppModelElementsCreator(IProject project, String commentHeader) { super(project, commentHeader); @@ -107,64 +91,13 @@ public class CppModelElementsCreator extends ModelElementsCreator { * generates 2 headers (one for the privates concrete operations and one for * the attributes, public operations and virtual / abstract operations and * one body file. - * + * * @param folder * @param classifier * @throws CoreException */ - @Override protected void createClassifierFiles(IContainer container, Classifier classifier) throws CoreException { - - // treat case of manual code generation - if (GenUtils.hasStereotype(classifier, ManualGeneration.class)) { - ManualGeneration mg = UMLUtil.getStereotypeApplication(classifier, ManualGeneration.class); - Include cppInclude = UMLUtil.getStereotypeApplication(classifier, Include.class); - try { - String fileContent = commentHeader + - AcceleoDriver.evaluate(cppInclude.getHeader(), classifier, null); - createFile(container, classifier.getName() + DOT + hppExt, fileContent, true); - - // String manualURI = "TODO"; - // fileContent = AcceleoDriver.evaluateURI(new URI(CppPackageHeader)), classifier); - - fileContent = commentHeader + - AcceleoDriver.evaluate(cppInclude.getPreBody(), classifier, null) + GenUtils.NL + - AcceleoDriver.evaluate(cppInclude.getBody(), classifier, null) + GenUtils.NL; - String ext = GenUtils.maskNull(mg.getExtensionBody()); - if (ext.length() == 0) { - ext = cppExt; - } - createFile(container, classifier.getName() + DOT + ext, fileContent, true); - } catch (AcceleoException e) { - Activator.log.error(e); - } - } - - // Only generate when no CppNoCodeGen stereotype is applied to the class - else if ((!noCodeGen(classifier)) && - (!GenUtils.hasStereotype(classifier, Template.class)) && - (!(classifier instanceof Association))) { - - // Template Bound Class - if (GenUtils.isTemplateBoundElement(classifier)) { - String fileContent = commentHeader + AcceleoDriver.evaluateURI(CppBindHeader, classifier); - createFile(container, classifier.getName() + DOT + hppExt, fileContent, true); - - fileContent = commentHeader + AcceleoDriver.evaluateURI(CppBindBody, classifier); - createFile(container, classifier.getName() + DOT + cppExt, fileContent, true); - } - else { - // Header file generation - String fileContent = commentHeader + AcceleoDriver.evaluateURI(CppClassHeader, classifier); - createFile(container, classifier.getName() + DOT + hppExt, fileContent, true); - - // Create class body - if (classifier instanceof Class) { - fileContent = commentHeader + AcceleoDriver.evaluateURI(CppClassBody, classifier); - createFile(container, classifier.getName() + DOT + cppExt, fileContent, true); - } - } - } + CppClassifierGenerator.generate(container, classifier, commentHeader); } @Override @@ -174,15 +107,14 @@ public class CppModelElementsCreator extends ModelElementsCreator { } /** - * Apply the user's currently selected formatting options to the input content. Return the + * Apply the user's currently selected formatting options to the input content. Return the * input String in case of error. */ private static String format(String content) { // do nothing if the CDT plugin is not loaded - if (Platform.getBundle(CCorePlugin.PLUGIN_ID) == null) { + if (Platform.getBundle(CCorePlugin.PLUGIN_ID) == null) return content; - } CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(null); IDocument doc = new Document(content); @@ -208,21 +140,18 @@ public class CppModelElementsCreator extends ModelElementsCreator { @Override protected void createPackageFiles(IContainer packageContainer, IProgressMonitor monitor, Package pkg) throws CoreException { - // Creates the header for the package. - String fileContent = commentHeader + AcceleoDriver.evaluateURI(CppPackageHeader, pkg); - createFile(packageContainer, "Pkg_" + pkg.getName() + DOT + hppExt, fileContent, true); //$NON-NLS-1$ + CppPackageHeaderGenerator.generate(packageContainer, pkg); } - @Override protected boolean isRoot(Namespace ns) { return GenUtils.hasStereotype(ns, CppRoot.class); } - @Override protected boolean noCodeGen(Element element) { - return GenUtils.hasStereotype(element, NoCodeGen.class) || - GenUtils.hasStereotype(element, External.class) || - GenUtils.hasStereotypeTree(element, ExternLibrary.class); + return + GenUtils.hasStereotype(element, NoCodeGen.class) || + GenUtils.hasStereotype(element, External.class) || + GenUtils.hasStereotypeTree(element, ExternLibrary.class); } } diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.emtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.emtl deleted file mode 100644 index 1e5df902647..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.emtl +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - - 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 5a1aaf25527..ce009fc9a29 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 @@ -16,6 +16,7 @@ import org.eclipse.emf.common.util.UniqueEList; import org.eclipse.papyrus.acceleo.GenUtils; import org.eclipse.uml2.uml.Class; import org.eclipse.uml2.uml.Classifier; +import org.eclipse.uml2.uml.Interface; /** * A set of utility functions related to classes. @@ -43,7 +44,8 @@ public class ClassUtils { // realized interface dependencies if (currentClass instanceof Class) { Class clazz = (Class) currentClass; - usedClasses.addAll(clazz.getImplementedInterfaces()); + EList implementedInterfaces = clazz.getImplementedInterfaces(); + usedClasses.addAll(implementedInterfaces); } // dependencies and associations usedClasses.addAll(GenUtils.getTypesViaRelationshipsNoDeps(currentClass)); diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.mtl b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.mtl deleted file mode 100644 index 13fe22ce295..00000000000 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/utils/ClassUtils.mtl +++ /dev/null @@ -1,6 +0,0 @@ -[comment encoding = UTF-8 /] -[module ClassUtils('http://www.eclipse.org/uml2/5.0.0/UML')/] - -[query public includedClassifiers(cl : Classifier) : Sequence(Classifier) - = invoke('org.eclipse.papyrus.cpp.codegen.utils.ClassUtils', 'includedClassifiers(org.eclipse.uml2.uml.Classifier)', Sequence{cl}) /] - diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend new file mode 100644 index 00000000000..2f7dd1c9e5b --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend @@ -0,0 +1,70 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Classifier +import org.eclipse.uml2.uml.Class +import org.eclipse.uml2.uml.DataType +import org.eclipse.uml2.uml.Interface +import org.eclipse.uml2.uml.Signal +import org.eclipse.uml2.uml.Property +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.C_Cpp.Const +import org.eclipse.papyrus.cpp.codegen.utils.Modifier +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppAttribute { + + // Loop over attributes. Check that the attribute is not a static const. + // Constant static attributes are declared within the class declaration + static def CppStaticAttributes(Classifier classifier) { + var code = ''' + // static attributes (if any) + «FOR ownedAttribute : getOwnedAttributes(classifier)» + «IF (ownedAttribute.isStatic && !GenUtils.hasStereotype(ownedAttribute, Const))» + «CppStaticAttributeImplementation(ownedAttribute)» + «ENDIF» + «ENDFOR» + ''' + return code + } + + //return a list of owned attributes, since this is not supported directly on a classifier + static def getOwnedAttributes(Classifier cl) { + if (cl instanceof Class) { + (cl as Class).ownedAttributes + } else if (cl instanceof DataType) { + (cl as DataType).ownedAttributes + } else if (cl instanceof Interface) { + (cl as Interface).ownedAttributes + } else if (cl instanceof Signal) { + (cl as Signal).ownedAttributes + } else { + //Sequence{} + } + } + + static def CppStaticAttributeImplementation(Property attribute) ''' + «CppDocumentation.CppElementDoc(attribute)» + «CppGenUtils.cppQualifiedName(attribute.type)»«Modifier.modPtr(attribute)»«Modifier.modRef(attribute)» «attribute.class_.name»::«attribute.name»«Modifier.modArray(attribute)»«defaultValue(attribute)»; + ''' + + static def defaultValue(Property attribute) { + if ((attribute.defaultValue != null) && attribute.isStatic) { + "=" + attribute.defaultValue.stringValue() + } + } + + static def CppAttributeDeclaration(Property attribute) ''' + «CppDocumentation.CppElementDoc(attribute)» + «staticValue(attribute)» «Modifier.modCVQualifier(attribute)»«CppGenUtils.cppQualifiedName(attribute.type)»«Modifier. + modPtr(attribute)»«Modifier.modRef(attribute)» «attribute.name»«Modifier.modArray(attribute)»«IF GenUtils. + hasStereotype(attribute, Const)»«defaultValue(attribute)»«ENDIF»; + ''' + + static def staticValue(Property attribute) { + if (attribute.isStatic) 'static' + } + +} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.xtend new file mode 100644 index 00000000000..d272163fb1f --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassAttributesDeclaration.xtend @@ -0,0 +1,15 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Classifier +import org.eclipse.uml2.uml.VisibilityKind + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassAttributesDeclaration { + static def CppClassAttributesDeclaration(Classifier clazz, VisibilityKind visibilityFilter) ''' + «FOR oa : CppAttribute.getOwnedAttributes(clazz).filter[it.visibility == visibilityFilter]» + «CppAttribute.CppAttributeDeclaration(oa)» + «ENDFOR» + ''' +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.xtend new file mode 100644 index 00000000000..d754cf6f4d8 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassFriendDeclaration.xtend @@ -0,0 +1,24 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Classifier +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.C_Cpp.Friend +import org.eclipse.papyrus.C_Cpp.NoCodeGen + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassFriendDeclaration { + static def CppClassFriendDeclaration(Classifier friend) ''' + friend class «CppGenUtils.cppQualifiedName(friend)» + ''' + + static def CppClassIncludeFriendDeclaration(Classifier clazz) { + for (uc : GenUtils.getUsedClassifiers(clazz)) { + if (GenUtils.hasStereotype(uc, Friend) && (!GenUtils.hasStereotype(uc, NoCodeGen))) { + CppClassFriendDeclaration(uc) + } + } + } +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.xtend new file mode 100644 index 00000000000..1ec45f63da6 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeClassDeclaration.xtend @@ -0,0 +1,58 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.papyrus.C_Cpp.CppRoot +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.uml2.uml.Package +import org.eclipse.uml2.uml.Classifier +import org.eclipse.emf.common.util.EList +import org.eclipse.papyrus.C_Cpp.NoCodeGen +import org.eclipse.papyrus.C_Cpp.External +import org.eclipse.uml2.uml.Enumeration +import org.eclipse.uml2.uml.PrimitiveType +import java.util.List +import java.util.ArrayList +import org.eclipse.papyrus.cpp.codegen.utils.ClassUtils + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassIncludeClassDeclaration { + + static def cppOwnerPackageIncludePath(Package pkg) { + if ((pkg != null) && (!GenUtils.hasStereotype(pkg, CppRoot))) { + return GenUtils.getFullPath(pkg) + '/Pkg_' + pkg.name + '.h' + } else { + return null + } + } + + static def CppClassAllIncludesDeclarationBody(Classifier classifier) { + cppClassAllIncludes(classifier, GenUtils.getTypesViaDependencies(classifier)) + } + + static def cppClassAllIncludes(Classifier classifier, EList list) { + var List newList = new ArrayList() + for (cl : list) { + //var String str = null + if ((cl != classifier) && (!GenUtils.hasStereotype(cl, NoCodeGen)) || (GenUtils.hasStereotype(cl, External))) { + if ((cl instanceof Enumeration) || (cl instanceof PrimitiveType)) { + if ((cl.owner != null) && (cl.owner instanceof Package)) { + var includePath = (cl.owner as Package).cppOwnerPackageIncludePath + if (!newList.contains(includePath)) newList.add(includePath) + } else { + //str = null + } + } else { + newList.addAll(CppClassIncludeDeclaration.cppClassIncludes(cl)) + } + } else { + //str = null + } + } + return newList.filter[str | str != null] + } + + static def CppClassAllIncludes(Classifier clazz) { + cppClassAllIncludes(clazz, ClassUtils.includedClassifiers(clazz)) + } +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.xtend new file mode 100644 index 00000000000..a612b90f92a --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassIncludeDeclaration.xtend @@ -0,0 +1,40 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import java.util.ArrayList +import java.util.List +import org.eclipse.papyrus.C_Cpp.ExternLibrary +import org.eclipse.papyrus.C_Cpp.External +import org.eclipse.papyrus.C_Cpp.Template +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils +import org.eclipse.uml2.uml.NamedElement +import org.eclipse.uml2.uml.util.UMLUtil + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassIncludeDeclaration { + + static def cppClassIncludes(NamedElement ne) { + var List result = new ArrayList() + if (GenUtils.hasStereotypeTree(ne, ExternLibrary)) { + result = GenUtils.getApplicationTree(ne, ExternLibrary).includes + } else { + result.add(includeName(ne)) + } + return result + } + + static def includeName(NamedElement ne) { + if (GenUtils.hasStereotypeTree(ne, Template)) { + return UMLUtil.getStereotypeApplication(ne, Template).declaration + } else { + if (GenUtils.hasStereotypeTree(ne, External)) { + return UMLUtil.getStereotypeApplication(ne, External).name + } else { + // standard case (no stereotypes are applied) + return GenUtils.getFullPath(ne.nearestPackage) + '/' + ne.name + '.' + CppCodeGenUtils.getHeaderSuffix() + } + } + } +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.xtend new file mode 100644 index 00000000000..01cbd24bb6f --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassInheritedDeclarations.xtend @@ -0,0 +1,38 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.papyrus.C_Cpp.NoCodeGen +import org.eclipse.papyrus.C_Cpp.Visibility +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.uml2.uml.Classifier +import org.eclipse.uml2.uml.Generalization +import org.eclipse.uml2.uml.InterfaceRealization +import org.eclipse.uml2.uml.Relationship +import org.eclipse.uml2.uml.util.UMLUtil +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassInheritedDeclarations { + + static def CppClassInheritedDeclarations(Classifier clazz) ''' + «IF (filteredRelationships(clazz).length > 0)» : «ENDIF» + «FOR fr: filteredRelationships(clazz) SEPARATOR ', \n'» + «getCppVisibility(fr)» «CppGenUtils.cppQualifiedName(fr.targets.get(0) as Classifier)»«ENDFOR» + ''' + + //Return a list of relationships that are either Generalizations or InterfaceRealiazations + //and the target does not point to a classifier that has the no-code-gen Stereotype + //TODO: not sure if it makes sense NOT to declare an inheritance, since we do not generate code. + static def filteredRelationships(Classifier clazz) { + clazz.sourceDirectedRelationships.filter[((it instanceof Generalization) || (it instanceof InterfaceRealization)) && (!GenUtils.hasStereotype(it.targets.get(0), NoCodeGen))] + } + + static def getCppVisibility(Relationship relationship) { + if (GenUtils.hasStereotype(relationship, Visibility)) { + (UMLUtil.getStereotypeApplication(relationship, Visibility) as Visibility).value + } else { + 'public' + } + } +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.xtend new file mode 100644 index 00000000000..e986acbb236 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsDeclaration.xtend @@ -0,0 +1,25 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Classifier +import org.eclipse.uml2.uml.OpaqueBehavior +import org.eclipse.uml2.uml.VisibilityKind + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassOperationsDeclaration { + + static def CppClassOperationsDeclaration(Classifier clazz, VisibilityKind visibilityFilter) ''' + «FOR op : CppOperations.getOwnedOperations(clazz).filter[it.visibility == visibilityFilter]» + + «CppOperations.CppOperationDeclaration(op)» + «ENDFOR» + «FOR b : clazz.eAllContents.toList.filter(OpaqueBehavior).filter[it.visibility == visibilityFilter]» + «IF b.specification == null» + + // opaque behavior without specification (typically from state machine) + «CppOperations.CppBehaviorDeclaration(b)» + «ENDIF» + «ENDFOR» + ''' +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.xtend new file mode 100644 index 00000000000..abb5ae392fa --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassOperationsImplementation.xtend @@ -0,0 +1,29 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Classifier +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.C_Cpp.NoCodeGen +import org.eclipse.uml2.uml.OpaqueBehavior +import org.eclipse.papyrus.C_Cpp.Inline + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassOperationsImplementation { + + // implementations of a classifier, parameter controls whether only inline (or only not inline) operations + //are produced + static def CppClassOperationsImplementation(Classifier clazz, boolean inline) ''' + «FOR ownedOperation : CppOperations.getOwnedOperations(clazz).filter[(!(GenUtils.hasStereotype(it, NoCodeGen) || it.isAbstract)) && (GenUtils.hasStereotype(it, org.eclipse.papyrus.C_Cpp.Inline) == inline)] SEPARATOR "\n"» + «CppOperations.CppOperationImplementation(ownedOperation)» + «ENDFOR» + + «FOR b : clazz.eAllContents.toIterable.filter[(it instanceof OpaqueBehavior) && GenUtils.hasStereotype((it as OpaqueBehavior), Inline)==inline]» + «IF (b as OpaqueBehavior).specification == null» + // opaque behavior without specification (typically from state machine) + «CppOperations.CppBehaviorImplementation(b as OpaqueBehavior)» + «ENDIF» + «ENDFOR» + ''' + +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.xtend new file mode 100644 index 00000000000..f3e1a8d3d5c --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassTypeAndEnum.xtend @@ -0,0 +1,52 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.papyrus.C_Cpp.NoCodeGen +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils +import org.eclipse.uml2.uml.Classifier +import org.eclipse.uml2.uml.Element +import org.eclipse.uml2.uml.Enumeration +import org.eclipse.uml2.uml.Namespace +import org.eclipse.uml2.uml.Package +import org.eclipse.uml2.uml.PrimitiveType +import org.eclipse.uml2.uml.VisibilityKind + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassTypeAndEnum { + + static def CppClassTypeAndEnum(Classifier clazz) ''' + «var publicStr = TypesAndEnumsForVisibility(clazz, VisibilityKind.PUBLIC_LITERAL).toString» + «CppGenUtils.getSection(VisibilityKind.PUBLIC_LITERAL, publicStr)» + «var protectedStr = TypesAndEnumsForVisibility(clazz, VisibilityKind.PROTECTED_LITERAL).toString» + «CppGenUtils.getSection(VisibilityKind.PROTECTED_LITERAL, protectedStr)» + «var privateStr = TypesAndEnumsForVisibility(clazz, VisibilityKind.PRIVATE_LITERAL).toString» + «CppGenUtils.getSection(VisibilityKind.PRIVATE_LITERAL, privateStr)» + ''' + + static def CppClassTypeAndEnumPackage(Package pkg) { + TypesAndEnumsForVisibility(pkg, VisibilityKind.get(VisibilityKind.PACKAGE)) + TypesAndEnumsForVisibility(pkg, VisibilityKind.get(VisibilityKind.PUBLIC)) + } + + static def TypesAndEnumsForVisibility(Namespace ne, VisibilityKind visibilityFilter) ''' + «FOR ownedElement : ne.ownedElements» + «TypeAndEnumForVisibility(ownedElement, visibilityFilter)» + «ENDFOR» + ''' + + static def TypeAndEnumForVisibility(Element element, VisibilityKind visibilityFilter) { + if ((!GenUtils.hasStereotype(element, NoCodeGen)) && (element instanceof Classifier)) { + var elementVisibility = (element as Classifier).visibility + var value = elementVisibility.value + if ((value == visibilityFilter.value)) { + if (element instanceof Enumeration) { + return CppEnumerations.CppEnumerationDefinition(element as Enumeration) + } else if (element instanceof PrimitiveType) { + return CppPrimitiveTypes.CppPrimitiveTypeDefinition(element as PrimitiveType) + } + } + } + } +} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.xtend new file mode 100644 index 00000000000..281aff8a275 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppClassifierGenerator.xtend @@ -0,0 +1,329 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.core.resources.IContainer +import org.eclipse.papyrus.C_Cpp.ExternLibrary +import org.eclipse.papyrus.C_Cpp.External +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.C_Cpp.Union +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils +import org.eclipse.uml2.uml.Association +import org.eclipse.uml2.uml.Class +import org.eclipse.uml2.uml.Classifier +import org.eclipse.uml2.uml.DataType +import org.eclipse.uml2.uml.Element +import org.eclipse.uml2.uml.NamedElement +import org.eclipse.uml2.uml.VisibilityKind +import org.eclipse.uml2.uml.profile.standard.Create +import org.eclipse.uml2.uml.util.UMLUtil +import org.eclipse.papyrus.acceleo.AcceleoDriver +import org.eclipse.papyrus.cpp.codegen.transformation.CppModelElementsCreator + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppClassifierGenerator extends CppFileGenerator { + + static def generate(IContainer container, Classifier classifier, String commentHeader) { + + // treat case of manual code generation + if (GenUtils.hasStereotype(classifier, ManualGeneration)) { + var ManualGeneration mg = UMLUtil.getStereotypeApplication(classifier, ManualGeneration); + var Include cppInclude = UMLUtil.getStereotypeApplication(classifier, Include); + var fileContentH = commentHeader + + AcceleoDriver.evaluate(cppInclude.getHeader(), classifier, null); + + // generate header code + val fileNameH = classifier.getName() + CppModelElementsCreator.DOT + CppCodeGenUtils.getHeaderSuffix() + generateFile(container, fileNameH, fileContentH, true); + + // generate body code + val fileContentB = commentHeader + + AcceleoDriver.evaluate(cppInclude.getPreBody(), classifier, null) + GenUtils.NL + + AcceleoDriver.evaluate(cppInclude.getBody(), classifier, null) + GenUtils.NL; + var ext = GenUtils.maskNull(mg.getExtensionBody()); + if (ext.length() == 0) { + ext = CppCodeGenUtils.getBodySuffix(); + } + val fileNameB = classifier.getName() + CppModelElementsCreator.DOT + ext; + generateFile(container, fileNameB, fileContentB, true); + } + + // Only generate when no CppNoCodeGen stereotype is applied to the class + else if ((!classifier.noCodeGen) && (!GenUtils.hasStereotype(classifier, Template)) && + (!(classifier instanceof Association))) { + + // Template Bound Class + if (GenUtils.isTemplateBoundElement(classifier)) { + val bindHeaderFileName = classifier.getName() + "." + CppCodeGenUtils.getHeaderSuffix() + generateFile(container, bindHeaderFileName, classifier.generateBindHeaderCode, true); + + var bindBodyFileName = classifier.getName() + "." + CppCodeGenUtils.getBodySuffix() + generateFile(container, bindBodyFileName, classifier.generateBindBodyCode, true); + } else { + + // Class Header file generation + val classHeaderFileName = classifier.getName() + "." + CppCodeGenUtils.getHeaderSuffix() + generateFile(container, classHeaderFileName, classifier.generateClassHeaderCode, true); + + // Class Body file generation + if (classifier instanceof Class) { + var classBodyFileName = classifier.getName() + "." + CppCodeGenUtils.getBodySuffix() + generateFile(container, classBodyFileName, classifier.generateClassBodyCode, true); + } + } + } + } + + static def noCodeGen(Element element) { + return GenUtils.hasStereotype(element, NoCodeGen) || GenUtils.hasStereotype(element, External) || + GenUtils.hasStereotypeTree(element, ExternLibrary); + } + + static def generateHeaderCode(Classifier classifier, String commentHeader) { + var code = ''' + «commentHeader» + AcceleoDriver.evaluate(cppInclude.getHeader(), classifier, null); + ''' + return code + } + + static def generateBindHeaderCode(Classifier classifier) { + var code = ''' + #ifndef «GenUtils.getFullNameUC(classifier)»_H + #define «GenUtils.getFullNameUC(classifier)»_H + + /************************************************************ + «classifier.name» template binding header + ************************************************************/ + + «FOR path : getSortedIncludePathList(classifier)» + «CppIncludeUtil.includeDirective(path)» + «ENDFOR» + + «CppIncludeUtil.CppIncludeHeader(classifier)» + + «var tb = classifier.templateBindings» + «var templateElement = tb.get(0)» + «CppIncludeUtil.includeDirective( + GenUtils.getFullPath(classifier.package) + '/' + (templateElement.owner as NamedElement).name + '.' + + CppCodeGenUtils.getHeaderSuffix())» + + «CppGenUtils.openNS(classifier)» + /************************************************************/ + typedef «(templateElement.owner as NamedElement).name»«FOR ps : templateElement.parameterSubstitutions»«CppTemplates. + CppTemplateBindingParameter(ps)»«ENDFOR» «classifier.name»; + + «CppGenUtils.closeNS(classifier)» + + /************************************************************ + End of «classifier.name» template binding header + ************************************************************/ + + #endif''' + return code + } + + static def getSortedIncludePathList(Classifier classifier) { + var includePathList = CppClassIncludeClassDeclaration.CppClassAllIncludes(classifier) + var includePath = CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(classifier.package) + var theList = includePathList.toList + theList.add(includePath) + theList.sort + return theList + } + + static def generateBindBodyCode(Classifier classifier) { + var code = ''' + #define «GenUtils.getFullNameUC(classifier)»_BODY + + /************************************************************ + «classifier.name» template binding body + ************************************************************/ + + «CppIncludeUtil.CppIncludePreBody(classifier)» + + // include associated header file + «CppIncludeUtil.includeDirective( + GenUtils.getFullPath(classifier.package) + '/' + classifier.name + '.' + CppCodeGenUtils.getHeaderSuffix())» + + «CppIncludeUtil.CppIncludeBody(classifier)» + + «CppGenUtils.openNS(classifier)» + + // Derived includes directives + «FOR path : CppClassIncludeClassDeclaration.CppClassAllIncludes(classifier).sort» + «CppIncludeUtil.includeDirective(path)» + «ENDFOR» + + /************************************************************/ + «var tb = GenUtils.getTemplateBindings(classifier as Class)» + «var templateElement = tb.targets.get(0)» + template class «(templateElement.owner as NamedElement).name»<«FOR ps : tb.parameterSubstitutions»«CppTemplates. + CppTemplateBindingParameter(ps)»«ENDFOR»; + + «CppGenUtils.closeNS(classifier)» + + /************************************************************ + End of «classifier.name» template binding body + ************************************************************/''' + return code + } + + static def generateClassHeaderCode(Classifier classifier) { + var code = ''' + #ifndef «GenUtils.getFullNameUC(classifier)»_H + #define «GenUtils.getFullNameUC(classifier)»_H + + /************************************************************ + «classifier.name» class header + ************************************************************/ + + «FOR path : getSortedIncludePathList(classifier)» + «CppIncludeUtil.includeDirective(path)» + «ENDFOR» + + «CppIncludeUtil.CppIncludeHeader(classifier)» + + «CppGenUtils.openNS(classifier)» + + /************************************************************/ + «CppDocumentation.CppElementDoc(classifier)» + «CppTemplates.templateSignature(classifier)»«classUnionOrStruct(classifier)» «classifier.name»«CppClassInheritedDeclarations. + CppClassInheritedDeclarations(classifier)» { + «CppClassFriendDeclaration.CppClassIncludeFriendDeclaration(classifier)»«CppClassTypeAndEnum. + CppClassTypeAndEnum(classifier)» + «var publicVisibility = VisibilityKind.PUBLIC_LITERAL» + «CppGenUtils.getSection(publicVisibility, defaultInitializer(classifier))» + «CppGenUtils.getSection(publicVisibility, + CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, publicVisibility).toString)» + «CppGenUtils.getSection(publicVisibility, + CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, publicVisibility).toString)» + + «var protectedVisibility = VisibilityKind.PROTECTED_LITERAL» + «CppGenUtils.getSection(protectedVisibility, + CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, protectedVisibility).toString)» + «CppGenUtils.getSection(protectedVisibility, + CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, protectedVisibility).toString)» + + «var privateVisibility = VisibilityKind.PRIVATE_LITERAL» + «CppGenUtils.getSection(privateVisibility, + CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, privateVisibility).toString)» + «CppGenUtils.getSection(privateVisibility, + CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, privateVisibility).toString)» + }; + /************************************************************/ + /* External declarations (package visibility) */ + «var packageVisibility = VisibilityKind.PACKAGE_LITERAL» + «CppClassAttributesDeclaration.CppClassAttributesDeclaration(classifier, packageVisibility)» + «CppClassOperationsDeclaration.CppClassOperationsDeclaration(classifier, packageVisibility)» + /************************************************************/ + + «IF CppTemplates.isTemplate(classifier)» + /************************************************************/ + /* Template functions */ + «CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, false)» + «ENDIF» + + /* Inline functions */ + «CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, true)» + «CppGenUtils.closeNS(classifier)» + + /************************************************************ + End of «classifier.name» class header + ************************************************************/ + + #endif''' + return code + } + + static def classUnionOrStruct(Classifier classifier) { + if (GenUtils.hasStereotype(classifier, Union)) { + return 'union' + } else { + if (classifier instanceof DataType) { + CppGenUtils.resetVisibility(VisibilityKind.PUBLIC_LITERAL) + return 'struct' + } else { + CppGenUtils.resetVisibility(VisibilityKind.PRIVATE_LITERAL) + return 'class' + } + } + } + + /** + * default initializer for non-static attributes with a default value TODO: should be disabled by default, since non-static members can be initialized directly in C++ 011 + */ + static def defaultInitializer(Classifier classifier) { + + /* Bug 422373: The default initializer should not be generated if there are any user-defined + constructors. In plain C++ code, the existence of a constructor with parameters + means that the compiler will not synthesize a default one. + + E.g., this would be invalid in plain C++ code: + class T1 { }; + class T2 { public: T(int); }; + T1 * t1 = new T1; // OK, sythesized default constructor used + T2 * t2a = new T2(5); // OK, user-defined constructor used + T2 * t2b = new T2; // ERROR, default constructor was not synthesized + + Also, if the user has provided a default constructor in the code, we don't need + to generate a second copy here. A default constructor should only be generated + here if the compiler would have synthesized one anyhow. Otherwise the default + property values should be set in the constructors that are generated by + CppClassOperationsDeclaration. + */ + var code = ''' + «IF CppOperations.getOwnedOperations(classifier).filter[GenUtils.hasStereotype(it, Create)] == null» + «var attributeList = classifier.attributes.filter[ + (it.isStatic == false) && (it.defaultValue != null) && (it.defaultValue.stringValue != null)]» + «IF !attributeList.empty» + «classifier.name» : «FOR a : attributeList SEPARATOR ', '»«a.name»(«a.defaultValue.stringValue»)«ENDFOR» {} + «ENDIF» + «ENDIF»''' + return code.trim + } + + static def generateClassBodyCode(Classifier classifier) { + var code = ''' + #define «GenUtils.getFullName(classifier)»_BODY + + /************************************************************ + «classifier.name» class body + ************************************************************/ + + «CppIncludeUtil.CppIncludePreBody(classifier)» + + // include associated header file + «CppIncludeUtil.includeDirective( + GenUtils.getFullPath(classifier.nearestPackage) + '/' + classifier.name + '.' + + CppCodeGenUtils.getHeaderSuffix())» + + // Derived includes directives + «FOR path : CppClassIncludeClassDeclaration.CppClassAllIncludesDeclarationBody(classifier).sort» + «CppIncludeUtil.includeDirective(path)» + «ENDFOR» + + «CppIncludeUtil.CppIncludeBody(classifier)» + + «CppGenUtils.openNS(classifier)» + + «CppAttribute.CppStaticAttributes(classifier)» + + «IF !classifier.isTemplate» + «CppClassOperationsImplementation.CppClassOperationsImplementation(classifier, false)» + «ENDIF» + + «CppGenUtils.closeNS(classifier)» + + /************************************************************ + End of «classifier.name» class body + ************************************************************/''' + return code + } + +} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppCodeGenerator.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppCodeGenerator.xtend new file mode 100644 index 00000000000..b20f551a366 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppCodeGenerator.xtend @@ -0,0 +1,66 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.core.resources.IResource +import org.eclipse.core.runtime.CoreException +import org.eclipse.emf.common.util.EList +import org.eclipse.papyrus.cpp.codegen.Activator +import org.eclipse.papyrus.cpp.codegen.utils.ClassUtils +import org.eclipse.uml2.uml.Classifier +import org.eclipse.uml2.uml.Package +import org.eclipse.uml2.uml.PackageableElement +import org.eclipse.papyrus.cpp.codegen.transformation.CppModelElementsCreator + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +public class CppCodeGenerator { + + /** + * Generate code for a passed packageable element and the elements required by it (in the sense of #included statements) + * + * @param mec model elements creator + * @param pe the element that should be generated + * @param alreadyHandled list of packageable elements for which code has already been generated. + * @param recurse if the passed packageableElement is a package, generate code for its contents (recursively). + */ + static def generate(CppModelElementsCreator mec, PackageableElement pe, EList alreadyHandled, + boolean recurse) { + val srcPkg = mec.getContainer(pe); + try { + alreadyHandled.add(pe); + mec.createPackageableElement(srcPkg, null, pe, false); + } catch (CoreException coreException) { + Activator.log.error(coreException); + } finally { + // Refresh the container for the newly created files. This needs to be done even + // during error because of the possibility for partial results. + try { + srcPkg.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch(CoreException e) { + Activator.log.error(e); + } + } + + if (pe instanceof Classifier) { + var EList requiredClassifiers = ClassUtils.includedClassifiers((pe as Classifier)); + for (Classifier requiredClassifier : requiredClassifiers) { + if (!alreadyHandled.contains(requiredClassifier)) { + generate(mec, requiredClassifier, alreadyHandled, false); + } + } + } + // owning package is required by generated code. + var Package owningPackage = pe.getNearestPackage(); + if ((owningPackage != null) && (owningPackage != pe)) { + if (!alreadyHandled.contains(owningPackage)) { + generate(mec, owningPackage, alreadyHandled, false); + } + } + if ((pe instanceof Package) && recurse) { + // Continue generation parsing package contents + for(PackageableElement currentElement : (pe as Package).getPackagedElements()) { + generate(mec, currentElement, alreadyHandled, recurse); + } + } + } +} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.xtend new file mode 100644 index 00000000000..d196d3cddd3 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppDocumentation.xtend @@ -0,0 +1,37 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Element +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.uml2.uml.Operation +import org.eclipse.uml2.uml.Parameter +import org.eclipse.uml2.uml.Behavior +import org.eclipse.uml2.uml.ParameterDirectionKind + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppDocumentation { + static def CppElementDoc(Element argument) ''' + /** + * «GenUtils.getComments(argument).replaceAll('\n', '\n * ')» + */ + ''' + + static def CppOperationDoc(Operation operation) ''' + /** + * «GenUtils.getComments(operation).replaceAll('\n', '\n * ')» + «FOR op: operation.ownedParameters.filter[it.direction != ParameterDirectionKind.RETURN_LITERAL]»«CppParamDoc(op)»«ENDFOR» + */ + ''' + + static def CppParamDoc(Parameter parameter) ''' + * @param «parameter.name» «GenUtils.getComments(parameter).replaceAll('\n', '\n * ')» + ''' + + static def CppBehaviorDoc(Behavior behavior) ''' + /** + * «GenUtils.getComments(behavior).replaceAll('\n', '\n * ')» + * «FOR op : behavior.ownedParameters»«CppParamDoc(op)»«ENDFOR» + */ + ''' +} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.xtend new file mode 100644 index 00000000000..909bae5b37b --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppEnumerations.xtend @@ -0,0 +1,22 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Enumeration +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.C_Cpp.CppInit +import org.eclipse.uml2.uml.util.UMLUtil + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppEnumerations { + static def CppEnumerationDefinition(Enumeration enume) ''' + «CppDocumentation.CppElementDoc(enume)» + enum «enume.name» { + «FOR ownedLiteral : enume.ownedLiterals» + «CppDocumentation.CppElementDoc(ownedLiteral)» + «ownedLiteral.name»«IF GenUtils.hasStereotype(ownedLiteral, CppInit)»«UMLUtil. + getStereotypeApplication(ownedLiteral, CppInit).value»«ENDIF», + «ENDFOR» + }; + ''' +} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppFileGenerator.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppFileGenerator.xtend new file mode 100644 index 00000000000..ddf38c16473 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppFileGenerator.xtend @@ -0,0 +1,100 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import java.io.ByteArrayInputStream +import java.io.IOException +import java.io.OutputStream +import org.eclipse.core.filesystem.EFS +import org.eclipse.core.filesystem.IFileStore +import org.eclipse.core.resources.IContainer +import org.eclipse.core.resources.IFile +import org.eclipse.core.resources.IFolder +import org.eclipse.core.resources.IProject +import org.eclipse.core.runtime.CoreException +import org.eclipse.core.runtime.Platform +import org.eclipse.cdt.core.CCorePlugin +import org.eclipse.cdt.core.formatter.CodeFormatter +import org.eclipse.cdt.core.ToolFactory +import org.eclipse.jface.text.IDocument +import org.eclipse.jface.text.Document +import org.eclipse.text.edits.TextEdit +import org.eclipse.papyrus.cpp.codegen.Activator +import org.eclipse.papyrus.cpp.codegen.Messages +import org.eclipse.text.edits.MalformedTreeException +import org.eclipse.jface.text.BadLocationException + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +abstract class CppFileGenerator { + + static def generateFile(IContainer owner, String filename, String content, boolean force) { + var IFile file = null; + if (owner instanceof IProject) { + file = (owner as IProject).getFile(filename) + } else if(owner instanceof IFolder) { + file = (owner as IFolder).getFile(filename) + } else { + // undefined + } + + if(file != null) { + createFile(file, format(content), force); + } + } + + static def void createFile(IFile file, String content, boolean force) throws CoreException { + if (file.exists() && force) { + // file.delete(true,true,null); + // YT - deleting files produce inconsistency in SVN working copies + var locationURI = file.getLocationURI(); + if(locationURI != null) { + var IFileStore store = EFS.getStore(locationURI); + var OutputStream os = store.openOutputStream(0, null); + try { + os.write(content.getBytes()); + } catch (IOException e) { + throw new RuntimeException ("C++ code generation: " + e.getMessage()); //$NON-NLS-1$ + } + } + // file.setContents(new ByteArrayInputStream(content.getBytes()), + // true, true, null); + } else if(file.exists() && !(force)) { + // the file is not updated + } else { + // the file does not exists + file.create(new ByteArrayInputStream(content.getBytes()), true, null); + } + } + + /** + * Apply the user's currently selected formatting options to the input content. Return the + * input String in case of error. + */ + static def String format(String content) { + + // do nothing if the CDT plugin is not loaded + if (Platform.getBundle(CCorePlugin.PLUGIN_ID) == null) + return content; + + var CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(null); + var IDocument doc = new Document(content); + + var TextEdit edit = codeFormatter.format(CodeFormatter.K_TRANSLATION_UNIT, doc.get(), 0, doc.get().length(), 0, null); + + if (edit == null) { + Activator.log.debug(Messages.CppModelElementsCreator_CannotFormatContent); + return content; + } + + try { + edit.apply(doc); + return doc.get(); + } catch (MalformedTreeException e) { + Activator.log.error(e); + } catch (BadLocationException e) { + Activator.log.error(e); + } + + return content; + } +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.xtend new file mode 100644 index 00000000000..e9e8d003351 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppIncludeUtil.xtend @@ -0,0 +1,72 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.NamedElement +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.C_Cpp.Include +import org.eclipse.uml2.uml.util.UMLUtil + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppIncludeUtil { + static def includeDirective(String path) { + if ((path != null) && (path.length > 0)) + return '''#include ''' + '"' + path + '"' + } + + static def CppIncludeHeader(NamedElement ne) { + if (GenUtils.hasStereotype(ne, Include)) { + UMLUtil.getStereotypeApplication(ne, Include) + var header = UMLUtil.getStereotypeApplication(ne, Include).header + if ((header != null) && (header.length > 0)) { + var includeHeader = constIncludeHeaderStart + GenUtils.cleanCR(header) + constIncludeHeaderEnd + return includeHeader + } + } + } + + static def constIncludeHeaderStart() ''' + // Include from Include stereotype (header) + ''' + + static def constIncludeHeaderEnd() ''' + // End of Include stereotype (header) + ''' + + static def CppIncludePreBody(NamedElement ne) { + if (GenUtils.hasStereotype(ne, Include)) { + var String preBody = UMLUtil.getStereotypeApplication(ne, Include).preBody + if ((preBody != null) && (preBody.length > 0)) { + var includePreBody = constIncludePreBodyStart + GenUtils.cleanCR(preBody) + constIncludePreBodyEnd + return includePreBody + } + } + } + + static def constIncludePreBodyStart() ''' + // Include from Include stereotype (pre-body) + ''' + + static def constIncludePreBodyEnd() ''' + // End of Include stereotype (pre-body) + ''' + + static def CppIncludeBody(NamedElement ne) { + if (GenUtils.hasStereotype(ne, Include)) { + var String body = UMLUtil.getStereotypeApplication(ne, Include).body + if ((body != null) && (body.length > 0)) { + var includeBody = constIncludeBodyStart + GenUtils.cleanCR(body) + '\n' + constIncludeBodyEnd + return includeBody + } + } + } + + static def constIncludeBodyStart() ''' + // Include from Include declaration (body) + ''' + + static def constIncludeBodyEnd() ''' + // End of Include declaration (body) + ''' + +} diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.xtend new file mode 100644 index 00000000000..53b4625212e --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppOperations.xtend @@ -0,0 +1,128 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.papyrus.C_Cpp.Inline +import org.eclipse.papyrus.C_Cpp.Virtual +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils +import org.eclipse.papyrus.cpp.codegen.utils.Modifier +import org.eclipse.uml2.uml.Behavior +import org.eclipse.uml2.uml.Class +import org.eclipse.uml2.uml.Classifier +import org.eclipse.uml2.uml.DataType +import org.eclipse.uml2.uml.Element +import org.eclipse.uml2.uml.Interface +import org.eclipse.uml2.uml.OpaqueBehavior +import org.eclipse.uml2.uml.Operation +import org.eclipse.uml2.uml.profile.standard.Create +import org.eclipse.uml2.uml.profile.standard.Destroy +import org.eclipse.papyrus.C_Cpp.ConstInit +import org.eclipse.uml2.uml.util.UMLUtil + +class CppOperations { + static def CppOperationImplementation(Operation operation) ''' + «CppDocumentation.CppOperationDoc(operation)» + «IF (operation.name == 'main')» + «CppReturnSpec(operation)»«operation.name»(«CppParameter.CppOperationParameters(operation,false)») { + «GenUtils.getBody(operation, 'C/C++')» + } + «ELSE» + «CppTemplates.templateSignature(operation)»«InlineTxt(operation)»«CppReturnSpec(operation)»«operation.featuringClassifiers.get(0).name»«CppTemplates.templateShortSignature(operation)»::«destructor(operation)»«operation.name»(«CppParameter.CppOperationParameters(operation, false)»)«throwss(operation)»«Modifier.modCVQualifier(operation)»«CppConstInit(operation)» { + «GenUtils.getBody(operation, 'C/C++')» + } + «ENDIF» + ''' + + static def CppReturnSpec(Operation operation) { + if ((operation.type == null) || isConsOrDestructor(operation)) { + ConsDestructorOrVoid(operation) + } else { + Modifier.modCVQualifier(operation.getReturnResult())+' '+CppGenUtils.cppQualifiedName(operation.type)+Modifier.modPtr(operation.getReturnResult())+Modifier.modRef(operation.getReturnResult())+' ' + } + } + + static def CppReturnSpec(Behavior behavior) ''' + «IF (GenUtils.returnResult(behavior) == null)»void «ELSE»«Modifier.modCVQualifier(GenUtils.returnResult(behavior))» «CppGenUtils.cppQualifiedName(GenUtils.returnResult(behavior).type)»«Modifier.modPtr(GenUtils.returnResult(behavior))»«Modifier.modRef(GenUtils.returnResult(behavior))» «ENDIF» + ''' + + static def throwss(Operation operation) ''' + «IF operation.raisedExceptions.length > 0» + throws «FOR re : operation.raisedExceptions SEPARATOR ','»«re.name»«ENDFOR» + «ENDIF» + ''' + + static def ConsDestructorOrVoid(Operation operation) { + if (isConsOrDestructor(operation)) { + + } else { + 'void ' + } + } + + static def isConsOrDestructor(Operation operation) { + GenUtils.hasStereotype(operation, Create) || GenUtils.hasStereotype(operation, Destroy) + } + + static def CppConstInit(Operation operation) { + if (GenUtils.hasStereotype(operation, ConstInit) && GenUtils.hasStereotype(operation, Create)) { + (UMLUtil.getStereotypeApplication(operation, ConstInit) as ConstInit).initialisation + } + } + + // return a list of owned operations, since this is not supported directly on a classifier/] + static def getOwnedOperations(Classifier cl) { + if (cl instanceof Class) { + (cl as Class).ownedOperations + } else { + if (cl instanceof DataType) { + (cl as DataType).ownedOperations + } else { + if (cl instanceof Interface) { + (cl as Interface).ownedOperations + } else { + // Sequence{} + } + } + } + } + + static def CppBehaviorImplementation(OpaqueBehavior behavior) ''' + «CppDocumentation.CppBehaviorDoc(behavior)» + «CppReturnSpec(behavior)»«behavior.context.name»::«behavior.name»(«CppParameter.CppBehaviorParameters(behavior, false)»)«Modifier.modCVQualifier(behavior)» { + «GenUtils.getBodyFromOB(behavior, 'C/C++')» + } + ''' + + static def CppOperationDeclaration(Operation operation) ''' + «CppDocumentation.CppOperationDoc(operation)» + «InlineTxt(operation)»«virtualTxt(operation)»«staticTxt(operation)»«CppReturnSpec(operation)»«destructor(operation)»«operation.name»(«CppParameter.CppOperationParameters(operation,true)»)«Modifier.modCVQualifier(operation)»«virtualSuffix(operation)»; + ''' + + static def InlineTxt(Element element) { + if (GenUtils.hasStereotype(element, Inline)) 'inline ' + } + + static def virtualTxt(Operation operation) { + if ((operation.interface != null) || (operation.isAbstract) || (GenUtils.hasStereotype(operation, Virtual))) 'virtual ' + } + + static def staticTxt(Operation operation) { + if (operation.isStatic) 'static ' + } + + static def destructor(Operation operation) { + if (GenUtils.hasStereotype(operation, Destroy) && (!operation.name.startsWith('~'))) { + '~' + } else { + '' + } + } + + static def public virtualSuffix(Operation operation) { + if ((operation.interface != null) || (operation.isAbstract)) ' = 0' + } + + static def CppBehaviorDeclaration(Behavior behavior) ''' + «CppDocumentation.CppBehaviorDoc(behavior)» + «InlineTxt(behavior)»«CppReturnSpec(behavior)»«behavior.name»(«CppParameter.CppBehaviorParameters(behavior, true)»)«Modifier.modCVQualifier(behavior)»; + ''' +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.xtend new file mode 100644 index 00000000000..126706c5a03 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPackageHeaderGenerator.xtend @@ -0,0 +1,63 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.core.resources.IContainer +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.cpp.codegen.preferences.CppCodeGenUtils +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils +import org.eclipse.uml2.uml.Package + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppPackageHeaderGenerator extends CppFileGenerator { + static def generate(IContainer packageContainer, Package pkg) { + val fileName = "Pkg_" + pkg.name + "." + CppCodeGenUtils.getHeaderSuffix() + generateFile(packageContainer, fileName, pkg.generateCode, true) + } + + static def generateCode(Package pkg) { + val code = ''' + #ifndef PKG_«GenUtils.getFullNameUC(pkg)» + #define PKG_«GenUtils.getFullNameUC(pkg)» + + /************************************************************ + Pkg_«pkg.name» package header + ************************************************************/ + + «CppIncludeUtil.includeDirective(CppClassIncludeClassDeclaration.cppOwnerPackageIncludePath(pkg.nestingPackage))» + + #ifndef _IN_ + #define _IN_ + #endif + #ifndef _OUT_ + #define _OUT_ + #endif + #ifndef _INOUT_ + #define _INOUT_ + #endif + + + /* Package dependency header include */ + «FOR p: GenUtils.getUsedPackages(pkg)» + «var path = GenUtils.getFullPath(p) + "/Pkg_"+ p.name + "." + CppCodeGenUtils.getHeaderSuffix» + «CppIncludeUtil.includeDirective(path)» + «ENDFOR» + + «CppIncludeUtil.CppIncludeHeader(pkg)» + «CppGenUtils.openNS(pkg)» + + // Types defined within the package + «IF pkg.name == "root"» + «var x = 0» + «ENDIF» + «CppClassTypeAndEnum.CppClassTypeAndEnumPackage(pkg)» + «CppGenUtils.closeNS(pkg)» + + /************************************************************ + End of Pkg_«pkg.name» package header + ************************************************************/ + + #endif''' + return code + } +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.xtend new file mode 100644 index 00000000000..7b8f496c978 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppParameter.xtend @@ -0,0 +1,35 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Operation +import org.eclipse.uml2.uml.Parameter +import org.eclipse.papyrus.cpp.codegen.utils.Modifier +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils +import org.eclipse.uml2.uml.ParameterDirectionKind +import org.eclipse.uml2.uml.Behavior + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppParameter { + + static def CppOperationParameters(Operation operation, boolean showDefault) ''' + «FOR ownedParameter : operation.ownedParameters.filter[it.direction != ParameterDirectionKind.RETURN_LITERAL] SEPARATOR ', '»«CppParameter(ownedParameter, showDefault)»«ENDFOR»''' + + /** + * comment signature for a given behavior (e.g. effect within state machine) + */ + static def CppBehaviorParameters(Behavior behavior, boolean showDefault) ''' + «FOR ownedParameter : behavior.ownedParameters.filter[it.direction != ParameterDirectionKind.RETURN_LITERAL] SEPARATOR ', '»«CppParameter(ownedParameter, showDefault)»«ENDFOR» + ''' + + /** + * C++ parameter. Default values are added, if parameter showDefault is true (implementation signature + */ + static def CppParameter(Parameter parameter, boolean showDefault) { + Modifier.modCVQualifier(parameter)+CppGenUtils.cppQualifiedName(parameter.type)+Modifier.modPtr(parameter)+Modifier.modRef(parameter)+" "+parameter.name + Modifier.modArray(parameter) + {if (showDefault) defaultValue(parameter) else ""} + } + + static def defaultValue(Parameter parameter) { + if (parameter.defaultValue != null) " = " + parameter.defaultValue.stringValue() else "" + } +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.xtend new file mode 100644 index 00000000000..3757e8dd098 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppPrimitiveTypes.xtend @@ -0,0 +1,38 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.PrimitiveType +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.C_Cpp.Typedef +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils +import org.eclipse.uml2.uml.util.UMLUtil + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppPrimitiveTypes { + + /** 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 + */ + static def CppPrimitiveTypeDefinition(PrimitiveType primitiveType) ''' + «CppDocumentation.CppElementDoc(primitiveType)» + «IF GenUtils.hasStereotype(primitiveType, Typedef)» + typedef «UMLUtil.getStereotypeApplication(primitiveType, Typedef).definition.replaceAll('typeName', primitiveType.name)» + «IF !UMLUtil.getStereotypeApplication(primitiveType, Typedef).definition.contains('typeName')»«primitiveType.name»«ENDIF»; + + «ELSE» + «CppGenUtils.getStdtypes(primitiveType)» + + «ENDIF» + ''' +} \ No newline at end of file diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.xtend new file mode 100644 index 00000000000..7ae148b2044 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppTemplates.xtend @@ -0,0 +1,47 @@ +package org.eclipse.papyrus.cpp.codegen.xtend + +import org.eclipse.uml2.uml.Operation +import org.eclipse.uml2.uml.Classifier +import org.eclipse.papyrus.acceleo.GenUtils +import org.eclipse.papyrus.cpp.codegen.utils.CppGenUtils +import org.eclipse.uml2.uml.TemplateParameterSubstitution +import org.eclipse.uml2.uml.NamedElement +import org.eclipse.uml2.uml.LiteralInteger + +/** + * @author Önder GÜRCAN (onder.gurcan@cea.fr) + */ +class CppTemplates { + + static def templateSignature(Operation operation) { + templateSignature(operation.owner as Classifier) + } + + static def templateSignature(Classifier clazz)''' + «IF (isTemplate(clazz))» + template<«FOR templateParam : GenUtils.getTemplateParameters(clazz) SEPARATOR ', '»«CppGenUtils.getTemplateTypeName(templateParam)»«ENDFOR»> + «ENDIF» + ''' + + static def templateShortSignature(Operation operation) { + templateShortSignature(operation.owner as Classifier) + } + + static def templateShortSignature(Classifier clazz)''' + «IF (isTemplate(clazz))» + <«FOR templateParam : GenUtils.getTemplateParameters(clazz) SEPARATOR ', '»«GenUtils.getTemplateName(templateParam)»«ENDFOR»> + «ENDIF» + ''' + + static def isTemplate(Classifier clazz) { + GenUtils.getTemplateParameters(clazz).size() > 0 + } + + static def CppTemplateBindingParameter(TemplateParameterSubstitution tps) { + if (tps.actual instanceof LiteralInteger) { + (tps.actual as LiteralInteger).value + } else { + (tps.actual as NamedElement).name + } + } +} \ No newline at end of file -- cgit v1.2.3