summaryrefslogtreecommitdiffstats
path: root/scripts/templates
diff options
context:
space:
mode:
authorSandro S. Andrade <sandroandrade@kde.org>2013-11-17 14:06:55 -0300
committerSandro S. Andrade <sandroandrade@kde.org>2013-11-17 18:02:50 +0100
commit90d49b82c2f6643cc7e3552471ee8e2fed40c412 (patch)
tree9979ca09d6fa6c5b7871d96e9b3acf2ca9c631b8 /scripts/templates
parentdaca62af0f1be83f89368deea4dc9e6877d50420 (diff)
Add concrete syntax for generalization and multiplicities
Change-Id: Ia64fee0ac964b5e969801b81898e93d7b0a9bb83 Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates')
-rw-r--r--scripts/templates/common.tmpl6
-rw-r--r--scripts/templates/qclass.cpp9
2 files changed, 4 insertions, 11 deletions
diff --git a/scripts/templates/common.tmpl b/scripts/templates/common.tmpl
index dd18559b..17b302e3 100644
--- a/scripts/templates/common.tmpl
+++ b/scripts/templates/common.tmpl
@@ -3,7 +3,7 @@
[% SET uml2qt_type = {
"Boolean" = "bool",
"Integer" = "int",
- "UnlimitedNatural" = "int",
+ "UnlimitedNatural" = "QString",
"String" = "QString",
"Real" = "double"
};
@@ -475,7 +475,7 @@ void Q${namespace}${originalClassName}Object::unset${qtAttribute.remove("^is").u
[%- IF defaultValue != "" -%]
set${qtAttribute.remove("^is").ucfirst}(${defaultValue});
[%- ELSE -%]
- set${qtAttribute.remove("^is").ucfirst}(0);
+ set${qtAttribute.remove("^is").ucfirst}(QStringLiteral(""));
[%- END -%]
[%- ELSIF type.match('\*$') -%]
set${qtAttribute.remove("^is").ucfirst}(0);
@@ -623,4 +623,4 @@ void Q${namespace}${originalClassName}Object::unset${qtAttribute.remove("^is").u
[%- SET attributeName = attribute.findvalue("@name").ucfirst %]
void ${PLURALFORM(qtAttribute, attribute).remove('_$')}Changed(${qtType}${PLURALFORM(qtAttribute, attribute)});
[%- END %]
-[%- END -%] \ No newline at end of file
+[%- END -%]
diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp
index 080aca09..f9241b0f 100644
--- a/scripts/templates/qclass.cpp
+++ b/scripts/templates/qclass.cpp
@@ -90,7 +90,7 @@ Q${namespace}${className}::Q${namespace}${className}([%- IF class.findvalue("@is
[%- SET defaultType = attribute.findvalue("defaultValue/@xmi:type") -%]
[%- SET type = QT_TYPE(namespace, attribute) -%]
[%- SET originalType = attribute.findvalue("@type") -%]
- [%- IF defaultType == "uml:LiteralBoolean" || defaultType == "uml:InstanceValue" || defaultType == "uml:LiteralInteger" || defaultType == "uml:LiteralUnlimitedNatural" || type.match('\*$') -%]
+ [%- IF defaultType == "uml:LiteralBoolean" || defaultType == "uml:InstanceValue" || defaultType == "uml:LiteralInteger" || type.match('\*$') -%]
[%- IF found == "false" %] :
[% SET found = "true" -%]
[%- ELSE %],
@@ -112,13 +112,6 @@ Q${namespace}${className}::Q${namespace}${className}([%- IF class.findvalue("@is
[%- ELSE -%]
_[% QT_ATTRIBUTE(attribute) %](0)
[%- END -%]
- [%- ELSIF defaultType == "uml:LiteralUnlimitedNatural" -%]
- [%- SET defaultValue = attribute.findvalue("defaultValue/@value") -%]
- [%- IF defaultValue != "" -%]
- _[% QT_ATTRIBUTE(attribute) %](${defaultValue})
- [%- ELSE -%]
- _[% QT_ATTRIBUTE(attribute) %](0)
- [%- END -%]
[%- ELSIF type.match('\*$') -%]
_[% QT_ATTRIBUTE(attribute) %](0)
[%- END -%]