diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-09-27 09:13:30 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-09-27 14:17:26 +0200 |
commit | 4d19c1223d4320b0db0261eb6d9904c5be480177 (patch) | |
tree | 8f31c788f492f8f38bd0cc1da09d305178463f4f /scripts/templates/qclass.cpp | |
parent | 61f9748061ef752b5617ec244a8f451700dc18f4 (diff) |
Add UML properties metadata
Change-Id: I7b2a4b78641c11883d3c3283a8fb53f262b891af
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates/qclass.cpp')
-rw-r--r-- | scripts/templates/qclass.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp index b235d671..52b9b4c3 100644 --- a/scripts/templates/qclass.cpp +++ b/scripts/templates/qclass.cpp @@ -120,6 +120,7 @@ Q${namespace}${className}::Q${namespace}${className}([%- IF class.findvalue("@is if (createQObject) _qObject = new Q${namespace}${className}Object(this); [%- END %] + setPropertyData(); } Q${namespace}${className}::~Q${namespace}${className}() @@ -397,3 +398,29 @@ ${parameter.findvalue("@name")} } [%- END %] +void Q${namespace}${className}::setPropertyData() +{ +[%- FOREACH attribute = class.findnodes("ownedAttribute") -%] +[%- SET association = attribute.findvalue("@association") -%] +[%- IF attribute.findvalue("@aggregation") == "composite" %] + QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::AggregationRole] = QStringLiteral("composite"); +[%- ELSE %] + QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::AggregationRole] = QStringLiteral("none"); +[%- END -%] + QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::IsDerivedUnionRole] = [% IF attribute.findvalue("@isDerivedUnion") == "true" %]true[% ELSE %]false[% END %]; + QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::DocumentationRole] = QStringLiteral("${attribute.findvalue("ownedComment/body/text()")}"); + QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::RedefinedPropertiesRole] = QStringLiteral("${attribute.findvalue("@redefinedProperty")}"); + QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::SubsettedPropertiesRole] = QStringLiteral("${attribute.findvalue("@subsettedProperty")}"); + QModelingObject::propertyDataHash[QStringLiteral("${attribute.findvalue("@name")}")][QtModeling::OppositeEndRole] = QStringLiteral(" +[%- IF association != "" -%] +[%- FOREACH memberEnd = xmi.findvalue("//packagedElement[@xmi:type=\"uml:Association\" and @name=\"${association}\"]/@memberEnd").split(' ') -%] +[%- NEXT IF memberEnd.split('-').0 == className -%] +[%- SET oppositeProperty = xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${memberEnd.split('-').0}\"]/ownedAttribute[@name=\"${memberEnd.split('-').1}\"]") -%] +[%- IF oppositeProperty.findvalue("@name") != "" -%]${oppositeProperty.findvalue("@xmi:id")}[%- END -%] +[%- END -%] +[%- END -%] +"); + +[%- END %] +} + |