[% USE xmi = XML.XPath("$xmi") -%] [% SET class = xmi.findnodes("//packagedElement[@xmi:type='uml:Class' and @name='$className']") -%] [% SET uml2qt_type = { "Boolean" = "bool", "Integer" = "int", "UnlimitedNatural" = "int", "String" = "QString", "Real" = "double" }; -%] [%- MACRO QT_TYPE(namespace, attribute, external) BLOCK -%] [%- SET multiplicity = attribute.findnodes("upperValue").findvalue("@value") -%] [%- SET isUnique = attribute.findvalue("@isUnique") -%] [%- SET isOrdered = attribute.findvalue("@isOrdered") -%] [%- IF multiplicity == "*" %][% IF (isUnique == "true" || isUnique == "") && (isOrdered == "false" || isOrdered == "") %]QSet[% ELSE %]QList[% END %]<[% END -%] [%- attributeType = attribute.findvalue("@type") -%] [%- IF attributeType != "" -%] [%- IF xmi.findnodes("//packagedElement[@xmi:type='uml:Enumeration' and @name='$attributeType']").findvalue("@name") != "" -%] Qt${namespace}::${attributeType} [%- ELSE -%] [% IF external == "false" %]QObject *[% ELSE %]Q${namespace}${attributeType} *[% END %] [%- END -%] [%- ELSE -%] ${uml2qt_type.item(attribute.findnodes("type").findvalue("@href").split("#").last)}[%- IF multiplicity != "*" %] [% END -%] [%- END -%] [%- IF multiplicity == "*" %]> [% END -%] [%- END -%] [% SET uml2qt_attribute = { "namespace" = "namespace_", "interface" = "interface_", "class" = "class_", "default" = "default_", "template" = "template_", "slot" = "slot_", "delete" = "delete_" }; -%] [%- MACRO QT_ATTRIBUTE(attribute) BLOCK -%] [%- SET attributeName = attribute.findvalue("@name") -%] [%- IF uml2qt_attribute.item(attributeName) != "" -%] ${uml2qt_attribute.item(attributeName)} [%- ELSE -%] ${attributeName} [%- END -%] [%- END -%] [%- MACRO POPULATE_REDEFINED_PROPERTIES(class, visitedClasses, redefinedProperties) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- POPULATE_REDEFINED_PROPERTIES(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] [%- END -%] [%- END -%] [%- FOREACH attribute IN class.findnodes("ownedAttribute[@redefinedProperty]") -%] [%- FOREACH redefinedProperty IN attribute.findvalue("@redefinedProperty").split(' ') -%] [%- redefinedProperties.push("${redefinedProperty}") -%] [%- END -%] [%- END -%] [%- END -%] [%- MACRO POPULATE_REDEFINED_OPERATIONS(class, visitedClasses, redefinedOperations) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- POPULATE_REDEFINED_OPERATIONS(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedOperations) -%] [%- END -%] [%- END -%] [%- FOREACH operation IN class.findnodes("ownedOperation[@redefinedOperation]") -%] [%- FOREACH redefinedOperation IN operation.findvalue("@redefinedOperation").split(' ') -%] [%- redefinedOperations.push("${redefinedOperation}") -%] [%- END -%] [%- END -%] [%- END -%] [%- MACRO GENERATE_QPROPERTIES(class, visitedClasses, redefinedProperties) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_QPROPERTIES(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] [%- END -%] [%- END -%] [%- SET found = "false" -%] [%- FOREACH attribute IN class.findnodes("ownedAttribute") -%] [%- SET className = class.findvalue("@name") -%] [%- IF found == "false" %] // Properties [${className}] [%- SET found = "true" -%] [%- END -%] [%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%] [%- SET qtType = QT_TYPE(namespace, attribute, "false") %] Q_PROPERTY(${qtType.trim} ${qtAttribute} READ ${qtAttribute}) [%- END %] [%- END -%] [%- MACRO GENERATE_ATTRIBUTES(class, visitedClasses, redefinedProperties) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_ATTRIBUTES(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] [%- END -%] [%- END -%] [%- SET attributes = class.findnodes("ownedAttribute") -%] [%- SET found = "false" -%] [%- FOREACH attribute IN attributes -%] [%- SET className = class.findvalue("@name") -%] [%- IF found == "false" %] // Owned attributes [${className}] [%- SET found = "true" -%] [%- END -%] [%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%] [%- SET qtType = QT_TYPE(namespace, attribute, "false") -%] [%- IF qtType.match("QList|QSet") %] Q_INVOKABLE const ${qtType}${qtAttribute}() const; [%- ELSIF qtType.match('\*$') %] Q_INVOKABLE ${qtType}${qtAttribute}() const; [%- ELSE %] Q_INVOKABLE ${qtType}${qtAttribute}() const; [%- END %] [%- IF loop.last %] [%- END %] [%- END -%] [%- END -%] [%- MACRO GENERATE_OPERATIONS(class, visitedClasses, redefinedOperations) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_OPERATIONS(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedOperations) -%] [%- END -%] [%- END -%] [%- SET found = "false" -%] [%- FOREACH operation = class.findnodes("ownedOperation[@name != ../ownedAttribute[@isDerived='true']/@name]") -%] [%- SET className = class.findvalue("@name") -%] [%- IF found == "false" %] // Operations [${className}] [%- SET found = "true" -%] [%- END %] [%- SET operationName = operation.findvalue("@name") -%] [%- NEXT IF redefinedOperations.grep("^${className}-${operationName}$").size > 0 -%] Q_INVOKABLE [% QT_TYPE(namespace, operation.findnodes("ownedParameter[@direction='return']"), "false") -%] ${operationName}( [%- FOREACH parameter = operation.findnodes("ownedParameter[@direction!='return']") -%] [%- QT_TYPE(namespace, parameter, "false") -%] ${parameter.findvalue("@name")} [%- IF !loop.last %], [% END -%] [%- END -%] )[% IF operation.findvalue("@isQuery") == "true" %] const[% END %]; [%- END %] [%- END -%] [%- MACRO GENERATE_SLOTS(class, visitedClasses, redefinedProperties) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_SLOTS(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] [%- END -%] [%- END -%] [%- SET found = "false" -%] [%- FOREACH attribute IN class.findnodes("ownedAttribute") -%] [%- SET className = class.findvalue("@name") -%] [%- IF found == "false" %] // Slots for owned attributes [${className}] [%- SET found = "true" -%] [%- END %] [%- SET qtAttribute = QT_ATTRIBUTE(attribute) %] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%] [%- SET qtType = QT_TYPE(namespace, attribute, "false") -%] [%- SET readOnly = attribute.findvalue("@isReadOnly") -%] [%- SET attributeName = attribute.findvalue("@name").ucfirst -%] [%- IF attribute.findnodes("upperValue").findvalue("@value") == "*" -%] [%- IF qtType.remove("QSet<").remove("QList<").match('\*') %] void [%- IF readOnly == "true" -%]Q_DECL_HIDDEN [% END %]add${attributeName}([% qtType.remove("QSet<").remove("QList<").replace(">", "").replace('\* $', '*') %]${qtAttribute}); void [%- IF readOnly == "true" -%]Q_DECL_HIDDEN [% END %]remove${attributeName}([% qtType.remove("QSet<").remove("QList<").replace(">", "").replace('\* $', '*') %]${qtAttribute}); [%- ELSE %] void [%- IF readOnly == "true" -%]Q_DECL_HIDDEN [% END %]add${attributeName}(${qtType.remove("QSet<").remove("QList<").replace(">", "")}${qtAttribute}); void [%- IF readOnly == "true" -%]Q_DECL_HIDDEN [% END %]remove${attributeName}(${qtType.remove("QSet<").remove("QList<").replace(">", "")}${qtAttribute}); [%- END -%] [%- ELSE -%] [%- IF qtType.match('QList|QSet') %] void [%- IF readOnly == "true" -%]Q_DECL_HIDDEN [% END %]set${attributeName}(${qtType}${qtAttribute}); [%- ELSIF qtType.match('\*$') %] void [%- IF readOnly == "true" -%]Q_DECL_HIDDEN [% END %]set${attributeName}(${qtType}${qtAttribute} = 0); [%- ELSE %] void [%- IF readOnly == "true" -%]Q_DECL_HIDDEN [% END %]set${attributeName.remove("^Is")}(${qtType}${qtAttribute}); [%- END -%] [%- END -%] [%- END %] [%- END -%] [%- MACRO GENERATE_CPP_ATTRIBUTES(originalClassName, class, visitedClasses, redefinedProperties) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_CPP_ATTRIBUTES(originalClassName, xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] [%- END -%] [%- END -%] [%- SET found = "false" -%] [% FOREACH attribute = class.findnodes("ownedAttribute") -%] [%- SET className = class.findvalue("@name") -%] [%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%] [%- IF found == "false" -%] // OWNED ATTRIBUTES [${className}] [%- SET found = "true" -%] [% END -%] [%- SET qtType = QT_TYPE(namespace, attribute, "false") -%] [%- SET originalQtType = QT_TYPE(namespace, attribute, "true") -%] [%- SET derived = attribute.findvalue("@isDerived") -%] [%- SET derivedUnion = attribute.findvalue("@isDerivedUnion") %] [% IF qtType.match("QList|QSet") %]const [% END %]${qtType}Q${namespace}${originalClassName}Object::${qtAttribute}() const { [%- IF qtType.match("QList|QSet") %] ${qtType}[% IF qtType.match("QList") %]list[% ELSE %]set[% END %]; foreach (Q${originalQtType.remove("QList<").remove("QSet<").remove(">").trim.remove("^Q")}element, qmodelingobjectproperty_cast(this)->${qtAttribute}()) [% IF qtType.match("QList") %]list[% ELSE %]set[% END %].[% IF qtType.match("QList") %]append[% ELSE %]insert[% END %](element->asQObject()); return [% IF qtType.match("QList") %]list[% ELSE %]set[% END %]; [%- ELSIF qtType.match('\*$') %] return qmodelingobjectproperty_cast(this)->${qtAttribute}()->asQObject(); [%- ELSE %] return qmodelingobjectproperty_cast(this)->${qtAttribute}(); [%- END %] } [%- IF loop.last %] [% END -%] [%- END -%] [%- END -%] [%- MACRO GENERATE_CPP_OPERATIONS(originalClassName, class, visitedClasses, redefinedOperations) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_CPP_OPERATIONS(originalClassName, xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedOperations) -%] [%- END -%] [%- END -%] [%- SET found = "false" -%] [% FOREACH operation = class.findnodes("ownedOperation[@name != ../ownedAttribute[@isDerived='true']/@name]") -%] [%- SET className = class.findvalue("@name") -%] [%- IF found == "false" -%] // OPERATIONS [${className}] [%- SET found = "true" -%] [% END -%] [% SET operationName = operation.findvalue("@name") -%] [%- NEXT IF redefinedOperations.grep("^${className}-${operationName}$").size > 0 -%] [%- SET return = QT_TYPE(namespace, operation.findnodes("ownedParameter[@direction='return']"), "false") %] [%- SET originalReturn = QT_TYPE(namespace, operation.findnodes("ownedParameter[@direction='return']"), "true") %] [% return -%] Q${namespace}${originalClassName}Object::${operationName}( [%- FOREACH parameter = operation.findnodes("ownedParameter[@direction!='return']") -%] [%- QT_TYPE(namespace, parameter, "false") -%] ${parameter.findvalue("@name")} [%- IF !loop.last %], [% END -%] [%- END -%] )[% IF operation.findvalue("@isQuery") == "true" %] const[% END %] { [%- FOREACH parameter = operation.findnodes("ownedParameter[@direction!='return']") -%] [%- IF QT_TYPE(namespace, parameter, "true").match("QList|QSet") %] ${QT_TYPE(namespace, parameter, "true")}${parameter.findvalue("@name")}Converted; foreach (QObject *object, ${parameter.findvalue("@name")}) ${parameter.findvalue("@name")}Converted.[% IF QT_TYPE(namespace, parameter, "true").match("QList") %]append[% ELSE %]insert[% END %](qmodelingobjectproperty_cast<${QT_TYPE(namespace, parameter, "true").remove("QList<").remove("QSet<").remove(">").trim}>(object)); [%- END -%] [%- END -%] [%- IF return.match("QList|QSet") && return.match('\*') %] ${return}[% IF qtType.match("QList") %]list[% ELSE %]set[% END %]; foreach (${originalReturn.remove("QList<").remove("QSet<").remove(">").trim}element, qmodelingobjectproperty_cast(this)->${operationName}( [%- FOREACH parameter = operation.findnodes("ownedParameter[@direction!='return']") -%] [%- qtType = QT_TYPE(namespace, parameter, "true") -%] [%- IF qtType.match('QList|QSet') -%] ${parameter.findvalue("@name")}Converted [%- ELSIF qtType.match('\*$') -%] qmodelingobjectproperty_cast<${qtType.remove("QList<").remove("QSet<").remove(">")}>(${parameter.findvalue("@name")}) [%- ELSE -%] ${parameter.findvalue("@name")} [%- END -%] [%- IF !loop.last %], [% END -%] [%- END -%])) [% IF qtType.match("QList") %]list[% ELSE %]set[% END %].[% IF return.match("QList") %]append[% ELSE %]insert[% END %](element->asQObject()); return [% IF qtType.match("QList") %]list[% ELSE %]set[% END %]; [%- ELSIF !return.match("QList|QSet") && return.match('\*$') %] return qmodelingobjectproperty_cast(this)->${operationName}( [%- FOREACH parameter = operation.findnodes("ownedParameter[@direction!='return']") -%] [%- qtType = QT_TYPE(namespace, parameter, "true") -%] [%- IF qtType.match('\*$') -%] qmodelingobjectproperty_cast<${qtType.remove("QList<").remove("QSet<").remove(">")}>(${parameter.findvalue("@name")}) [%- ELSE -%] ${parameter.findvalue("@name")} [%- END -%] [%- IF !loop.last %], [% END -%] [%- END -%])->asQObject(); [%- ELSE %] return qmodelingobjectproperty_cast(this)->${operationName}( [%- FOREACH parameter = operation.findnodes("ownedParameter[@direction!='return']") -%] [%- qtType = QT_TYPE(namespace, parameter, "true") -%] [%- IF qtType.match('\*$') -%] qmodelingobjectproperty_cast<${qtType.remove("QList<").remove("QSet<").remove(">")}>(${parameter.findvalue("@name")}) [%- ELSE -%] ${parameter.findvalue("@name")} [%- END -%] [%- IF !loop.last %], [% END -%] [%- END -%]); [%- END %] } [%- IF loop.last %] [% END -%] [%- END -%] [%- END -%] [%- MACRO GENERATE_CPP_SLOTS(originalClassName, class, visitedClasses, redefinedProperties) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_CPP_SLOTS(originalClassName, xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] [%- END -%] [%- END -%] [%- SET found = "false" -%] [% FOREACH attribute = class.findnodes("ownedAttribute") -%] [%- SET className = class.findvalue("@name") -%] [%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%] [%- IF found == "false" -%] // SLOTS FOR OWNED ATTRIBUTES [${className}] [%- SET found = "true" -%] [% END -%] [%- SET attributeName = attribute.findvalue("@name").ucfirst -%] [%- SET qtType = QT_TYPE(namespace, attribute, "false") -%] [%- SET originalQtType = QT_TYPE(namespace, attribute, "true") -%] [%- IF attribute.findnodes("upperValue").findvalue("@value") == "*" -%] [%- IF qtType.remove("QSet<").remove("QList<").match('\*') %] void Q${namespace}${originalClassName}Object::add${attributeName}([% qtType.remove("QSet<").remove("QList<").replace(">", "").replace('\* $', '*') %]${qtAttribute}) [%- ELSE %] void Q${namespace}${originalClassName}Object::add${attributeName}(${originalQtType.remove("QSet<").remove("QList<").replace(">", "")} ${qtAttribute}) [%- END %] { [%- IF qtType.remove("QSet<").remove("QList<").match('\*') %] qmodelingobjectproperty_cast(this)->add${attributeName}(qmodelingobjectproperty_cast<${originalQtType.remove("QSet<").remove("QList<").replace(">", "").replace('\* $', '*')}>(${qtAttribute})); [%- ELSE %] qmodelingobjectproperty_cast(this)->add${attributeName}(${qtAttribute}); [%- END %] } [%- IF qtType.remove("QSet<").remove("QList<").match('\*') %] void Q${namespace}${originalClassName}Object::remove${attributeName}([% qtType.remove("QSet<").remove("QList<").replace(">", "").replace('\* $', '*') %]${qtAttribute}) [%- ELSE %] void Q${namespace}${originalClassName}Object::remove${attributeName}(${originalQtType.remove("QSet<").remove("QList<").replace(">", "")} ${qtAttribute}) [%- END %] { [%- IF qtType.remove("QSet<").remove("QList<").match('\*') %] qmodelingobjectproperty_cast(this)->remove${attributeName}(qmodelingobjectproperty_cast<${originalQtType.remove("QSet<").remove("QList<").replace(">", "").replace('\* $', '*')}>(${qtAttribute})); [%- ELSE %] qmodelingobjectproperty_cast(this)->remove${attributeName}(${qtAttribute}); [%- END %] } [%- ELSIF qtType.match('\*$') %] void Q${namespace}${originalClassName}Object::set${attributeName}(${qtType}${qtAttribute}) { qmodelingobjectproperty_cast(this)->set${attributeName}(qmodelingobjectproperty_cast<${originalQtType}>(${qtAttribute})); } [%- ELSE %] void Q${namespace}${originalClassName}Object::set${attributeName.remove("^Is")}(${qtType}${qtAttribute}) { qmodelingobjectproperty_cast(this)->set${attributeName.remove("^Is")}(${qtAttribute}); } [% END -%] [%- IF loop.last %] [% END -%] [%- END %] [%- END -%] [%- MACRO GENERATE_FWD_DECLARATIONS(class, visitedClasses, forwards, useNamespace) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_FWD_DECLARATIONS(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, forwards, useNamespace) -%] [%- END -%] [%- END -%] [%- 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") != "" -%] [%- useNamespace.push("true") -%] [%- ELSE -%] [%- IF forwardName != className -%][%- forwards.push("Q${namespace}${forwardName}") -%][%- END -%] [%- END -%] [%- END -%] [%- END -%] [%- MACRO GENERATE_CLONE(class, visitedClasses, redefinedProperties) BLOCK -%] [%- FOREACH parent IN class.findnodes("generalization") -%] [%- SET parentName = parent.findvalue("@general") -%] [%- IF visitedClasses.grep("^${parentName}$").size == 0 -%] [%- visitedClasses.push("${parentName}") -%] [%- GENERATE_CLONE(xmi.findnodes("//packagedElement[@xmi:type=\"uml:Class\" and @name=\"${parentName}\"]"), visitedClasses, redefinedProperties) -%] [%- END -%] [%- END -%] [%- FOREACH attribute = class.findnodes("ownedAttribute[@isDerived=\"false\" or not(@isDerived)]") -%] [%- SET qtType = QT_TYPE(namespace, attribute) -%] [%- SET attributeName = attribute.findvalue("@name") -%] [%- SET className = class.findvalue("@name") -%] [%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%] [%- IF qtType.match("QList|QSet") && qtType.match('\*') %] foreach (${qtType.remove("QList<").remove("QSet<").remove(">").replace('\* ', '*')}element, ${attributeName}()) c->add${attributeName.ucfirst}(dynamic_cast<${qtType.remove("QList<").remove("QSet<").remove(">").replace('\* ', '*')}>(element->clone())); [%- ELSIF qtType.match('\*') %] if (${attributeName}()) c->set${attributeName.ucfirst}(dynamic_cast<${qtType.remove("QList<").remove("QSet<").remove(">").replace('\* ', '*')}>(${attributeName}()->clone())); [%- ELSE %] c->set${attributeName.ucfirst}(${attributeName}()); [%- END -%] [%- END %] [%- END -%]