diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-11-17 21:22:01 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-11-18 01:18:10 +0100 |
commit | c89fd26273ea7490383aefee9c86027be02324b4 (patch) | |
tree | ab8a4ead48a3a7b0d58dc453b788b558629f7eb9 /scripts/templates | |
parent | 90d49b82c2f6643cc7e3552471ee8e2fed40c412 (diff) |
Fix update of redefined properties. Implement ownedPort()
Change-Id: Icef7dfc42e259d62be5b2f5894c4623dae82730c
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates')
-rw-r--r-- | scripts/templates/qclass.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp index f9241b0f..b8377d3d 100644 --- a/scripts/templates/qclass.cpp +++ b/scripts/templates/qclass.cpp @@ -215,6 +215,22 @@ void Q${namespace}${className}::add${attributeName}(${qtType.remove("QSet<").rem [%- END -%] [%- END %] [%- END %] + [%- found = "false" -%] + [%- FOREACH redefinedPropertyName = attribute.findvalue("@redefinedProperty").split(" ") -%] + [%- SET redefinedProperty = xmi.findnodes("//packagedElement[(@xmi:type=\"uml:Class\" or @xmi:type=\"uml:Stereotype\") and @name=\"${redefinedPropertyName.split('-').0}\"]/ownedAttribute[@name=\"${redefinedPropertyName.split('-').1}\"]") -%] + [%- IF redefinedProperty.findvalue("@name") != "" -%] + [%- IF found == "false" %] + + // Adjust redefined properties + [%- found = "true" -%] + [%- END -%] + [%- IF redefinedProperty.findvalue("upperValue/@value") == "*" %] + Q${namespace}${redefinedPropertyName.split('-').0}::add${redefinedPropertyName.split('-').1.ucfirst}(${qtAttribute}); + [%- ELSE %] + Q${namespace}${redefinedPropertyName.split('-').0}::set${redefinedPropertyName.split('-').1.remove('^is').ucfirst}(${qtAttribute}); + [%- END -%] + [%- END %] + [%- END %] [%- IF association != "" -%] [%- found = "false" -%] [%- FOREACH memberEnd = xmi.findvalue("//packagedElement[(@xmi:type=\"uml:Association\" or @xmi:type=\"uml:Extension\") and @name=\"${association}\"]/@memberEnd").split(' ') -%] @@ -273,6 +289,22 @@ void Q${namespace}${className}::remove${attributeName}(${qtType.remove("QSet<"). [%- END -%] [%- END %] [%- END %] + [%- found = "false" -%] + [%- FOREACH redefinedPropertyName = attribute.findvalue("@redefinedProperty").split(" ") -%] + [%- SET redefinedProperty = xmi.findnodes("//packagedElement[(@xmi:type=\"uml:Class\" or @xmi:type=\"uml:Stereotype\") and @name=\"${redefinedPropertyName.split('-').0}\"]/ownedAttribute[@name=\"${redefinedPropertyName.split('-').1}\"]") -%] + [%- IF redefinedProperty.findvalue("@name") != "" -%] + [%- IF found == "false" %] + + // Adjust redefined properties + [%- found = "true" -%] + [%- END -%] + [%- IF redefinedProperty.findvalue("upperValue/@value") == "*" %] + Q${namespace}${redefinedPropertyName.split('-').0}::remove${redefinedPropertyName.split('-').1.ucfirst}(${qtAttribute}); + [%- ELSE %] + Q${namespace}${redefinedPropertyName.split('-').0}::set${redefinedPropertyName.split('-').1.remove('^is').ucfirst}(${qtAttribute}); + [%- END -%] + [%- END %] + [%- END %] [%- IF association != "" -%] [%- found = "false" -%] [%- FOREACH memberEnd = xmi.findvalue("//packagedElement[(@xmi:type=\"uml:Association\" or @xmi:type=\"uml:Extension\") and @name=\"${association}\"]/@memberEnd").split(' ') -%] @@ -325,6 +357,21 @@ void Q${namespace}${className}::set${attributeName.remove("^Is")}([% IF !qtType. [%- END %] [%- IF found == "true" %] [% END %] + [%- found = "false" -%] + [%- FOREACH redefinedPropertyName = attribute.findvalue("@redefinedProperty").split(" ") -%] + [%- SET redefinedProperty = xmi.findnodes("//packagedElement[(@xmi:type=\"uml:Class\" or @xmi:type=\"uml:Stereotype\") and @name=\"${redefinedPropertyName.split('-').0}\"]/ownedAttribute[@name=\"${redefinedPropertyName.split('-').1}\"]") -%] + [%- IF redefinedProperty.findvalue("@name") != "" -%] + [%- IF redefinedProperty.findvalue("upperValue/@value") == "*" %] + [%- IF found == "false" %] + // Adjust redefined properties + [%- found = "true" -%] + [%- END -%] + [% IF derived == "true" && (derivedUnion == "false" || derivedUnion == "") %]// [% END %]Q${namespace}${redefinedPropertyName.split('-').0}::remove${redefinedPropertyName.split('-').1.ucfirst}([%- IF derived == "true" && (derivedUnion == "false" || derivedUnion == "") %]/* <derived-code> */[% ELSE %]_${PLURALFORM(qtAttribute, attribute)}[% END %]); + [%- END -%] + [%- END %] + [%- END %] +[%- IF found == "true" %] +[% END %] [%- IF derived == "true" && (derivedUnion == "false" || derivedUnion == "") %] // <derived-code> [%- ELSE %] @@ -358,6 +405,24 @@ void Q${namespace}${className}::set${attributeName.remove("^Is")}([% IF !qtType. [%- END -%] [%- END %] [%- END %] + [%- found = "false" -%] + [%- FOREACH redefinedPropertyName = attribute.findvalue("@redefinedProperty").split(" ") -%] + [%- SET redefinedProperty = xmi.findnodes("//packagedElement[(@xmi:type=\"uml:Class\" or @xmi:type=\"uml:Stereotype\") and @name=\"${redefinedPropertyName.split('-').0}\"]/ownedAttribute[@name=\"${redefinedPropertyName.split('-').1}\"]") -%] + [%- IF redefinedProperty.findvalue("@name") != "" -%] + [%- IF found == "false" %] + + // Adjust redefined properties + [%- found = "true" -%] + [%- END -%] + [%- IF redefinedProperty.findvalue("upperValue/@value") == "*" %] + if (${qtAttribute}) { + Q${namespace}${redefinedPropertyName.split('-').0}::add${redefinedPropertyName.split('-').1.ucfirst}(${qtAttribute}); + } + [%- ELSE %] + Q${namespace}${redefinedPropertyName.split('-').0}::set${redefinedPropertyName.split('-').1.remove('^is').ucfirst}(${qtAttribute}); + [%- END -%] + [%- END %] + [%- END %] } } |