summaryrefslogtreecommitdiffstats
path: root/src/uml/qumlconstraint.cpp
diff options
context:
space:
mode:
authorSandro S. Andrade <sandroandrade@kde.org>2013-09-04 16:38:54 -0300
committerSandro S. Andrade <sandroandrade@kde.org>2013-09-04 21:38:16 +0200
commit61f9748061ef752b5617ec244a8f451700dc18f4 (patch)
tree66dd61031a506844e0dfd8ad52f598b3989121d4 /src/uml/qumlconstraint.cpp
parentdf7fb2f660e151d0c5fbe62f90be9437ed190087 (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/qumlconstraint.cpp')
-rw-r--r--src/uml/qumlconstraint.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/uml/qumlconstraint.cpp b/src/uml/qumlconstraint.cpp
index 05c2de72..dc424c22 100644
--- a/src/uml/qumlconstraint.cpp
+++ b/src/uml/qumlconstraint.cpp
@@ -42,10 +42,16 @@
#include "private/qumlconstraintobject_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/QUmlValueSpecification>
-
/*!
\class QUmlConstraint
@@ -69,13 +75,36 @@ QUmlConstraint::~QUmlConstraint()
}
}
+QModelingObject *QUmlConstraint::clone() const
+{
+ QUmlConstraint *c = new QUmlConstraint;
+ foreach (QUmlComment *element, ownedComment())
+ c->addOwnedComment(dynamic_cast<QUmlComment *>(element->clone()));
+ if (owningTemplateParameter())
+ c->setOwningTemplateParameter(dynamic_cast<QUmlTemplateParameter *>(owningTemplateParameter()->clone()));
+ if (templateParameter())
+ c->setTemplateParameter(dynamic_cast<QUmlTemplateParameter *>(templateParameter()->clone()));
+ foreach (QUmlDependency *element, clientDependency())
+ c->addClientDependency(dynamic_cast<QUmlDependency *>(element->clone()));
+ c->setName(name());
+ if (nameExpression())
+ c->setNameExpression(dynamic_cast<QUmlStringExpression *>(nameExpression()->clone()));
+ c->setVisibility(visibility());
+ foreach (QUmlElement *element, constrainedElement())
+ c->addConstrainedElement(dynamic_cast<QUmlElement *>(element->clone()));
+ if (context())
+ c->setContext(dynamic_cast<QUmlNamespace *>(context()->clone()));
+ if (specification())
+ c->setSpecification(dynamic_cast<QUmlValueSpecification *>(specification()->clone()));
+ return c;
+}
+
// OWNED ATTRIBUTES
/*!
The ordered set of Elements referenced by this Constraint.
*/
-const QList<QUmlElement *>
-QUmlConstraint::constrainedElement() const
+const QList<QUmlElement *> QUmlConstraint::constrainedElement() const
{
// This is a read-write association end
@@ -105,8 +134,7 @@ void QUmlConstraint::removeConstrainedElement(QUmlElement *constrainedElement)
/*!
Specifies the namespace that owns the NamedElement.
*/
-QUmlNamespace *
-QUmlConstraint::context() const
+QUmlNamespace *QUmlConstraint::context() const
{
// This is a read-write association end
@@ -132,8 +160,7 @@ void QUmlConstraint::setContext(QUmlNamespace *context)
/*!
A condition that must be true when evaluated in order for the constraint to be satisfied.
*/
-QUmlValueSpecification *
-QUmlConstraint::specification() const
+QUmlValueSpecification *QUmlConstraint::specification() const
{
// This is a read-write association end