summaryrefslogtreecommitdiffstats
path: root/src/uml/qumlpackageimport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/uml/qumlpackageimport.cpp')
-rw-r--r--src/uml/qumlpackageimport.cpp170
1 files changed, 63 insertions, 107 deletions
diff --git a/src/uml/qumlpackageimport.cpp b/src/uml/qumlpackageimport.cpp
index b4b1e9ee..5eebba82 100644
--- a/src/uml/qumlpackageimport.cpp
+++ b/src/uml/qumlpackageimport.cpp
@@ -40,159 +40,115 @@
****************************************************************************/
#include "qumlpackageimport.h"
-#include <QtUml/QUmlComment>
-#include <QtUml/QUmlElement>
+#include "private/qumlpackageimportobject_p.h"
+
#include <QtUml/QUmlNamespace>
#include <QtUml/QUmlPackage>
-QT_BEGIN_NAMESPACE
-
/*!
- \class UmlPackageImport
+ \class QUmlPackageImport
\inmodule QtUml
\brief A package import is a relationship that allows the use of unqualified names to refer to package members from other namespaces.
*/
-
-QUmlPackageImport::QUmlPackageImport(QObject *parent) :
- QObject(parent)
+QUmlPackageImport::QUmlPackageImport(bool createQObject) :
+ _importedPackage(0),
+ _importingNamespace(0),
+ _visibility(QtUml::VisibilityKindPublic)
{
+ if (createQObject)
+ _qObject = new QUmlPackageImportObject(this);
}
-// OWNED ATTRIBUTES [Element]
-
-/*!
- The Comments owned by this element.
- */
-const QSet<QUmlComment *> QUmlPackageImport::ownedComment() const
+QUmlPackageImport::~QUmlPackageImport()
{
- return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment));
+ if (!deletingFromQObject) {
+ _qObject->setProperty("deletingFromModelingObject", true);
+ delete _qObject;
+ }
}
-/*!
- The Elements owned by this element.
- */
-const QSet<QUmlElement *> QUmlPackageImport::ownedElement() const
-{
- return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement));
-}
+// OWNED ATTRIBUTES
/*!
- The Element that owns this element.
+ Specifies the Package whose members are imported into a Namespace.
*/
-QUmlElement *QUmlPackageImport::owner() const
+QUmlPackage *
+QUmlPackageImport::importedPackage() const
{
- return reinterpret_cast<QUmlElement *>(_owner);
-}
+ // This is a read-write association end
-// OWNED ATTRIBUTES [Relationship]
-
-/*!
- Specifies the elements related by the Relationship.
- */
-const QSet<QUmlElement *> QUmlPackageImport::relatedElement() const
-{
- return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_relatedElement));
+ return _importedPackage;
}
-// OWNED ATTRIBUTES [DirectedRelationship]
-
-/*!
- Specifies the sources of the DirectedRelationship.
- */
-const QSet<QUmlElement *> QUmlPackageImport::source() const
+void QUmlPackageImport::setImportedPackage(QUmlPackage *importedPackage)
{
- return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_source));
-}
+ // This is a read-write association end
-/*!
- Specifies the targets of the DirectedRelationship.
- */
-const QSet<QUmlElement *> QUmlPackageImport::target() const
-{
- return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_target));
-}
+ if (_importedPackage != importedPackage) {
+ // Adjust subsetted properties
+ removeTarget(_importedPackage);
-// OWNED ATTRIBUTES [PackageImport]
+ _importedPackage = importedPackage;
+ if (importedPackage->asQObject() && this->asQObject())
+ QObject::connect(importedPackage->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setImportedPackage()));
-/*!
- Specifies the Package whose members are imported into a Namespace.
- */
-QUmlPackage *QUmlPackageImport::importedPackage() const
-{
- return reinterpret_cast<QUmlPackage *>(_importedPackage);
+ // Adjust subsetted properties
+ if (importedPackage) {
+ addTarget(importedPackage);
+ }
+ }
}
/*!
Specifies the Namespace that imports the members from a Package.
*/
-QUmlNamespace *QUmlPackageImport::importingNamespace() const
+QUmlNamespace *
+QUmlPackageImport::importingNamespace() const
{
- return reinterpret_cast<QUmlNamespace *>(_importingNamespace);
-}
+ // This is a read-write association end
-/*!
- Specifies the visibility of the imported PackageableElements within the importing Namespace, i.e., whether imported elements will in turn be visible to other packages that use that importingPackage as an importedPackage. If the PackageImport is public, the imported elements will be visible outside the package, while if it is private they will not.
- */
-QtUml::VisibilityKind QUmlPackageImport::visibility() const
-{
- return _visibility;
+ return _importingNamespace;
}
-// OPERATIONS [Element]
-
-/*!
- The query allOwnedElements() gives all of the direct and indirect owned elements of an element.
- */
-QSet<QUmlElement *> QUmlPackageImport::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 QUmlPackageImport::mustBeOwned() const
+void QUmlPackageImport::setImportingNamespace(QUmlNamespace *importingNamespace)
{
- return UmlElement::mustBeOwned();
-}
+ // This is a read-write association end
-// SLOTS FOR OWNED ATTRIBUTES [Element]
+ if (_importingNamespace != importingNamespace) {
+ // Adjust subsetted properties
+ removeSource(_importingNamespace);
-void QUmlPackageImport::addOwnedComment(UmlComment *ownedComment)
-{
- UmlElement::addOwnedComment(ownedComment);
-}
+ _importingNamespace = importingNamespace;
+ if (importingNamespace->asQObject() && this->asQObject())
+ QObject::connect(importingNamespace->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setImportingNamespace()));
-void QUmlPackageImport::removeOwnedComment(UmlComment *ownedComment)
-{
- UmlElement::removeOwnedComment(ownedComment);
+ // Adjust subsetted properties
+ setOwner(importingNamespace);
+ if (importingNamespace) {
+ addSource(importingNamespace);
+ }
+ }
}
-// SLOTS FOR OWNED ATTRIBUTES [Relationship]
-
-// SLOTS FOR OWNED ATTRIBUTES [DirectedRelationship]
-
-// SLOTS FOR OWNED ATTRIBUTES [PackageImport]
-
-void QUmlPackageImport::setImportedPackage(QUmlPackage *importedPackage)
+/*!
+ Specifies the visibility of the imported PackageableElements within the importing Namespace, i.e., whether imported elements will in turn be visible to other packages that use that importingPackage as an importedPackage. If the PackageImport is public, the imported elements will be visible outside the package, while if it is private they will not.
+ */
+QtUml::VisibilityKind
+QUmlPackageImport::visibility() const
{
- UmlPackageImport::setImportedPackage(importedPackage);
-}
+ // This is a read-write property
-void QUmlPackageImport::setImportingNamespace(QUmlNamespace *importingNamespace)
-{
- UmlPackageImport::setImportingNamespace(importingNamespace);
+ return _visibility;
}
void QUmlPackageImport::setVisibility(QtUml::VisibilityKind visibility)
{
- UmlPackageImport::setVisibility(visibility);
-}
+ // This is a read-write property
-QT_END_NAMESPACE
+ if (_visibility != visibility) {
+ _visibility = visibility;
+ }
+}