diff options
Diffstat (limited to 'src/uml')
-rw-r--r-- | src/uml/qobjects/qumlclassobject.cpp | 31 | ||||
-rw-r--r-- | src/uml/qobjects/qumlenumerationliteralobject.cpp | 26 | ||||
-rw-r--r-- | src/uml/qobjects/qumlenumerationobject.cpp | 39 | ||||
-rw-r--r-- | src/uml/qobjects/qumlpackageobject.cpp | 41 | ||||
-rw-r--r-- | src/uml/qobjects/qumlprimitivetypeobject.cpp | 30 | ||||
-rw-r--r-- | src/uml/qobjects/qumlpropertyobject.cpp | 65 | ||||
-rw-r--r-- | src/uml/qumlelement.cpp | 19 | ||||
-rw-r--r-- | src/uml/qumlelement.h | 3 | ||||
-rw-r--r-- | src/uml/qumlenumerationliteral.cpp | 2 | ||||
-rw-r--r-- | src/uml/qumlgeneralization.cpp | 4 | ||||
-rw-r--r-- | src/uml/qumlnamedelement.cpp | 34 | ||||
-rw-r--r-- | src/uml/qumlnamespace.cpp | 10 | ||||
-rw-r--r-- | src/uml/qumlpackage.cpp | 82 | ||||
-rw-r--r-- | src/uml/qumlproperty.cpp | 4 | ||||
-rw-r--r-- | src/uml/qumltype.cpp | 2 |
15 files changed, 273 insertions, 119 deletions
diff --git a/src/uml/qobjects/qumlclassobject.cpp b/src/uml/qobjects/qumlclassobject.cpp index fe25aa0b..0d6bdff8 100644 --- a/src/uml/qobjects/qumlclassobject.cpp +++ b/src/uml/qobjects/qumlclassobject.cpp @@ -132,7 +132,10 @@ QString QUmlClassObject::name() const QObject *QUmlClassObject::nameExpression() const { - return qmodelingobjectproperty_cast<QUmlClass *>(this)->nameExpression()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlClass *>(this)->nameExpression()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlClass *>(this)->nameExpression()->asQObject(); } QObject *QUmlClassObject::namespace_() const @@ -198,8 +201,12 @@ const QSet<QObject *> QUmlClassObject::packageImport() const QObject *QUmlClassObject::owningTemplateParameter() const { - return qmodelingobjectproperty_cast<QUmlClass *>(this)->owningTemplateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlClass *>(this)->owningTemplateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlClass *>(this)->owningTemplateParameter()->asQObject(); } + // OWNED ATTRIBUTES [PackageableElement] QtUml::VisibilityKind QUmlClassObject::visibility() const @@ -296,7 +303,10 @@ bool QUmlClassObject::isFinalSpecialization() const QObject *QUmlClassObject::ownedTemplateSignature() const { - return qmodelingobjectproperty_cast<QUmlClass *>(this)->ownedTemplateSignature()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlClass *>(this)->ownedTemplateSignature()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlClass *>(this)->ownedTemplateSignature()->asQObject(); } const QSet<QObject *> QUmlClassObject::ownedUseCase() const @@ -325,7 +335,10 @@ const QSet<QObject *> QUmlClassObject::redefinedClassifier() const QObject *QUmlClassObject::representation() const { - return qmodelingobjectproperty_cast<QUmlClass *>(this)->representation()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlClass *>(this)->representation()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlClass *>(this)->representation()->asQObject(); } const QSet<QObject *> QUmlClassObject::substitution() const @@ -338,7 +351,10 @@ const QSet<QObject *> QUmlClassObject::substitution() const QObject *QUmlClassObject::templateParameter() const { - return qmodelingobjectproperty_cast<QUmlClass *>(this)->templateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlClass *>(this)->templateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlClass *>(this)->templateParameter()->asQObject(); } const QSet<QObject *> QUmlClassObject::useCase() const @@ -389,7 +405,10 @@ const QSet<QObject *> QUmlClassObject::ownedPort() const QObject *QUmlClassObject::classifierBehavior() const { - return qmodelingobjectproperty_cast<QUmlClass *>(this)->classifierBehavior()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlClass *>(this)->classifierBehavior()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlClass *>(this)->classifierBehavior()->asQObject(); } const QSet<QObject *> QUmlClassObject::interfaceRealization() const diff --git a/src/uml/qobjects/qumlenumerationliteralobject.cpp b/src/uml/qobjects/qumlenumerationliteralobject.cpp index 107145f7..8d6c1d8e 100644 --- a/src/uml/qobjects/qumlenumerationliteralobject.cpp +++ b/src/uml/qobjects/qumlenumerationliteralobject.cpp @@ -112,7 +112,10 @@ QString QUmlEnumerationLiteralObject::name() const QObject *QUmlEnumerationLiteralObject::nameExpression() const { - return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->nameExpression()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->nameExpression()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->nameExpression()->asQObject(); } QObject *QUmlEnumerationLiteralObject::namespace_() const @@ -124,16 +127,23 @@ QString QUmlEnumerationLiteralObject::qualifiedName() const { return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->qualifiedName(); } + // OWNED ATTRIBUTES [ParameterableElement] QObject *QUmlEnumerationLiteralObject::owningTemplateParameter() const { - return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->owningTemplateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->owningTemplateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->owningTemplateParameter()->asQObject(); } QObject *QUmlEnumerationLiteralObject::templateParameter() const { - return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->templateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->templateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->templateParameter()->asQObject(); } // OWNED ATTRIBUTES [PackageableElement] @@ -173,14 +183,20 @@ const QSet<QObject *> QUmlEnumerationLiteralObject::slot_() const QObject *QUmlEnumerationLiteralObject::specification() const { - return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->specification()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->specification()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->specification()->asQObject(); } // OWNED ATTRIBUTES [EnumerationLiteral] QObject *QUmlEnumerationLiteralObject::classifier() const { - return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->classifier()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->classifier()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumerationLiteral *>(this)->classifier()->asQObject(); } QObject *QUmlEnumerationLiteralObject::enumeration() const diff --git a/src/uml/qobjects/qumlenumerationobject.cpp b/src/uml/qobjects/qumlenumerationobject.cpp index 7f51fbd5..2fadd4d0 100644 --- a/src/uml/qobjects/qumlenumerationobject.cpp +++ b/src/uml/qobjects/qumlenumerationobject.cpp @@ -126,12 +126,18 @@ QString QUmlEnumerationObject::name() const QObject *QUmlEnumerationObject::nameExpression() const { - return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->nameExpression()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->nameExpression()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->nameExpression()->asQObject(); } QObject *QUmlEnumerationObject::namespace_() const { - return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->namespace_()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->namespace_()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->namespace_()->asQObject(); } QString QUmlEnumerationObject::qualifiedName() const @@ -192,8 +198,12 @@ const QSet<QObject *> QUmlEnumerationObject::packageImport() const QObject *QUmlEnumerationObject::owningTemplateParameter() const { - return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->owningTemplateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->owningTemplateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->owningTemplateParameter()->asQObject(); } + // OWNED ATTRIBUTES [PackageableElement] QtUml::VisibilityKind QUmlEnumerationObject::visibility() const @@ -205,7 +215,10 @@ QtUml::VisibilityKind QUmlEnumerationObject::visibility() const QObject *QUmlEnumerationObject::package() const { - return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->package()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->package()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->package()->asQObject(); } // OWNED ATTRIBUTES [RedefinableElement] @@ -303,7 +316,10 @@ bool QUmlEnumerationObject::isFinalSpecialization() const QObject *QUmlEnumerationObject::ownedTemplateSignature() const { - return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->ownedTemplateSignature()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->ownedTemplateSignature()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->ownedTemplateSignature()->asQObject(); } const QSet<QObject *> QUmlEnumerationObject::ownedUseCase() const @@ -332,7 +348,10 @@ const QSet<QObject *> QUmlEnumerationObject::redefinedClassifier() const QObject *QUmlEnumerationObject::representation() const { - return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->representation()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->representation()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->representation()->asQObject(); } const QSet<QObject *> QUmlEnumerationObject::substitution() const @@ -345,7 +364,10 @@ const QSet<QObject *> QUmlEnumerationObject::substitution() const QObject *QUmlEnumerationObject::templateParameter() const { - return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->templateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->templateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->templateParameter()->asQObject(); } const QSet<QObject *> QUmlEnumerationObject::useCase() const @@ -621,7 +643,8 @@ void QUmlEnumerationObject::setQualifiedName(QString qualifiedName) { qmodelingobjectproperty_cast<QUmlEnumeration *>(this)->setQualifiedName(qualifiedName); } - // SLOTS FOR OWNED ATTRIBUTES [Namespace] + +// SLOTS FOR OWNED ATTRIBUTES [Namespace] void QUmlEnumerationObject::addElementImport(QObject *elementImport) { diff --git a/src/uml/qobjects/qumlpackageobject.cpp b/src/uml/qobjects/qumlpackageobject.cpp index 63ae7727..65bfb09f 100644 --- a/src/uml/qobjects/qumlpackageobject.cpp +++ b/src/uml/qobjects/qumlpackageobject.cpp @@ -96,7 +96,10 @@ const QSet<QObject *> QUmlPackageObject::ownedElement() const QObject *QUmlPackageObject::owner() const { - return qmodelingobjectproperty_cast<QUmlPackage *>(this)->owner()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPackage *>(this)->owner()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPackage *>(this)->owner()->asQObject(); } // OWNED ATTRIBUTES [NamedElement] @@ -116,18 +119,25 @@ QString QUmlPackageObject::name() const QObject *QUmlPackageObject::nameExpression() const { - return qmodelingobjectproperty_cast<QUmlPackage *>(this)->nameExpression()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPackage *>(this)->nameExpression()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPackage *>(this)->nameExpression()->asQObject(); } QObject *QUmlPackageObject::namespace_() const { - return qmodelingobjectproperty_cast<QUmlPackage *>(this)->namespace_()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPackage *>(this)->namespace_()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPackage *>(this)->namespace_()->asQObject(); } QString QUmlPackageObject::qualifiedName() const { return qmodelingobjectproperty_cast<QUmlPackage *>(this)->qualifiedName(); } + // OWNED ATTRIBUTES [Namespace] const QSet<QObject *> QUmlPackageObject::elementImport() const @@ -182,12 +192,18 @@ const QSet<QObject *> QUmlPackageObject::packageImport() const QObject *QUmlPackageObject::owningTemplateParameter() const { - return qmodelingobjectproperty_cast<QUmlPackage *>(this)->owningTemplateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPackage *>(this)->owningTemplateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPackage *>(this)->owningTemplateParameter()->asQObject(); } QObject *QUmlPackageObject::templateParameter() const { - return qmodelingobjectproperty_cast<QUmlPackage *>(this)->templateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPackage *>(this)->templateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPackage *>(this)->templateParameter()->asQObject(); } // OWNED ATTRIBUTES [PackageableElement] @@ -201,7 +217,10 @@ QtUml::VisibilityKind QUmlPackageObject::visibility() const QObject *QUmlPackageObject::ownedTemplateSignature() const { - return qmodelingobjectproperty_cast<QUmlPackage *>(this)->ownedTemplateSignature()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPackage *>(this)->ownedTemplateSignature()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPackage *>(this)->ownedTemplateSignature()->asQObject(); } const QSet<QObject *> QUmlPackageObject::templateBinding() const @@ -229,7 +248,10 @@ const QSet<QObject *> QUmlPackageObject::nestedPackage() const QObject *QUmlPackageObject::nestingPackage() const { - return qmodelingobjectproperty_cast<QUmlPackage *>(this)->nestingPackage()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPackage *>(this)->nestingPackage()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPackage *>(this)->nestingPackage()->asQObject(); } const QSet<QObject *> QUmlPackageObject::ownedStereotype() const @@ -382,7 +404,10 @@ QSet<QObject *> QUmlPackageObject::allApplicableStereotypes() const QObject *QUmlPackageObject::containingProfile() const { - return qmodelingobjectproperty_cast<QUmlPackage *>(this)->containingProfile()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPackage *>(this)->containingProfile()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPackage *>(this)->containingProfile()->asQObject(); } bool QUmlPackageObject::makesVisible(QObject *el) const diff --git a/src/uml/qobjects/qumlprimitivetypeobject.cpp b/src/uml/qobjects/qumlprimitivetypeobject.cpp index 76d49e7c..ecfd208c 100644 --- a/src/uml/qobjects/qumlprimitivetypeobject.cpp +++ b/src/uml/qobjects/qumlprimitivetypeobject.cpp @@ -125,12 +125,18 @@ QString QUmlPrimitiveTypeObject::name() const QObject *QUmlPrimitiveTypeObject::nameExpression() const { - return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->nameExpression()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->nameExpression()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->nameExpression()->asQObject(); } QObject *QUmlPrimitiveTypeObject::namespace_() const { - return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->namespace_()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->namespace_()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->namespace_()->asQObject(); } QString QUmlPrimitiveTypeObject::qualifiedName() const @@ -191,7 +197,10 @@ const QSet<QObject *> QUmlPrimitiveTypeObject::packageImport() const QObject *QUmlPrimitiveTypeObject::owningTemplateParameter() const { - return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->owningTemplateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->owningTemplateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->owningTemplateParameter()->asQObject(); } // OWNED ATTRIBUTES [PackageableElement] @@ -302,7 +311,10 @@ bool QUmlPrimitiveTypeObject::isFinalSpecialization() const QObject *QUmlPrimitiveTypeObject::ownedTemplateSignature() const { - return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->ownedTemplateSignature()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->ownedTemplateSignature()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->ownedTemplateSignature()->asQObject(); } const QSet<QObject *> QUmlPrimitiveTypeObject::ownedUseCase() const @@ -331,7 +343,10 @@ const QSet<QObject *> QUmlPrimitiveTypeObject::redefinedClassifier() const QObject *QUmlPrimitiveTypeObject::representation() const { - return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->representation()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->representation()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->representation()->asQObject(); } const QSet<QObject *> QUmlPrimitiveTypeObject::substitution() const @@ -344,7 +359,10 @@ const QSet<QObject *> QUmlPrimitiveTypeObject::substitution() const QObject *QUmlPrimitiveTypeObject::templateParameter() const { - return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->templateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->templateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlPrimitiveType *>(this)->templateParameter()->asQObject(); } const QSet<QObject *> QUmlPrimitiveTypeObject::useCase() const diff --git a/src/uml/qobjects/qumlpropertyobject.cpp b/src/uml/qobjects/qumlpropertyobject.cpp index 505f769a..22bdbc45 100644 --- a/src/uml/qobjects/qumlpropertyobject.cpp +++ b/src/uml/qobjects/qumlpropertyobject.cpp @@ -119,7 +119,10 @@ QString QUmlPropertyObject::name() const QObject *QUmlPropertyObject::nameExpression() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->nameExpression()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->nameExpression()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->nameExpression()->asQObject(); } QObject *QUmlPropertyObject::namespace_() const @@ -163,7 +166,10 @@ int QUmlPropertyObject::lower() const QObject *QUmlPropertyObject::lowerValue() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->lowerValue()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->lowerValue()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->lowerValue()->asQObject(); } int QUmlPropertyObject::upper() const @@ -173,7 +179,10 @@ int QUmlPropertyObject::upper() const QObject *QUmlPropertyObject::upperValue() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->upperValue()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->upperValue()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->upperValue()->asQObject(); } // OWNED ATTRIBUTES [RedefinableElement] @@ -218,7 +227,10 @@ bool QUmlPropertyObject::isStatic() const QObject *QUmlPropertyObject::owningTemplateParameter() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->owningTemplateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->owningTemplateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->owningTemplateParameter()->asQObject(); } // OWNED ATTRIBUTES [ConnectableElement] @@ -232,7 +244,10 @@ const QList<QObject *> QUmlPropertyObject::end() const QObject *QUmlPropertyObject::templateParameter() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->templateParameter()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->templateParameter()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->templateParameter()->asQObject(); } // OWNED ATTRIBUTES [DeploymentTarget] @@ -262,22 +277,34 @@ QtUml::AggregationKind QUmlPropertyObject::aggregation() const QObject *QUmlPropertyObject::association() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->association()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->association()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->association()->asQObject(); } QObject *QUmlPropertyObject::associationEnd() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->associationEnd()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->associationEnd()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->associationEnd()->asQObject(); } QObject *QUmlPropertyObject::class_() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->class_()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->class_()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->class_()->asQObject(); } QObject *QUmlPropertyObject::datatype() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->datatype()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->datatype()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->datatype()->asQObject(); } QString QUmlPropertyObject::default_() const @@ -287,12 +314,18 @@ QString QUmlPropertyObject::default_() const QObject *QUmlPropertyObject::defaultValue() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->defaultValue()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->defaultValue()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->defaultValue()->asQObject(); } QObject *QUmlPropertyObject::interface_() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->interface_()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->interface_()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->interface_()->asQObject(); } bool QUmlPropertyObject::isComposite() const @@ -322,12 +355,18 @@ bool QUmlPropertyObject::isReadOnly() const QObject *QUmlPropertyObject::opposite() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->opposite()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->opposite()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->opposite()->asQObject(); } QObject *QUmlPropertyObject::owningAssociation() const { - return qmodelingobjectproperty_cast<QUmlProperty *>(this)->owningAssociation()->asQObject(); + if (!qmodelingobjectproperty_cast<QUmlProperty *>(this)->owningAssociation()) + return 0; + else + return qmodelingobjectproperty_cast<QUmlProperty *>(this)->owningAssociation()->asQObject(); } const QList<QObject *> QUmlPropertyObject::qualifier() const diff --git a/src/uml/qumlelement.cpp b/src/uml/qumlelement.cpp index b8c87228..97138e84 100644 --- a/src/uml/qumlelement.cpp +++ b/src/uml/qumlelement.cpp @@ -156,7 +156,7 @@ void QUmlElement::setOwner(QUmlElement *owner) if (_owner != owner) { _owner = owner; - if (owner->asQObject() && this->asQObject()) + if (owner && owner->asQObject() && this->asQObject()) QObject::connect(owner->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setOwner())); } } @@ -168,9 +168,9 @@ void QUmlElement::setOwner(QUmlElement *owner) */ QSet<QUmlElement *> QUmlElement::allOwnedElements() const { - qWarning("UmlElement::allOwnedElements(): to be implemented (operation)"); - - return QSet<QUmlElement *> (); + QSet<QUmlElement *> allOwnedElements_; + allOwnedElements(allOwnedElements_); + return allOwnedElements_; } /*! @@ -178,9 +178,7 @@ QSet<QUmlElement *> QUmlElement::allOwnedElements() const */ bool QUmlElement::mustBeOwned() const { - qWarning("UmlElement::mustBeOwned(): to be implemented (operation)"); - - return bool (); + return true; } void QUmlElement::setPropertyData() @@ -205,3 +203,10 @@ void QUmlElement::setPropertyData() } +void QUmlElement::allOwnedElements(QSet<QUmlElement *> &allOwnedElements_) const +{ + allOwnedElements_.unite(_ownedElement); + foreach (QUmlElement *element, _ownedElement) + element->allOwnedElements(allOwnedElements_); +} + diff --git a/src/uml/qumlelement.h b/src/uml/qumlelement.h index 762a2cac..347c6069 100644 --- a/src/uml/qumlelement.h +++ b/src/uml/qumlelement.h @@ -83,6 +83,9 @@ protected: QUmlElement *_owner; virtual void setPropertyData(); + +private: + void allOwnedElements(QSet<QUmlElement *> &allOwnedElements_) const; }; QT_END_NAMESPACE diff --git a/src/uml/qumlenumerationliteral.cpp b/src/uml/qumlenumerationliteral.cpp index ee4dc459..c1799a49 100644 --- a/src/uml/qumlenumerationliteral.cpp +++ b/src/uml/qumlenumerationliteral.cpp @@ -151,7 +151,7 @@ void QUmlEnumerationLiteral::setEnumeration(QUmlEnumeration *enumeration) // Adjust subsetted properties _enumeration = enumeration; - if (enumeration->asQObject() && this->asQObject()) + if (enumeration && enumeration->asQObject() && this->asQObject()) QObject::connect(enumeration->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setEnumeration())); // Adjust subsetted properties diff --git a/src/uml/qumlgeneralization.cpp b/src/uml/qumlgeneralization.cpp index 7a72cfb0..e19baecd 100644 --- a/src/uml/qumlgeneralization.cpp +++ b/src/uml/qumlgeneralization.cpp @@ -107,7 +107,7 @@ void QUmlGeneralization::setGeneral(QUmlClassifier *general) removeTarget(_general); _general = general; - if (general->asQObject() && this->asQObject()) + if (general && general->asQObject() && this->asQObject()) QObject::connect(general->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setGeneral())); // Adjust subsetted properties @@ -195,7 +195,7 @@ void QUmlGeneralization::setSpecific(QUmlClassifier *specific) removeSource(_specific); _specific = specific; - if (specific->asQObject() && this->asQObject()) + if (specific && specific->asQObject() && this->asQObject()) QObject::connect(specific->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setSpecific())); // Adjust subsetted properties diff --git a/src/uml/qumlnamedelement.cpp b/src/uml/qumlnamedelement.cpp index e522d8e1..12bf177d 100644 --- a/src/uml/qumlnamedelement.cpp +++ b/src/uml/qumlnamedelement.cpp @@ -187,7 +187,7 @@ void QUmlNamedElement::setNamespace(QUmlNamespace *namespace_) // Adjust subsetted properties _namespace_ = namespace_; - if (namespace_->asQObject() && this->asQObject()) + if (namespace_ && namespace_->asQObject() && this->asQObject()) QObject::connect(namespace_->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setNamespace())); // Adjust subsetted properties @@ -202,9 +202,16 @@ QString QUmlNamedElement::qualifiedName() const { // This is a read-only derived property - qWarning("UmlNamedElement::qualifiedName(): to be implemented (this is a derived property)"); - - return QString(); + if (_name.isEmpty()) return QString(); + QString qualifiedName_(_name); + QList<QUmlNamespace *> allNamespaces_ = allNamespaces(); + QString separator_ = separator(); + foreach (QUmlNamespace *namespace_, allNamespaces_) { + if (namespace_->name().isEmpty()) + return QString(); + qualifiedName_.prepend(separator_).prepend(namespace_->name()); + } + return qualifiedName_; } void QUmlNamedElement::setQualifiedName(QString qualifiedName) @@ -245,9 +252,18 @@ void QUmlNamedElement::setVisibility(QtUml::VisibilityKind visibility) */ QList<QUmlNamespace *> QUmlNamedElement::allNamespaces() const { - qWarning("UmlNamedElement::allNamespaces(): to be implemented (operation)"); - - return QList<QUmlNamespace *> (); + if (!_namespace_) { + return QList<QUmlNamespace *>(); + } + else { + QList<QUmlNamespace *> allNamespaces_; + QUmlNamespace *namespace_ = this->namespace_(); + while (namespace_) { + allNamespaces_.append(namespace_); + namespace_ = namespace_->namespace_(); + } + return allNamespaces_; + } } /*! @@ -277,9 +293,7 @@ bool QUmlNamedElement::isDistinguishableFrom(QUmlNamedElement *n, QUmlNamespace */ QString QUmlNamedElement::separator() const { - qWarning("UmlNamedElement::separator(): to be implemented (operation)"); - - return QString (); + return QStringLiteral("::"); } void QUmlNamedElement::setPropertyData() diff --git a/src/uml/qumlnamespace.cpp b/src/uml/qumlnamespace.cpp index 22a327cc..c1a09d8b 100644 --- a/src/uml/qumlnamespace.cpp +++ b/src/uml/qumlnamespace.cpp @@ -144,9 +144,13 @@ const QSet<QUmlPackageableElement *> QUmlNamespace::importedMember() const { // This is a read-only derived association end - qWarning("UmlNamespace::importedMember(): to be implemented (this is a derived association end)"); - - return QSet<QUmlPackageableElement *>(); + QSet<QUmlPackageableElement *> importedMembers_; + foreach (QUmlElementImport *elementImport, _elementImport) + importedMembers_.insert(elementImport->importedElement()); + foreach (QUmlPackageImport *packageImport, _packageImport) + if (packageImport->importedPackage()) + importedMembers_.unite(packageImport->importedPackage()->packagedElement()); + return importedMembers_; } void QUmlNamespace::addImportedMember(QUmlPackageableElement *importedMember) diff --git a/src/uml/qumlpackage.cpp b/src/uml/qumlpackage.cpp index 8e6758b0..b150c350 100644 --- a/src/uml/qumlpackage.cpp +++ b/src/uml/qumlpackage.cpp @@ -149,23 +149,23 @@ const QSet<QUmlPackage *> QUmlPackage::nestedPackage() const { // This is a read-write derived association end - qWarning("UmlPackage::nestedPackage(): to be implemented (this is a derived association end)"); - - return QSet<QUmlPackage *>(); + QSet<QUmlPackage *> nestedPackages_; + foreach (QUmlPackageableElement *packageableElement, _packagedElement) + if (QUmlPackage *package = dynamic_cast<QUmlPackage *>(packageableElement)) + nestedPackages_.insert(package); + return nestedPackages_; } void QUmlPackage::addNestedPackage(QUmlPackage *nestedPackage) { // This is a read-write derived association end - qWarning("UmlPackage::nestedPackage(): to be implemented (this is a derived association end)"); - Q_UNUSED(nestedPackage); - - if (false /* <derivedexclusion-criteria> */) { - // <derived-code> + if (!_packagedElement.contains(dynamic_cast<QUmlPackageableElement *>(nestedPackage))) { + // Adjust subsetted property(ies) + (dynamic_cast<QUmlPackage *>(this))->addPackagedElement(dynamic_cast<QUmlPackageableElement *>(nestedPackage)); - // Adjust subsetted properties - addPackagedElement(nestedPackage); + // Adjust opposite property + nestedPackage->setNestingPackage(this); } } @@ -173,14 +173,12 @@ void QUmlPackage::removeNestedPackage(QUmlPackage *nestedPackage) { // This is a read-write derived association end - qWarning("UmlPackage::nestedPackage(): to be implemented (this is a derived association end)"); - Q_UNUSED(nestedPackage); + if (_packagedElement.contains(dynamic_cast<QUmlPackageableElement *>(nestedPackage))) { + // Adjust subsetted property(ies) + (dynamic_cast<QUmlPackage *>(this))->removePackagedElement(dynamic_cast<QUmlPackageableElement *>(nestedPackage)); - if (false /* <derivedexclusion-criteria> */) { - // <derived-code> - - // Adjust subsetted properties - removePackagedElement(nestedPackage); + // Adjust opposite property + nestedPackage->setNestingPackage(0); } } @@ -212,9 +210,11 @@ const QSet<QUmlStereotype *> QUmlPackage::ownedStereotype() const { // This is a read-only derived association end - qWarning("UmlPackage::ownedStereotype(): to be implemented (this is a derived association end)"); - - return QSet<QUmlStereotype *>(); + QSet<QUmlStereotype *> ownedStereotypes_; + foreach (QUmlPackageableElement *packageableElement, _packagedElement) + if (QUmlStereotype *stereotype = dynamic_cast<QUmlStereotype *>(packageableElement)) + ownedStereotypes_.insert(stereotype); + return ownedStereotypes_; } void QUmlPackage::addOwnedStereotype(QUmlStereotype *ownedStereotype) @@ -254,28 +254,23 @@ const QSet<QUmlType *> QUmlPackage::ownedType() const { // This is a read-write derived association end - qWarning("UmlPackage::ownedType(): to be implemented (this is a derived association end)"); - - return QSet<QUmlType *>(); + QSet<QUmlType *> ownedTypes_; + foreach (QUmlPackageableElement *packageableElement, _packagedElement) + if (QUmlType *type = dynamic_cast<QUmlType *>(packageableElement)) + ownedTypes_.insert(type); + return ownedTypes_; } void QUmlPackage::addOwnedType(QUmlType *ownedType) { // This is a read-write derived association end - qWarning("UmlPackage::ownedType(): to be implemented (this is a derived association end)"); - Q_UNUSED(ownedType); - - if (false /* <derivedexclusion-criteria> */) { - // <derived-code> - - // Adjust subsetted properties - addPackagedElement(ownedType); + if (!_packagedElement.contains(ownedType)) { + // Adjust subsetted property(ies) + (dynamic_cast<QUmlPackage *>(this))->addPackagedElement(dynamic_cast<QUmlPackageableElement *>(ownedType)); - // Adjust opposite properties - if (ownedType) { - ownedType->setPackage(this); - } + // Adjust opposite property + ownedType->setPackage(this); } } @@ -283,19 +278,12 @@ void QUmlPackage::removeOwnedType(QUmlType *ownedType) { // This is a read-write derived association end - qWarning("UmlPackage::ownedType(): to be implemented (this is a derived association end)"); - Q_UNUSED(ownedType); + if (_packagedElement.contains(ownedType)) { + // Adjust subsetted property(ies) + (dynamic_cast<QUmlPackage *>(this))->removePackagedElement(dynamic_cast<QUmlPackageableElement *>(ownedType)); - if (false /* <derivedexclusion-criteria> */) { - // <derived-code> - - // Adjust subsetted properties - removePackagedElement(ownedType); - - // Adjust opposite properties - if (ownedType) { - ownedType->setPackage(0); - } + // Adjust opposite property + ownedType->setPackage(0); } } diff --git a/src/uml/qumlproperty.cpp b/src/uml/qumlproperty.cpp index a1e9e34a..ee055207 100644 --- a/src/uml/qumlproperty.cpp +++ b/src/uml/qumlproperty.cpp @@ -222,7 +222,7 @@ void QUmlProperty::setAssociationEnd(QUmlProperty *associationEnd) } /*! - References the Class that owns the Property.References the Class that owns the Property. + References the Class that owns the Property.References the Class that owns the Property. */ QUmlClass *QUmlProperty::class_() const { @@ -239,7 +239,7 @@ void QUmlProperty::setClass(QUmlClass *class_) // Adjust subsetted properties _class_ = class_; - if (class_->asQObject() && this->asQObject()) + if (class_ && class_->asQObject() && this->asQObject()) QObject::connect(class_->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setClass())); // Adjust subsetted properties diff --git a/src/uml/qumltype.cpp b/src/uml/qumltype.cpp index 37fa0aff..3cc9e08b 100644 --- a/src/uml/qumltype.cpp +++ b/src/uml/qumltype.cpp @@ -104,7 +104,7 @@ void QUmlType::setPackage(QUmlPackage *package) if (_package != package) { _package = package; - if (package->asQObject() && this->asQObject()) + if (package && package->asQObject() && this->asQObject()) QObject::connect(package->asQObject(), SIGNAL(destroyed()), this->asQObject(), SLOT(setPackage())); } } |