diff options
Diffstat (limited to 'src/uml/qumlconsiderignorefragment.cpp')
-rw-r--r-- | src/uml/qumlconsiderignorefragment.cpp | 346 |
1 files changed, 29 insertions, 317 deletions
diff --git a/src/uml/qumlconsiderignorefragment.cpp b/src/uml/qumlconsiderignorefragment.cpp index f54073af..a23c5eeb 100644 --- a/src/uml/qumlconsiderignorefragment.cpp +++ b/src/uml/qumlconsiderignorefragment.cpp @@ -40,350 +40,62 @@ ****************************************************************************/ #include "qumlconsiderignorefragment.h" -#include <QtUml/QUmlComment> -#include <QtUml/QUmlDependency> -#include <QtUml/QUmlElement> -#include <QtUml/QUmlGate> -#include <QtUml/QUmlGeneralOrdering> -#include <QtUml/QUmlInteraction> -#include <QtUml/QUmlInteractionOperand> -#include <QtUml/QUmlLifeline> -#include <QtUml/QUmlNamedElement> -#include <QtUml/QUmlNamespace> -#include <QtUml/QUmlPackage> -#include <QtUml/QUmlStringExpression> +#include "private/qumlconsiderignorefragmentobject_p.h" -QT_BEGIN_NAMESPACE +#include <QtUml/QUmlNamedElement> /*! - \class UmlConsiderIgnoreFragment + \class QUmlConsiderIgnoreFragment \inmodule QtUml \brief A consider ignore fragment is a kind of combined fragment that is used for the consider and ignore cases, which require lists of pertinent messages to be specified. */ - -QUmlConsiderIgnoreFragment::QUmlConsiderIgnoreFragment(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlConsiderIgnoreFragment::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlConsiderIgnoreFragment::ownedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); -} - -/*! - The Element that owns this element. - */ -QUmlElement *QUmlConsiderIgnoreFragment::owner() const -{ - return reinterpret_cast<QUmlElement *>(_owner); -} - -// OWNED ATTRIBUTES [NamedElement] - -/*! - Indicates the dependencies that reference the client. - */ -const QSet<QUmlDependency *> QUmlConsiderIgnoreFragment::clientDependency() const -{ - return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency)); -} - -/*! - The name of the NamedElement. - */ -QString QUmlConsiderIgnoreFragment::name() const -{ - return _name; -} - -/*! - The string expression used to define the name of this named element. - */ -QUmlStringExpression *QUmlConsiderIgnoreFragment::nameExpression() const +QUmlConsiderIgnoreFragment::QUmlConsiderIgnoreFragment(bool createQObject) : + QUmlCombinedFragment(false) { - return reinterpret_cast<QUmlStringExpression *>(_nameExpression); + if (createQObject) + _qObject = new QUmlConsiderIgnoreFragmentObject(this); } -/*! - Specifies the namespace that owns the NamedElement. - */ -QUmlNamespace *QUmlConsiderIgnoreFragment::namespace_() const +QUmlConsiderIgnoreFragment::~QUmlConsiderIgnoreFragment() { - return reinterpret_cast<QUmlNamespace *>(_namespace_); + if (!deletingFromQObject) { + _qObject->setProperty("deletingFromModelingObject", true); + delete _qObject; + } } -/*! - A name which allows the NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from the names of the containing namespaces starting at the root of the hierarchy and ending with the name of the NamedElement itself. - */ -QString QUmlConsiderIgnoreFragment::qualifiedName() const -{ - return UmlNamedElement::qualifiedName(); -} - -/*! - Determines where the NamedElement appears within different Namespaces within the overall model, and its accessibility. - */ -QtUml::VisibilityKind QUmlConsiderIgnoreFragment::visibility() const -{ - return _visibility; -} - -// OWNED ATTRIBUTES [InteractionFragment] - -/*! - References the Lifelines that the InteractionFragment involves. - */ -const QSet<QUmlLifeline *> QUmlConsiderIgnoreFragment::covered() const -{ - return *(reinterpret_cast<const QSet<QUmlLifeline *> *>(&_covered)); -} - -/*! - The Interaction enclosing this InteractionFragment. - */ -QUmlInteraction *QUmlConsiderIgnoreFragment::enclosingInteraction() const -{ - return reinterpret_cast<QUmlInteraction *>(_enclosingInteraction); -} - -/*! - The operand enclosing this InteractionFragment (they may nest recursively) - */ -QUmlInteractionOperand *QUmlConsiderIgnoreFragment::enclosingOperand() const -{ - return reinterpret_cast<QUmlInteractionOperand *>(_enclosingOperand); -} - -/*! - The general ordering relationships contained in this fragment. - */ -const QSet<QUmlGeneralOrdering *> QUmlConsiderIgnoreFragment::generalOrdering() const -{ - return *(reinterpret_cast<const QSet<QUmlGeneralOrdering *> *>(&_generalOrdering)); -} - -// OWNED ATTRIBUTES [CombinedFragment] - -/*! - Specifies the gates that form the interface between this CombinedFragment and its surroundings - */ -const QSet<QUmlGate *> QUmlConsiderIgnoreFragment::cfragmentGate() const -{ - return *(reinterpret_cast<const QSet<QUmlGate *> *>(&_cfragmentGate)); -} - -/*! - Specifies the operation which defines the semantics of this combination of InteractionFragments. - */ -QtUml::InteractionOperatorKind QUmlConsiderIgnoreFragment::interactionOperator() const -{ - return _interactionOperator; -} - -/*! - The set of operands of the combined fragment. - */ -const QList<QUmlInteractionOperand *> QUmlConsiderIgnoreFragment::operand() const -{ - return *(reinterpret_cast<const QList<QUmlInteractionOperand *> *>(&_operand)); -} - -// OWNED ATTRIBUTES [ConsiderIgnoreFragment] +// OWNED ATTRIBUTES /*! The set of messages that apply to this fragment */ -const QSet<QUmlNamedElement *> QUmlConsiderIgnoreFragment::message() const +const QSet<QUmlNamedElement *> +QUmlConsiderIgnoreFragment::message() const { - return *(reinterpret_cast<const QSet<QUmlNamedElement *> *>(&_message)); -} + // This is a read-write association end -// OPERATIONS [Element] - -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlConsiderIgnoreFragment::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 QUmlConsiderIgnoreFragment::mustBeOwned() const -{ - return UmlElement::mustBeOwned(); -} - -// OPERATIONS [NamedElement] - -/*! - The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards. - */ -QList<QUmlNamespace *> QUmlConsiderIgnoreFragment::allNamespaces() const -{ - QList<QUmlNamespace *> r; - foreach (UmlNamespace *element, UmlNamedElement::allNamespaces()) - r.append(reinterpret_cast<QUmlNamespace *>(element)); - return r; -} - -/*! - The query allOwningPackages() returns all the directly or indirectly owning packages. - */ -QSet<QUmlPackage *> QUmlConsiderIgnoreFragment::allOwningPackages() const -{ - QSet<QUmlPackage *> r; - foreach (UmlPackage *element, UmlNamedElement::allOwningPackages()) - r.insert(reinterpret_cast<QUmlPackage *>(element)); - return r; -} - -/*! - The query isDistinguishableFrom() determines whether two NamedElements may logically co-exist within a Namespace. By default, two named elements are distinguishable if (a) they have unrelated types or (b) they have related types but different names. - */ -bool QUmlConsiderIgnoreFragment::isDistinguishableFrom(QUmlNamedElement *n, QUmlNamespace *ns) const -{ - return UmlNamedElement::isDistinguishableFrom(n, ns); -} - -/*! - The query separator() gives the string that is used to separate names when constructing a qualified name. - */ -QString QUmlConsiderIgnoreFragment::separator() const -{ - return UmlNamedElement::separator(); -} - -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlConsiderIgnoreFragment::addOwnedComment(UmlComment *ownedComment) -{ - UmlElement::addOwnedComment(ownedComment); -} - -void QUmlConsiderIgnoreFragment::removeOwnedComment(UmlComment *ownedComment) -{ - UmlElement::removeOwnedComment(ownedComment); -} - -// SLOTS FOR OWNED ATTRIBUTES [NamedElement] - -void QUmlConsiderIgnoreFragment::addClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::addClientDependency(clientDependency); -} - -void QUmlConsiderIgnoreFragment::removeClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::removeClientDependency(clientDependency); -} - -void QUmlConsiderIgnoreFragment::setName(QString name) -{ - UmlNamedElement::setName(name); -} - -void QUmlConsiderIgnoreFragment::setNameExpression(QUmlStringExpression *nameExpression) -{ - UmlNamedElement::setNameExpression(nameExpression); -} - -void QUmlConsiderIgnoreFragment::setVisibility(QtUml::VisibilityKind visibility) -{ - UmlNamedElement::setVisibility(visibility); -} - -// SLOTS FOR OWNED ATTRIBUTES [InteractionFragment] - -void QUmlConsiderIgnoreFragment::addCovered(UmlLifeline *covered) -{ - UmlInteractionFragment::addCovered(covered); + return _message; } -void QUmlConsiderIgnoreFragment::removeCovered(UmlLifeline *covered) +void QUmlConsiderIgnoreFragment::addMessage(QUmlNamedElement *message) { - UmlInteractionFragment::removeCovered(covered); -} + // This is a read-write association end -void QUmlConsiderIgnoreFragment::setEnclosingInteraction(QUmlInteraction *enclosingInteraction) -{ - UmlInteractionFragment::setEnclosingInteraction(enclosingInteraction); + if (!_message.contains(message)) { + _message.insert(message); + if (message->asQObject() && this->asQObject()) + QObject::connect(message->asQObject(), SIGNAL(destroyed(QObject*)), this->asQObject(), SLOT(removeMessage(QObject *))); + } } -void QUmlConsiderIgnoreFragment::setEnclosingOperand(QUmlInteractionOperand *enclosingOperand) +void QUmlConsiderIgnoreFragment::removeMessage(QUmlNamedElement *message) { - UmlInteractionFragment::setEnclosingOperand(enclosingOperand); -} + // This is a read-write association end -void QUmlConsiderIgnoreFragment::addGeneralOrdering(UmlGeneralOrdering *generalOrdering) -{ - UmlInteractionFragment::addGeneralOrdering(generalOrdering); + if (_message.contains(message)) { + _message.remove(message); + } } -void QUmlConsiderIgnoreFragment::removeGeneralOrdering(UmlGeneralOrdering *generalOrdering) -{ - UmlInteractionFragment::removeGeneralOrdering(generalOrdering); -} - -// SLOTS FOR OWNED ATTRIBUTES [CombinedFragment] - -void QUmlConsiderIgnoreFragment::addCfragmentGate(UmlGate *cfragmentGate) -{ - UmlCombinedFragment::addCfragmentGate(cfragmentGate); -} - -void QUmlConsiderIgnoreFragment::removeCfragmentGate(UmlGate *cfragmentGate) -{ - UmlCombinedFragment::removeCfragmentGate(cfragmentGate); -} - -void QUmlConsiderIgnoreFragment::setInteractionOperator(QtUml::InteractionOperatorKind interactionOperator) -{ - UmlCombinedFragment::setInteractionOperator(interactionOperator); -} - -void QUmlConsiderIgnoreFragment::addOperand(UmlInteractionOperand *operand) -{ - UmlCombinedFragment::addOperand(operand); -} - -void QUmlConsiderIgnoreFragment::removeOperand(UmlInteractionOperand *operand) -{ - UmlCombinedFragment::removeOperand(operand); -} - -// SLOTS FOR OWNED ATTRIBUTES [ConsiderIgnoreFragment] - -void QUmlConsiderIgnoreFragment::addMessage(UmlNamedElement *message) -{ - UmlConsiderIgnoreFragment::addMessage(message); -} - -void QUmlConsiderIgnoreFragment::removeMessage(UmlNamedElement *message) -{ - UmlConsiderIgnoreFragment::removeMessage(message); -} - -QT_END_NAMESPACE - |