Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl')
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl26
1 files changed, 26 insertions, 0 deletions
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
new file mode 100644
index 00000000000..0cb88942a45
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/acceleo/util/CppTemplates.mtl
@@ -0,0 +1,26 @@
+[module CppTemplates('http://www.eclipse.org/uml2/4.0.0/UML')/]
+[import org::eclipse::papyrus::cpp::codegen::utils::GenUtils/]
+
+
+[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(', ')][getType()/][/for]> [/if]
+[/template]
+
+
+[template public templateSignature(operation : Operation)]
+[owner.oclAsType(Classifier).templateSignature()/]
+[/template] \ No newline at end of file

Back to the top