summaryrefslogtreecommitdiffstats
path: root/src/uml/qumlchangeevent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uml/qumlchangeevent.cpp')
-rw-r--r--src/uml/qumlchangeevent.cpp274
1 files changed, 31 insertions, 243 deletions
diff --git a/src/uml/qumlchangeevent.cpp b/src/uml/qumlchangeevent.cpp
index 694ff272..3d27eb7b 100644
--- a/src/uml/qumlchangeevent.cpp
+++ b/src/uml/qumlchangeevent.cpp
@@ -40,274 +40,62 @@
****************************************************************************/
#include "qumlchangeevent.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>
+#include "private/qumlchangeeventobject_p.h"
-QT_BEGIN_NAMESPACE
+#include <QtUml/QUmlValueSpecification>
/*!
- \class UmlChangeEvent
+ \class QUmlChangeEvent
\inmodule QtUml
\brief A change event models a change in the system configuration that makes a condition true.
*/
-
-QUmlChangeEvent::QUmlChangeEvent(QObject *parent) :
- QObject(parent)
-{
-}
-
-// OWNED ATTRIBUTES [Element]
-
-/*!
- The Comments owned by this element.
- */
-const QSet<QUmlComment *> QUmlChangeEvent::ownedComment() const
-{
- return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment));
-}
-
-/*!
- The Elements owned by this element.
- */
-const QSet<QUmlElement *> QUmlChangeEvent::ownedElement() const
-{
- return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement));
-}
-
-/*!
- The Element that owns this element.
- */
-QUmlElement *QUmlChangeEvent::owner() const
-{
- return reinterpret_cast<QUmlElement *>(_owner);
-}
-
-// OWNED ATTRIBUTES [ParameterableElement]
-
-/*!
- The formal template parameter that owns this element.
- */
-QUmlTemplateParameter *QUmlChangeEvent::owningTemplateParameter() const
-{
- return reinterpret_cast<QUmlTemplateParameter *>(_owningTemplateParameter);
-}
-
-/*!
- The template parameter that exposes this element as a formal parameter.
- */
-QUmlTemplateParameter *QUmlChangeEvent::templateParameter() const
-{
- return reinterpret_cast<QUmlTemplateParameter *>(_templateParameter);
-}
-
-// OWNED ATTRIBUTES [NamedElement]
-
-/*!
- Indicates the dependencies that reference the client.
- */
-const QSet<QUmlDependency *> QUmlChangeEvent::clientDependency() const
+QUmlChangeEvent::QUmlChangeEvent(bool createQObject) :
+ _changeExpression(0)
{
- return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency));
+ if (createQObject)
+ _qObject = new QUmlChangeEventObject(this);
}
-/*!
- The name of the NamedElement.
- */
-QString QUmlChangeEvent::name() const
+QUmlChangeEvent::~QUmlChangeEvent()
{
- return _name;
+ if (!deletingFromQObject) {
+ _qObject->setProperty("deletingFromModelingObject", true);
+ delete _qObject;
+ }
}
-/*!
- The string expression used to define the name of this named element.
- */
-QUmlStringExpression *QUmlChangeEvent::nameExpression() const
-{
- return reinterpret_cast<QUmlStringExpression *>(_nameExpression);
-}
-
-/*!
- Specifies the namespace that owns the NamedElement.
- */
-QUmlNamespace *QUmlChangeEvent::namespace_() const
-{
- return reinterpret_cast<QUmlNamespace *>(_namespace_);
-}
-
-/*!
- 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 QUmlChangeEvent::qualifiedName() const
-{
- return UmlNamedElement::qualifiedName();
-}
-// OWNED ATTRIBUTES [PackageableElement]
-
-/*!
- Indicates that packageable elements must always have a visibility, i.e., visibility is not optional.
- */
-QtUml::VisibilityKind QUmlChangeEvent::visibility() const
-{
- return _visibility;
-}
-
-// OWNED ATTRIBUTES [ChangeEvent]
+// OWNED ATTRIBUTES
/*!
A Boolean-valued expression that will result in a change event whenever its value changes from false to true.
*/
-QUmlValueSpecification *QUmlChangeEvent::changeExpression() const
+QUmlValueSpecification *
+QUmlChangeEvent::changeExpression() const
{
- return reinterpret_cast<QUmlValueSpecification *>(_changeExpression);
-}
-
-// OPERATIONS [Element]
+ // This is a read-write association end
-/*!
- The query allOwnedElements() gives all of the direct and indirect owned elements of an element.
- */
-QSet<QUmlElement *> QUmlChangeEvent::allOwnedElements() const
-{
- QSet<QUmlElement *> r;
- foreach (UmlElement *element, UmlElement::allOwnedElements())
- r.insert(reinterpret_cast<QUmlElement *>(element));
- return r;
+ return _changeExpression;
}
-/*!
- 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 QUmlChangeEvent::mustBeOwned() const
-{
- return UmlElement::mustBeOwned();
-}
-
-// OPERATIONS [ParameterableElement]
-
-/*!
- The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints.
- */
-bool QUmlChangeEvent::isCompatibleWith(QUmlParameterableElement *p) const
-{
- return UmlParameterableElement::isCompatibleWith(p);
-}
-
-/*!
- The query isTemplateParameter() determines if this parameterable element is exposed as a formal template parameter.
- */
-bool QUmlChangeEvent::isTemplateParameter() const
-{
- return UmlParameterableElement::isTemplateParameter();
-}
-
-// OPERATIONS [NamedElement]
-
-/*!
- The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards.
- */
-QList<QUmlNamespace *> QUmlChangeEvent::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 *> QUmlChangeEvent::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 QUmlChangeEvent::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 QUmlChangeEvent::separator() const
-{
- return UmlNamedElement::separator();
-}
-
-// SLOTS FOR OWNED ATTRIBUTES [Element]
-
-void QUmlChangeEvent::addOwnedComment(UmlComment *ownedComment)
-{
- UmlElement::addOwnedComment(ownedComment);
-}
-
-void QUmlChangeEvent::removeOwnedComment(UmlComment *ownedComment)
-{
- UmlElement::removeOwnedComment(ownedComment);
-}
-
-// SLOTS FOR OWNED ATTRIBUTES [ParameterableElement]
-
-void QUmlChangeEvent::setOwningTemplateParameter(QUmlTemplateParameter *owningTemplateParameter)
-{
- UmlParameterableElement::setOwningTemplateParameter(owningTemplateParameter);
-}
-
-void QUmlChangeEvent::setTemplateParameter(QUmlTemplateParameter *templateParameter)
-{
- UmlParameterableElement::setTemplateParameter(templateParameter);
-}
-
-// SLOTS FOR OWNED ATTRIBUTES [NamedElement]
-
-void QUmlChangeEvent::addClientDependency(UmlDependency *clientDependency)
-{
- UmlNamedElement::addClientDependency(clientDependency);
-}
-
-void QUmlChangeEvent::removeClientDependency(UmlDependency *clientDependency)
-{
- UmlNamedElement::removeClientDependency(clientDependency);
-}
-
-void QUmlChangeEvent::setName(QString name)
-{
- UmlNamedElement::setName(name);
-}
-
-void QUmlChangeEvent::setNameExpression(QUmlStringExpression *nameExpression)
+void QUmlChangeEvent::setChangeExpression(QUmlValueSpecification *changeExpression)
{
- UmlNamedElement::setNameExpression(nameExpression);
-}
-// SLOTS FOR OWNED ATTRIBUTES [PackageableElement]
+ // This is a read-write association end
-void QUmlChangeEvent::setVisibility(QtUml::VisibilityKind visibility)
-{
- UmlPackageableElement::setVisibility(visibility);
-}
+ if (_changeExpression != changeExpression) {
+ // Adjust subsetted properties
+ removeOwnedElement(_changeExpression);
-// SLOTS FOR OWNED ATTRIBUTES [ChangeEvent]
+ _changeExpression = changeExpression;
+ if (changeExpression->asQObject() && this->asQObject())
+ QObject::connect(changeExpression->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setChangeExpression()));
+ changeExpression->asQObject()->setParent(this->asQObject());
-void QUmlChangeEvent::setChangeExpression(QUmlValueSpecification *changeExpression)
-{
- UmlChangeEvent::setChangeExpression(changeExpression);
+ // Adjust subsetted properties
+ if (changeExpression) {
+ addOwnedElement(changeExpression);
+ }
+ }
}
-QT_END_NAMESPACE
-