diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-08-30 22:28:40 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-08-31 03:27:22 +0200 |
commit | 2bfe659e4d30b449747585e18eeb84bfc5d73f43 (patch) | |
tree | c79da4d15a2b7b0d9926e2ee1f1e5fc603f8212c /src/uml/qumlslot.cpp | |
parent | 6a665c447fb060422d4b55a6a2716d2f4560c0e2 (diff) |
Add new UML metamodel implementation
Missing only automatic removal/unset of deleted objects
Change-Id: I06a2754d02a627f87943bde50900760133dddc74
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'src/uml/qumlslot.cpp')
-rw-r--r-- | src/uml/qumlslot.cpp | 98 |
1 files changed, 89 insertions, 9 deletions
diff --git a/src/uml/qumlslot.cpp b/src/uml/qumlslot.cpp index 8dd8005b..6cb2164d 100644 --- a/src/uml/qumlslot.cpp +++ b/src/uml/qumlslot.cpp @@ -40,44 +40,124 @@ ****************************************************************************/ #include "qumlslot.h" +#include <QtUml/QUmlComment> +#include <QtUml/QUmlElement> #include <QtUml/QUmlInstanceSpecification> #include <QtUml/QUmlStructuralFeature> #include <QtUml/QUmlValueSpecification> QT_BEGIN_NAMESPACE +/*! + \class UmlSlot + + \inmodule QtUml + + \brief A slot specifies that an entity modeled by an instance specification has a value or values for a specific structural feature. + */ + QUmlSlot::QUmlSlot(QObject *parent) : QObject(parent) { } -// Owned attributes +// OWNED ATTRIBUTES [Element] -QUmlStructuralFeature *QUmlSlot::definingFeature() const +/*! + The Comments owned by this element. + */ +const QSet<QUmlComment *> QUmlSlot::ownedComment() const { - return reinterpret_cast<QUmlStructuralFeature *>(_definingFeature); + return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); } -void QUmlSlot::setDefiningFeature(QUmlStructuralFeature *definingFeature) +/*! + The Elements owned by this element. + */ +const QSet<QUmlElement *> QUmlSlot::ownedElement() const { - UmlSlot::setDefiningFeature(definingFeature); + return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); } -QUmlInstanceSpecification *QUmlSlot::owningInstance() const +/*! + The Element that owns this element. + */ +QUmlElement *QUmlSlot::owner() const { - return reinterpret_cast<QUmlInstanceSpecification *>(_owningInstance); + return reinterpret_cast<QUmlElement *>(_owner); } -void QUmlSlot::setOwningInstance(QUmlInstanceSpecification *owningInstance) +// OWNED ATTRIBUTES [Slot] + +/*! + The structural feature that specifies the values that may be held by the slot. + */ +QUmlStructuralFeature *QUmlSlot::definingFeature() const { - UmlSlot::setOwningInstance(owningInstance); + return reinterpret_cast<QUmlStructuralFeature *>(_definingFeature); } +/*! + The instance specification that owns this slot. + */ +QUmlInstanceSpecification *QUmlSlot::owningInstance() const +{ + return reinterpret_cast<QUmlInstanceSpecification *>(_owningInstance); +} + +/*! + The value or values corresponding to the defining feature for the owning instance specification. + */ const QList<QUmlValueSpecification *> QUmlSlot::value() const { return *(reinterpret_cast<const QList<QUmlValueSpecification *> *>(&_value)); } +// OPERATIONS [Element] + +/*! + The query allOwnedElements() gives all of the direct and indirect owned elements of an element. + */ +QSet<QUmlElement *> QUmlSlot::allOwnedElements() const +{ + QSet<QUmlElement *> r; + foreach (UmlElement *element, UmlElement::allOwnedElements()) + r.insert(reinterpret_cast<QUmlElement *>(element)); + return r; +} + +/*! + The query mustBeOwned() indicates whether elements of this type must have an owner. Subclasses of Element that do not require an owner must override this operation. + */ +bool QUmlSlot::mustBeOwned() const +{ + return UmlElement::mustBeOwned(); +} + +// SLOTS FOR OWNED ATTRIBUTES [Element] + +void QUmlSlot::addOwnedComment(UmlComment *ownedComment) +{ + UmlElement::addOwnedComment(ownedComment); +} + +void QUmlSlot::removeOwnedComment(UmlComment *ownedComment) +{ + UmlElement::removeOwnedComment(ownedComment); +} + +// SLOTS FOR OWNED ATTRIBUTES [Slot] + +void QUmlSlot::setDefiningFeature(QUmlStructuralFeature *definingFeature) +{ + UmlSlot::setDefiningFeature(definingFeature); +} + +void QUmlSlot::setOwningInstance(QUmlInstanceSpecification *owningInstance) +{ + UmlSlot::setOwningInstance(owningInstance); +} + void QUmlSlot::addValue(UmlValueSpecification *value) { UmlSlot::addValue(value); |