diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-09-04 16:38:54 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-09-04 21:38:16 +0200 |
commit | 61f9748061ef752b5617ec244a8f451700dc18f4 (patch) | |
tree | 66dd61031a506844e0dfd8ad52f598b3989121d4 /scripts/templates | |
parent | df7fb2f660e151d0c5fbe62f90be9437ed190087 (diff) |
Add implementation of clone() in all UML metamodel objects
Change-Id: I9bb9c90159b813ee7d7b941b9fbb1d6f426bf487
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'scripts/templates')
-rw-r--r-- | scripts/templates/common.tmpl | 2 | ||||
-rw-r--r-- | scripts/templates/qclass.cpp | 20 |
2 files changed, 9 insertions, 13 deletions
diff --git a/scripts/templates/common.tmpl b/scripts/templates/common.tmpl index 442825ee..e3a8476f 100644 --- a/scripts/templates/common.tmpl +++ b/scripts/templates/common.tmpl @@ -416,7 +416,7 @@ void Q${namespace}${originalClassName}Object::set${attributeName.remove("^Is")}( if (${attributeName}()) c->set${attributeName.ucfirst}(dynamic_cast<${qtType.remove("QList<").remove("QSet<").remove(">").replace('\* ', '*')}>(${attributeName}()->clone())); [%- ELSE %] - c->set${attributeName.ucfirst}(${attributeName}()); + c->set${attributeName.ucfirst.remove("^Is")}(${attributeName}()); [%- END -%] [%- END %] [%- END -%] diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp index 70ca0bab..b235d671 100644 --- a/scripts/templates/qclass.cpp +++ b/scripts/templates/qclass.cpp @@ -49,20 +49,16 @@ [%- SET generalization = class.findnodes("generalization") -%] [%- FOREACH superclass IN generalization -%] [%- superclasses.push("${namespace}${superclass.findvalue('@general')}") -%] -[%- END -%] +[%- END %] +[% SET useNamespace = 'false' -%] [%- forwards = [] -%] -[%- FOREACH forward = class.findnodes("ownedAttribute[@type] | ownedOperation/ownedParameter[@type]") -%] -[%- SET forwardName = forward.findvalue('@type') -%] -[%- IF xmi.findnodes("//packagedElement[@xmi:type='uml:Enumeration' and @name='$forwardName']").findvalue("@name") == "" -%] -[%- IF forwardName != className && superclasses.grep("^${namespace}${forwardName}\$").size == 0 -%][%- forwards.push("${namespace}${forwardName}") -%][%- END -%] -[%- END -%] +[%- visitedClasses = [] -%] +[%- GENERATE_FWD_DECLARATIONS(class, visitedClasses, forwards, useNamespace) -%] +[%- FOREACH forward = forwards.unique.sort %] +#include <Qt${namespace}/${forward}> +[%- IF loop.last %] +[% END -%] [%- END -%] -[%- FOREACH forward = forwards.unique.sort -%] -[%- IF loop.first %] -[% END %] -#include <Qt${namespace}/Q$${forward}> -[%- END %] - /*! \class Q${namespace}${className} |