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 /src/uml/qumltimeinterval.cpp | |
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 'src/uml/qumltimeinterval.cpp')
-rw-r--r-- | src/uml/qumltimeinterval.cpp | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/src/uml/qumltimeinterval.cpp b/src/uml/qumltimeinterval.cpp index 1f7e89ef..af568a61 100644 --- a/src/uml/qumltimeinterval.cpp +++ b/src/uml/qumltimeinterval.cpp @@ -42,8 +42,18 @@ #include "private/qumltimeintervalobject_p.h" +#include <QtUml/QUmlComment> +#include <QtUml/QUmlDependency> +#include <QtUml/QUmlElement> +#include <QtUml/QUmlNamedElement> +#include <QtUml/QUmlNamespace> +#include <QtUml/QUmlPackage> +#include <QtUml/QUmlParameterableElement> +#include <QtUml/QUmlStringExpression> +#include <QtUml/QUmlTemplateParameter> #include <QtUml/QUmlTimeExpression> - +#include <QtUml/QUmlType> +#include <QtUml/QUmlValueSpecification> /*! \class QUmlTimeInterval @@ -68,13 +78,36 @@ QUmlTimeInterval::~QUmlTimeInterval() } } +QModelingObject *QUmlTimeInterval::clone() const +{ + QUmlTimeInterval *c = new QUmlTimeInterval; + foreach (QUmlComment *element, ownedComment()) + c->addOwnedComment(dynamic_cast<QUmlComment *>(element->clone())); + foreach (QUmlDependency *element, clientDependency()) + c->addClientDependency(dynamic_cast<QUmlDependency *>(element->clone())); + c->setName(name()); + if (nameExpression()) + c->setNameExpression(dynamic_cast<QUmlStringExpression *>(nameExpression()->clone())); + if (type()) + c->setType(dynamic_cast<QUmlType *>(type()->clone())); + if (owningTemplateParameter()) + c->setOwningTemplateParameter(dynamic_cast<QUmlTemplateParameter *>(owningTemplateParameter()->clone())); + if (templateParameter()) + c->setTemplateParameter(dynamic_cast<QUmlTemplateParameter *>(templateParameter()->clone())); + c->setVisibility(visibility()); + if (max()) + c->setMax(dynamic_cast<QUmlTimeExpression *>(max()->clone())); + if (min()) + c->setMin(dynamic_cast<QUmlTimeExpression *>(min()->clone())); + return c; +} + // OWNED ATTRIBUTES /*! Refers to the TimeExpression denoting the maximum value of the range. */ -QUmlTimeExpression * -QUmlTimeInterval::max() const +QUmlTimeExpression *QUmlTimeInterval::max() const { // This is a read-write association end @@ -95,8 +128,7 @@ void QUmlTimeInterval::setMax(QUmlTimeExpression *max) /*! Refers to the TimeExpression denoting the minimum value of the range. */ -QUmlTimeExpression * -QUmlTimeInterval::min() const +QUmlTimeExpression *QUmlTimeInterval::min() const { // This is a read-write association end |