Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'extraplugins/cpp-codegen/org.eclipse.papyrus.cpp.codegen/templates/util/property/CppStaticAttributeImplementation.util.jet')
-rw-r--r--extraplugins/cpp-codegen/org.eclipse.papyrus.cpp.codegen/templates/util/property/CppStaticAttributeImplementation.util.jet56
1 files changed, 56 insertions, 0 deletions
diff --git a/extraplugins/cpp-codegen/org.eclipse.papyrus.cpp.codegen/templates/util/property/CppStaticAttributeImplementation.util.jet b/extraplugins/cpp-codegen/org.eclipse.papyrus.cpp.codegen/templates/util/property/CppStaticAttributeImplementation.util.jet
new file mode 100644
index 00000000000..aafed1f9c64
--- /dev/null
+++ b/extraplugins/cpp-codegen/org.eclipse.papyrus.cpp.codegen/templates/util/property/CppStaticAttributeImplementation.util.jet
@@ -0,0 +1,56 @@
+<%@ jet package = "org.eclipse.papyrus.cpp.codegen.jet.util"
+ skeleton = "../../generator.skeleton"
+ imports = "org.eclipse.uml2.uml.* Cpp.* org.eclipse.papyrus.cpp.codegen.utils.*"
+ class = "CppStaticAttributeImplementation"
+%>
+<%
+//////////////////////////////////////////////////////////////////////////////////////////
+// Java preparation
+//////////////////////////////////////////////////////////////////////////////////////////
+
+ // Retrieve the property
+ Property currentAttribute = (Property) argument;
+
+ String attributeName = currentAttribute.getName();
+ String className = GenUtils.qualifiedName (currentAttribute.getClass_());
+ String typeName = "";
+ String suffix = "";
+ String multiple = "";
+ String isAgg = ""; // attribute is an aggregation or association
+
+
+ if (currentAttribute.getType() == null) {
+ typeName = "undefined"+" ";
+ } else {
+ typeName = GenUtils.qualifiedName (currentAttribute.getType()) + " ";
+ }
+
+ // Multiple
+ // if (currentAttribute.isMultiple()) {
+ // multiple = "*";
+ // }
+
+ // If attribute is aggregation then generate a pointer
+ if (GenUtils.isAggregation(currentAttribute)) {
+ // attributeName = "(*"+attributeName+")"; // this produce a pointer on a tab
+ isAgg = "*"; // this produce a tab of pointers
+ }
+
+ Modifier modifier = new Modifier(currentAttribute);
+
+ // Initial value
+ if (currentAttribute.getDefaultValue() != null) {
+ // via UML
+ suffix = " = " + currentAttribute.getDefaultValue().stringValue();
+ }
+ else {
+ CppDefault cppDefault = GenUtils.getApplication(currentAttribute, CppDefault.class);
+ if (cppDefault != null) {
+ suffix = " = " + cppDefault.getValue();
+ }
+ }
+
+//////////////////////////////////////////////////////////////////////////////////////////
+// The following part contains the template
+//////////////////////////////////////////////////////////////////////////////////////////%>
+<%= typeName %><%= multiple %><%= modifier.ptr %><%= isAgg %><%= modifier.ref %><%= className %>::<%= attributeName %><%= modifier.array %><%= suffix %>;

Back to the top