diff options
Diffstat (limited to 'src/uml/qumloperationtemplateparameter.cpp')
-rw-r--r-- | src/uml/qumloperationtemplateparameter.cpp | 154 |
1 files changed, 25 insertions, 129 deletions
diff --git a/src/uml/qumloperationtemplateparameter.cpp b/src/uml/qumloperationtemplateparameter.cpp index 60737ddc..6697d581 100644 --- a/src/uml/qumloperationtemplateparameter.cpp +++ b/src/uml/qumloperationtemplateparameter.cpp @@ -40,158 +40,54 @@ ****************************************************************************/ #include "qumloperationtemplateparameter.h" -#include <QtUml/QUmlComment> -#include <QtUml/QUmlElement> -#include <QtUml/QUmlOperation> -#include <QtUml/QUmlParameterableElement> -#include <QtUml/QUmlTemplateSignature> +#include "private/qumloperationtemplateparameterobject_p.h" -QT_BEGIN_NAMESPACE +#include <QtUml/QUmlOperation> /*! - \class UmlOperationTemplateParameter + \class QUmlOperationTemplateParameter \inmodule QtUml \brief An operation template parameter exposes an operation as a formal parameter for a template. */ - -QUmlOperationTemplateParameter::QUmlOperationTemplateParameter(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlOperationTemplateParameter::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlOperationTemplateParameter::ownedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); -} - -/*! - The Element that owns this element. - */ -QUmlElement *QUmlOperationTemplateParameter::owner() const -{ - return reinterpret_cast<QUmlElement *>(_owner); -} - -// OWNED ATTRIBUTES [TemplateParameter] - -/*! - The element that is the default for this formal template parameter. - */ -QUmlParameterableElement *QUmlOperationTemplateParameter::default_() const -{ - return reinterpret_cast<QUmlParameterableElement *>(_default_); -} - -/*! - The element that is owned by this template parameter for the purpose of providing a default. - */ -QUmlParameterableElement *QUmlOperationTemplateParameter::ownedDefault() const -{ - return reinterpret_cast<QUmlParameterableElement *>(_ownedDefault); -} - -/*! - The element that is owned by this template parameter. - */ -QUmlParameterableElement *QUmlOperationTemplateParameter::ownedParameteredElement() const +QUmlOperationTemplateParameter::QUmlOperationTemplateParameter(bool createQObject) : + QUmlTemplateParameter(false), + _parameteredElement(0) { - return reinterpret_cast<QUmlParameterableElement *>(_ownedParameteredElement); + if (createQObject) + _qObject = new QUmlOperationTemplateParameterObject(this); } -/*! - The template signature that owns this template parameter. - */ -QUmlTemplateSignature *QUmlOperationTemplateParameter::signature() const +QUmlOperationTemplateParameter::~QUmlOperationTemplateParameter() { - return reinterpret_cast<QUmlTemplateSignature *>(_signature); + if (!deletingFromQObject) { + _qObject->setProperty("deletingFromModelingObject", true); + delete _qObject; + } } -// OWNED ATTRIBUTES [OperationTemplateParameter] +// OWNED ATTRIBUTES /*! The operation for this template parameter. */ -QUmlOperation *QUmlOperationTemplateParameter::parameteredElement() const -{ - return reinterpret_cast<QUmlOperation *>(_parameteredElement); -} - -// OPERATIONS [Element] - -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlOperationTemplateParameter::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 QUmlOperationTemplateParameter::mustBeOwned() const +QUmlOperation * +QUmlOperationTemplateParameter::parameteredElement() const { - return UmlElement::mustBeOwned(); -} + // This is a read-write association end -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlOperationTemplateParameter::addOwnedComment(UmlComment *ownedComment) -{ - UmlElement::addOwnedComment(ownedComment); + return _parameteredElement; } -void QUmlOperationTemplateParameter::removeOwnedComment(UmlComment *ownedComment) -{ - UmlElement::removeOwnedComment(ownedComment); -} - -// SLOTS FOR OWNED ATTRIBUTES [TemplateParameter] - -void QUmlOperationTemplateParameter::setDefault(QUmlParameterableElement *default_) -{ - UmlTemplateParameter::setDefault(default_); -} - -void QUmlOperationTemplateParameter::setOwnedDefault(QUmlParameterableElement *ownedDefault) -{ - UmlTemplateParameter::setOwnedDefault(ownedDefault); -} - -void QUmlOperationTemplateParameter::setOwnedParameteredElement(QUmlParameterableElement *ownedParameteredElement) -{ - UmlTemplateParameter::setOwnedParameteredElement(ownedParameteredElement); -} - -void QUmlOperationTemplateParameter::setSignature(QUmlTemplateSignature *signature) -{ - UmlTemplateParameter::setSignature(signature); -} - -// SLOTS FOR OWNED ATTRIBUTES [OperationTemplateParameter] - void QUmlOperationTemplateParameter::setParameteredElement(QUmlOperation *parameteredElement) { - UmlOperationTemplateParameter::setParameteredElement(parameteredElement); -} + // This is a read-write association end -QT_END_NAMESPACE + if (_parameteredElement != parameteredElement) { + _parameteredElement = parameteredElement; + if (parameteredElement->asQObject() && this->asQObject()) + QObject::connect(parameteredElement->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setParameteredElement())); + } +} |