From 0f13b4f396ac21dee5ba1df2cc4cd482b3b41f88 Mon Sep 17 00:00:00 2001 From: "Sandro S. Andrade" Date: Tue, 26 Nov 2013 05:52:45 -0300 Subject: Update metamodel implementation. UML update coming soon ... Change-Id: Ie5c42361c8fdae602134c9bdd8ce19416b2c7f40 Reviewed-by: Sandro S. Andrade --- .../gccxmlarchitecturerecoverybackendplugin.cpp | 6 +- scripts/templates/common.tmpl | 2 +- scripts/templates/qclass.cpp | 2 +- src/duse/qdusedesigndimension.cpp | 10 ++- src/duse/qdusedesigndimension.h | 1 + src/duse/qdusedesigndimensioninstance.cpp | 10 ++- src/duse/qdusedesigndimensioninstance.h | 1 + src/duse/qdusedesignspace.cpp | 8 +++ src/duse/qdusedesignspace.h | 1 + src/duse/qdusemodelchange.cpp | 10 ++- src/duse/qdusemodelchange.h | 1 + src/duse/qdusequalitymetric.cpp | 8 +++ src/duse/qdusequalitymetric.h | 1 + src/duse/qdusevariationpoint.cpp | 10 ++- src/duse/qdusevariationpoint.h | 1 + src/mof/qmofargument.cpp | 10 ++- src/mof/qmofargument.h | 1 + src/mof/qmofassociation.cpp | 16 ++--- src/mof/qmofassociation.h | 1 + src/mof/qmofbehavioralfeature.cpp | 10 ++- src/mof/qmofbehavioralfeature.h | 2 + src/mof/qmofclass.cpp | 12 ++-- src/mof/qmofclass.h | 1 + src/mof/qmofclassifier.cpp | 12 ++-- src/mof/qmofclassifier.h | 2 + src/mof/qmofcomment.cpp | 10 ++- src/mof/qmofcomment.h | 1 + src/mof/qmofconstraint.cpp | 12 ++-- src/mof/qmofconstraint.h | 1 + src/mof/qmofdatatype.cpp | 12 ++-- src/mof/qmofdatatype.h | 1 + src/mof/qmofdirectedrelationship.cpp | 8 +++ src/mof/qmofdirectedrelationship.h | 2 + src/mof/qmofelement.cpp | 8 +++ src/mof/qmofelement.h | 2 + src/mof/qmofelementimport.cpp | 12 ++-- src/mof/qmofelementimport.h | 1 + src/mof/qmofenumeration.cpp | 12 ++-- src/mof/qmofenumeration.h | 1 + src/mof/qmofenumerationliteral.cpp | 10 ++- src/mof/qmofenumerationliteral.h | 1 + src/mof/qmofexception.cpp | 12 ++-- src/mof/qmofexception.h | 1 + src/mof/qmofexpression.cpp | 10 ++- src/mof/qmofexpression.h | 1 + src/mof/qmofextent.cpp | 8 +++ src/mof/qmofextent.h | 1 + src/mof/qmoffactory.cpp | 10 ++- src/mof/qmoffactory.h | 1 + src/mof/qmoffeature.cpp | 8 +++ src/mof/qmoffeature.h | 2 + src/mof/qmofgeneralization.cpp | 12 ++-- src/mof/qmofgeneralization.h | 1 + src/mof/qmofinstancespecification.cpp | 10 ++- src/mof/qmofinstancespecification.h | 1 + src/mof/qmofinstancevalue.cpp | 12 ++-- src/mof/qmofinstancevalue.h | 1 + src/mof/qmoflink.cpp | 14 +++-- src/mof/qmoflink.h | 1 + src/mof/qmofliteralboolean.cpp | 10 ++- src/mof/qmofliteralboolean.h | 1 + src/mof/qmofliteralinteger.cpp | 10 ++- src/mof/qmofliteralinteger.h | 1 + src/mof/qmofliteralnull.cpp | 10 ++- src/mof/qmofliteralnull.h | 1 + src/mof/qmofliteralreal.cpp | 10 ++- src/mof/qmofliteralreal.h | 1 + src/mof/qmofliteralspecification.cpp | 10 ++- src/mof/qmofliteralspecification.h | 2 + src/mof/qmofliteralstring.cpp | 10 ++- src/mof/qmofliteralstring.h | 1 + src/mof/qmofliteralunlimitednatural.cpp | 10 ++- src/mof/qmofliteralunlimitednatural.h | 1 + src/mof/qmofmultiplicityelement.cpp | 8 +++ src/mof/qmofmultiplicityelement.h | 2 + src/mof/qmofnamedelement.cpp | 8 +++ src/mof/qmofnamedelement.h | 2 + src/mof/qmofnamespace.cpp | 8 +++ src/mof/qmofnamespace.h | 2 + src/mof/qmofobject.cpp | 8 +++ src/mof/qmofobject.h | 1 + src/mof/qmofopaqueexpression.cpp | 10 ++- src/mof/qmofopaqueexpression.h | 1 + src/mof/qmofoperation.cpp | 16 ++--- src/mof/qmofoperation.h | 1 + src/mof/qmofpackage.cpp | 10 ++- src/mof/qmofpackage.h | 1 + src/mof/qmofpackageableelement.cpp | 8 +++ src/mof/qmofpackageableelement.h | 2 + src/mof/qmofpackageimport.cpp | 12 ++-- src/mof/qmofpackageimport.h | 1 + src/mof/qmofpackagemerge.cpp | 12 ++-- src/mof/qmofpackagemerge.h | 1 + src/mof/qmofparameter.cpp | 12 ++-- src/mof/qmofparameter.h | 1 + src/mof/qmofprimitivetype.cpp | 12 ++-- src/mof/qmofprimitivetype.h | 1 + src/mof/qmofproperty.cpp | 22 +++---- src/mof/qmofproperty.h | 1 + src/mof/qmofredefinableelement.cpp | 8 +++ src/mof/qmofredefinableelement.h | 2 + src/mof/qmofreflectivecollection.cpp | 8 +++ src/mof/qmofreflectivecollection.h | 1 + src/mof/qmofreflectivesequence.cpp | 8 +++ src/mof/qmofreflectivesequence.h | 1 + src/mof/qmofrelationship.cpp | 8 +++ src/mof/qmofrelationship.h | 2 + src/mof/qmofslot.cpp | 12 ++-- src/mof/qmofslot.h | 1 + src/mof/qmofstructuralfeature.cpp | 10 ++- src/mof/qmofstructuralfeature.h | 2 + src/mof/qmoftag.cpp | 12 ++-- src/mof/qmoftag.h | 1 + src/mof/qmoftype.cpp | 10 ++- src/mof/qmoftype.h | 2 + src/mof/qmoftypedelement.cpp | 10 ++- src/mof/qmoftypedelement.h | 2 + src/mof/qmofuriextent.cpp | 8 +++ src/mof/qmofuriextent.h | 1 + src/mof/qmofvaluespecification.cpp | 10 ++- src/mof/qmofvaluespecification.h | 2 + .../qsaduseprofileprocesscomponent.cpp | 10 ++- src/saduseprofile/qsaduseprofileprocesscomponent.h | 1 + tests/auto/auto.pro | 3 +- .../qtmofguardedcollection.pro | 7 +++ .../tst_qtmofguardedcollection.cpp | 73 ++++++++++++++++++++++ 126 files changed, 644 insertions(+), 151 deletions(-) create mode 100644 tests/auto/qtmofguardedcollection/qtmofguardedcollection.pro create mode 100644 tests/auto/qtmofguardedcollection/tst_qtmofguardedcollection.cpp diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.cpp b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.cpp index 3a700b87..e70d218b 100644 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.cpp +++ b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.cpp @@ -42,7 +42,9 @@ #include #include + #include +#include #include @@ -66,8 +68,8 @@ void GccXmlArchitectureRecoveryBackendPlugin::setRootProjectDir(const QDir &root void GccXmlArchitectureRecoveryBackendPlugin::newArchitectureRecoveryProcess() { - QString fileName = QFileDialog::getOpenFileName(this, tr("Open xml file"), "/home", tr("Xml files (*.xml)")); - _rootProjectDir = new QDir(fileName); + QString fileName = QFileDialog::getOpenFileName(0, tr("Open xml file"), "/home", tr("Xml files (*.xml)")); + _rootProjectDir = QDir(fileName); components(); } diff --git a/scripts/templates/common.tmpl b/scripts/templates/common.tmpl index 82e8deb4..86f8bf73 100644 --- a/scripts/templates/common.tmpl +++ b/scripts/templates/common.tmpl @@ -535,7 +535,7 @@ void Q${namespace}${originalClassName}Object::unset${qtAttribute.remove("^is").u [%- SET attributeName = attribute.findvalue("@name") -%] [%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%] [%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%] - [%- NEXT IF attribute.findvalue("@aggregation") != "composite" -%] + [%- NEXT IF attribute.findvalue("@aggregation") != "composite" && qtType.match('\*') -%] [%- IF qtType.match("QList|QSet") %] foreach (${qtType.remove("QList<").remove("QSet<").remove(">").replace('\* ', '*')}element, ${PLURALFORM(qtAttribute, attribute)}()) [%- IF qtType.match('\*') %] diff --git a/scripts/templates/qclass.cpp b/scripts/templates/qclass.cpp index 687d1805..bc499653 100644 --- a/scripts/templates/qclass.cpp +++ b/scripts/templates/qclass.cpp @@ -144,7 +144,7 @@ Q${namespace}${className}::Q${namespace}${className}([%- IF class.findvalue("@is */ Q${namespace}${className}::~Q${namespace}${className}() { - QUmlElement::deleteQModelingObject(); + QModelingElement::deleteQModelingObject(); } [%- IF documentation != "" %] diff --git a/src/duse/qdusedesigndimension.cpp b/src/duse/qdusedesigndimension.cpp index 7519ec9e..078775e9 100644 --- a/src/duse/qdusedesigndimension.cpp +++ b/src/duse/qdusedesigndimension.cpp @@ -66,6 +66,14 @@ QDuseDesignDimension::QDuseDesignDimension(bool createQModelingObject) : _qModelingObject = qobject_cast(new QDuseDesignDimensionObject(this)); } +/*! + Destroys the QDuseDesignDimension. + */ +QDuseDesignDimension::~QDuseDesignDimension() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QDuseDesignDimension. */ @@ -75,8 +83,6 @@ QModelingElement *QDuseDesignDimension::clone() const c->setName(name()); if (instanceSelectionRule()) c->setInstanceSelectionRule(dynamic_cast(instanceSelectionRule()->clone())); - foreach (QDuseDesignDimension *element, requiredPreviousEvaluations()) - c->addRequiredPreviousEvaluation(dynamic_cast(element->clone())); foreach (QDuseVariationPoint *element, variationPoints()) c->addVariationPoint(dynamic_cast(element->clone())); foreach (QDuseDesignDimensionInstance *element, designDimensionInstances()) diff --git a/src/duse/qdusedesigndimension.h b/src/duse/qdusedesigndimension.h index 63144779..71cb3d73 100644 --- a/src/duse/qdusedesigndimension.h +++ b/src/duse/qdusedesigndimension.h @@ -57,6 +57,7 @@ class Q_DUSE_EXPORT QDuseDesignDimension : public QModelingElement { public: explicit QDuseDesignDimension(bool createQModelingObject = true); + virtual ~QDuseDesignDimension(); virtual QModelingElement *clone() const; diff --git a/src/duse/qdusedesigndimensioninstance.cpp b/src/duse/qdusedesigndimensioninstance.cpp index 53a12889..e9b4ee55 100644 --- a/src/duse/qdusedesigndimensioninstance.cpp +++ b/src/duse/qdusedesigndimensioninstance.cpp @@ -64,14 +64,20 @@ QDuseDesignDimensionInstance::QDuseDesignDimensionInstance(bool createQModelingO _qModelingObject = qobject_cast(new QDuseDesignDimensionInstanceObject(this)); } +/*! + Destroys the QDuseDesignDimensionInstance. + */ +QDuseDesignDimensionInstance::~QDuseDesignDimensionInstance() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QDuseDesignDimensionInstance. */ QModelingElement *QDuseDesignDimensionInstance::clone() const { QDuseDesignDimensionInstance *c = new QDuseDesignDimensionInstance; - if (targetInstance()) - c->setTargetInstance(dynamic_cast(targetInstance()->clone())); return c; } diff --git a/src/duse/qdusedesigndimensioninstance.h b/src/duse/qdusedesigndimensioninstance.h index 0e9e919d..60a49c13 100644 --- a/src/duse/qdusedesigndimensioninstance.h +++ b/src/duse/qdusedesigndimensioninstance.h @@ -55,6 +55,7 @@ class Q_DUSE_EXPORT QDuseDesignDimensionInstance : public QModelingElement { public: explicit QDuseDesignDimensionInstance(bool createQModelingObject = true); + virtual ~QDuseDesignDimensionInstance(); virtual QModelingElement *clone() const; diff --git a/src/duse/qdusedesignspace.cpp b/src/duse/qdusedesignspace.cpp index 229d4962..80ebaab7 100644 --- a/src/duse/qdusedesignspace.cpp +++ b/src/duse/qdusedesignspace.cpp @@ -64,6 +64,14 @@ QDuseDesignSpace::QDuseDesignSpace(bool createQModelingObject) _qModelingObject = qobject_cast(new QDuseDesignSpaceObject(this)); } +/*! + Destroys the QDuseDesignSpace. + */ +QDuseDesignSpace::~QDuseDesignSpace() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QDuseDesignSpace. */ diff --git a/src/duse/qdusedesignspace.h b/src/duse/qdusedesignspace.h index 87b76b66..b87f8ffe 100644 --- a/src/duse/qdusedesignspace.h +++ b/src/duse/qdusedesignspace.h @@ -56,6 +56,7 @@ class Q_DUSE_EXPORT QDuseDesignSpace : public QModelingElement { public: explicit QDuseDesignSpace(bool createQModelingObject = true); + virtual ~QDuseDesignSpace(); virtual QModelingElement *clone() const; diff --git a/src/duse/qdusemodelchange.cpp b/src/duse/qdusemodelchange.cpp index 91333624..ce859335 100644 --- a/src/duse/qdusemodelchange.cpp +++ b/src/duse/qdusemodelchange.cpp @@ -67,6 +67,14 @@ QDuseModelChange::QDuseModelChange(bool createQModelingObject) : _qModelingObject = qobject_cast(new QDuseModelChangeObject(this)); } +/*! + Destroys the QDuseModelChange. + */ +QDuseModelChange::~QDuseModelChange() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QDuseModelChange. */ @@ -77,8 +85,6 @@ QModelingElement *QDuseModelChange::clone() const c->setTargetSelectionRule(dynamic_cast(targetSelectionRule()->clone())); if (valueSelectionRule()) c->setValueSelectionRule(dynamic_cast(valueSelectionRule()->clone())); - if (targetProperty()) - c->setTargetProperty(dynamic_cast(targetProperty()->clone())); return c; } diff --git a/src/duse/qdusemodelchange.h b/src/duse/qdusemodelchange.h index 3cd7bf66..1352aaa5 100644 --- a/src/duse/qdusemodelchange.h +++ b/src/duse/qdusemodelchange.h @@ -56,6 +56,7 @@ class Q_DUSE_EXPORT QDuseModelChange : public QModelingElement { public: explicit QDuseModelChange(bool createQModelingObject = true); + virtual ~QDuseModelChange(); virtual QModelingElement *clone() const; diff --git a/src/duse/qdusequalitymetric.cpp b/src/duse/qdusequalitymetric.cpp index e3189a70..180d5812 100644 --- a/src/duse/qdusequalitymetric.cpp +++ b/src/duse/qdusequalitymetric.cpp @@ -64,6 +64,14 @@ QDuseQualityMetric::QDuseQualityMetric(bool createQModelingObject) : _qModelingObject = qobject_cast(new QDuseQualityMetricObject(this)); } +/*! + Destroys the QDuseQualityMetric. + */ +QDuseQualityMetric::~QDuseQualityMetric() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QDuseQualityMetric. */ diff --git a/src/duse/qdusequalitymetric.h b/src/duse/qdusequalitymetric.h index 21e6dab0..e07fcdf1 100644 --- a/src/duse/qdusequalitymetric.h +++ b/src/duse/qdusequalitymetric.h @@ -55,6 +55,7 @@ class Q_DUSE_EXPORT QDuseQualityMetric : public QModelingElement { public: explicit QDuseQualityMetric(bool createQModelingObject = true); + virtual ~QDuseQualityMetric(); virtual QModelingElement *clone() const; diff --git a/src/duse/qdusevariationpoint.cpp b/src/duse/qdusevariationpoint.cpp index 6335e600..278af18f 100644 --- a/src/duse/qdusevariationpoint.cpp +++ b/src/duse/qdusevariationpoint.cpp @@ -66,6 +66,14 @@ QDuseVariationPoint::QDuseVariationPoint(bool createQModelingObject) : _qModelingObject = qobject_cast(new QDuseVariationPointObject(this)); } +/*! + Destroys the QDuseVariationPoint. + */ +QDuseVariationPoint::~QDuseVariationPoint() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QDuseVariationPoint. */ @@ -78,8 +86,6 @@ QModelingElement *QDuseVariationPoint::clone() const c->setPreChangeValidationRule(dynamic_cast(preChangeValidationRule()->clone())); foreach (QDuseModelChange *element, modelChanges()) c->addModelChange(dynamic_cast(element->clone())); - foreach (QUmlElement *element, addedElements()) - c->addAddedElement(dynamic_cast(element->clone())); return c; } diff --git a/src/duse/qdusevariationpoint.h b/src/duse/qdusevariationpoint.h index 33536181..a6682416 100644 --- a/src/duse/qdusevariationpoint.h +++ b/src/duse/qdusevariationpoint.h @@ -57,6 +57,7 @@ class Q_DUSE_EXPORT QDuseVariationPoint : public QModelingElement { public: explicit QDuseVariationPoint(bool createQModelingObject = true); + virtual ~QDuseVariationPoint(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofargument.cpp b/src/mof/qmofargument.cpp index 75a1ad29..2d3a2702 100644 --- a/src/mof/qmofargument.cpp +++ b/src/mof/qmofargument.cpp @@ -53,12 +53,18 @@ QMofArgument::QMofArgument(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofArgumentObject(this)); } +/*! + Destroys the QMofArgument. + */ +QMofArgument::~QMofArgument() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofArgument::clone() const { QMofArgument *c = new QMofArgument; c->setName(name()); - if (value()) - c->setValue(dynamic_cast(value()->clone())); return c; } diff --git a/src/mof/qmofargument.h b/src/mof/qmofargument.h index 58dbd727..c909540f 100644 --- a/src/mof/qmofargument.h +++ b/src/mof/qmofargument.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofArgument : public QModelingElement { public: explicit QMofArgument(bool createQModelingObject = true); + virtual ~QMofArgument(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofassociation.cpp b/src/mof/qmofassociation.cpp index 0312fe0d..3c014f01 100644 --- a/src/mof/qmofassociation.cpp +++ b/src/mof/qmofassociation.cpp @@ -79,6 +79,14 @@ QMofAssociation::QMofAssociation(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofAssociationObject(this)); } +/*! + Destroys the QMofAssociation. + */ +QMofAssociation::~QMofAssociation() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofAssociation. */ @@ -89,8 +97,6 @@ QModelingElement *QMofAssociation::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (package()) - c->setPackage(dynamic_cast(package()->clone())); c->setLeaf(isLeaf()); foreach (QMofElementImport *element, elementImports()) c->addElementImport(dynamic_cast(element->clone())); @@ -102,13 +108,7 @@ QModelingElement *QMofAssociation::clone() const c->addGeneralization(dynamic_cast(element->clone())); c->setAbstract(isAbstract()); c->setFinalSpecialization(isFinalSpecialization()); - foreach (QMofClassifier *element, redefinedClassifiers()) - c->addRedefinedClassifier(dynamic_cast(element->clone())); c->setDerived(isDerived()); - foreach (QMofProperty *element, memberEnds()) - c->addMemberEnd(dynamic_cast(element->clone())); - foreach (QMofProperty *element, navigableOwnedEnds()) - c->addNavigableOwnedEnd(dynamic_cast(element->clone())); foreach (QMofProperty *element, ownedEnds()) c->addOwnedEnd(dynamic_cast(element->clone())); return c; diff --git a/src/mof/qmofassociation.h b/src/mof/qmofassociation.h index e7214399..299c98e0 100644 --- a/src/mof/qmofassociation.h +++ b/src/mof/qmofassociation.h @@ -57,6 +57,7 @@ class Q_MOF_EXPORT QMofAssociation : public QMofRelationship, public virtual QMo { public: explicit QMofAssociation(bool createQModelingObject = true); + virtual ~QMofAssociation(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofbehavioralfeature.cpp b/src/mof/qmofbehavioralfeature.cpp index 65008d09..5fa53bc7 100644 --- a/src/mof/qmofbehavioralfeature.cpp +++ b/src/mof/qmofbehavioralfeature.cpp @@ -72,6 +72,14 @@ QMofBehavioralFeature::QMofBehavioralFeature() { } +/*! + Destroys the QMofBehavioralFeature. + */ +QMofBehavioralFeature::~QMofBehavioralFeature() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofBehavioralFeature. */ @@ -92,8 +100,6 @@ QModelingElement *QMofBehavioralFeature::clone() const c->addPackageImport(dynamic_cast(element->clone())); foreach (QMofParameter *element, ownedParameters()) c->addOwnedParameter(dynamic_cast(element->clone())); - foreach (QMofType *element, raisedExceptions()) - c->addRaisedException(dynamic_cast(element->clone())); return c; } diff --git a/src/mof/qmofbehavioralfeature.h b/src/mof/qmofbehavioralfeature.h index 76942191..597d2855 100644 --- a/src/mof/qmofbehavioralfeature.h +++ b/src/mof/qmofbehavioralfeature.h @@ -57,6 +57,8 @@ class QMofType; class Q_MOF_EXPORT QMofBehavioralFeature : public QMofFeature, public QMofNamespace { public: + virtual ~QMofBehavioralFeature(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofclass.cpp b/src/mof/qmofclass.cpp index 84b16cab..2e806ebd 100644 --- a/src/mof/qmofclass.cpp +++ b/src/mof/qmofclass.cpp @@ -79,6 +79,14 @@ QMofClass::QMofClass(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofClassObject(this)); } +/*! + Destroys the QMofClass. + */ +QMofClass::~QMofClass() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofClass. */ @@ -89,8 +97,6 @@ QModelingElement *QMofClass::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (package()) - c->setPackage(dynamic_cast(package()->clone())); c->setLeaf(isLeaf()); foreach (QMofElementImport *element, elementImports()) c->addElementImport(dynamic_cast(element->clone())); @@ -101,8 +107,6 @@ QModelingElement *QMofClass::clone() const foreach (QMofGeneralization *element, generalizations()) c->addGeneralization(dynamic_cast(element->clone())); c->setFinalSpecialization(isFinalSpecialization()); - foreach (QMofClassifier *element, redefinedClassifiers()) - c->addRedefinedClassifier(dynamic_cast(element->clone())); c->setAbstract(isAbstract()); foreach (QMofClassifier *element, nestedClassifiers()) c->addNestedClassifier(dynamic_cast(element->clone())); diff --git a/src/mof/qmofclass.h b/src/mof/qmofclass.h index dcafdbbc..eaa306d6 100644 --- a/src/mof/qmofclass.h +++ b/src/mof/qmofclass.h @@ -57,6 +57,7 @@ class Q_MOF_EXPORT QMofClass : public QMofClassifier { public: explicit QMofClass(bool createQModelingObject = true); + virtual ~QMofClass(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofclassifier.cpp b/src/mof/qmofclassifier.cpp index 7390ec94..6a723605 100644 --- a/src/mof/qmofclassifier.cpp +++ b/src/mof/qmofclassifier.cpp @@ -75,6 +75,14 @@ QMofClassifier::QMofClassifier() : { } +/*! + Destroys the QMofClassifier. + */ +QMofClassifier::~QMofClassifier() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofClassifier. */ @@ -85,8 +93,6 @@ QModelingElement *QMofClassifier::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (package()) - c->setPackage(dynamic_cast(package()->clone())); c->setLeaf(isLeaf()); foreach (QMofElementImport *element, elementImports()) c->addElementImport(dynamic_cast(element->clone())); @@ -98,8 +104,6 @@ QModelingElement *QMofClassifier::clone() const c->addGeneralization(dynamic_cast(element->clone())); c->setAbstract(isAbstract()); c->setFinalSpecialization(isFinalSpecialization()); - foreach (QMofClassifier *element, redefinedClassifiers()) - c->addRedefinedClassifier(dynamic_cast(element->clone())); return c; } diff --git a/src/mof/qmofclassifier.h b/src/mof/qmofclassifier.h index a35f47e2..33567b0b 100644 --- a/src/mof/qmofclassifier.h +++ b/src/mof/qmofclassifier.h @@ -59,6 +59,8 @@ class QMofProperty; class Q_MOF_EXPORT QMofClassifier : public QMofType, public QMofRedefinableElement, public QMofNamespace { public: + virtual ~QMofClassifier(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofcomment.cpp b/src/mof/qmofcomment.cpp index 513c8cfc..43298a0f 100644 --- a/src/mof/qmofcomment.cpp +++ b/src/mof/qmofcomment.cpp @@ -63,6 +63,14 @@ QMofComment::QMofComment(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofCommentObject(this)); } +/*! + Destroys the QMofComment. + */ +QMofComment::~QMofComment() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofComment. */ @@ -71,8 +79,6 @@ QModelingElement *QMofComment::clone() const QMofComment *c = new QMofComment; foreach (QMofComment *element, ownedComments()) c->addOwnedComment(dynamic_cast(element->clone())); - foreach (QMofElement *element, annotatedElements()) - c->addAnnotatedElement(dynamic_cast(element->clone())); c->setBody(body()); return c; } diff --git a/src/mof/qmofcomment.h b/src/mof/qmofcomment.h index a9281413..c33c0520 100644 --- a/src/mof/qmofcomment.h +++ b/src/mof/qmofcomment.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofComment : public QMofElement { public: explicit QMofComment(bool createQModelingObject = true); + virtual ~QMofComment(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofconstraint.cpp b/src/mof/qmofconstraint.cpp index ec10e079..8b5660ff 100644 --- a/src/mof/qmofconstraint.cpp +++ b/src/mof/qmofconstraint.cpp @@ -70,6 +70,14 @@ QMofConstraint::QMofConstraint(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofConstraintObject(this)); } +/*! + Destroys the QMofConstraint. + */ +QMofConstraint::~QMofConstraint() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofConstraint. */ @@ -80,10 +88,6 @@ QModelingElement *QMofConstraint::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - foreach (QMofElement *element, constrainedElements()) - c->addConstrainedElement(dynamic_cast(element->clone())); - if (context()) - c->setContext(dynamic_cast(context()->clone())); if (specification()) c->setSpecification(dynamic_cast(specification()->clone())); return c; diff --git a/src/mof/qmofconstraint.h b/src/mof/qmofconstraint.h index 21e90605..7d0953cc 100644 --- a/src/mof/qmofconstraint.h +++ b/src/mof/qmofconstraint.h @@ -57,6 +57,7 @@ class Q_MOF_EXPORT QMofConstraint : public QMofPackageableElement { public: explicit QMofConstraint(bool createQModelingObject = true); + virtual ~QMofConstraint(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofdatatype.cpp b/src/mof/qmofdatatype.cpp index 58345801..f2751934 100644 --- a/src/mof/qmofdatatype.cpp +++ b/src/mof/qmofdatatype.cpp @@ -79,6 +79,14 @@ QMofDataType::QMofDataType(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofDataTypeObject(this)); } +/*! + Destroys the QMofDataType. + */ +QMofDataType::~QMofDataType() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofDataType. */ @@ -89,8 +97,6 @@ QModelingElement *QMofDataType::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (package()) - c->setPackage(dynamic_cast(package()->clone())); c->setLeaf(isLeaf()); foreach (QMofElementImport *element, elementImports()) c->addElementImport(dynamic_cast(element->clone())); @@ -102,8 +108,6 @@ QModelingElement *QMofDataType::clone() const c->addGeneralization(dynamic_cast(element->clone())); c->setAbstract(isAbstract()); c->setFinalSpecialization(isFinalSpecialization()); - foreach (QMofClassifier *element, redefinedClassifiers()) - c->addRedefinedClassifier(dynamic_cast(element->clone())); foreach (QMofProperty *element, ownedAttributes()) c->addOwnedAttribute(dynamic_cast(element->clone())); foreach (QMofOperation *element, ownedOperations()) diff --git a/src/mof/qmofdatatype.h b/src/mof/qmofdatatype.h index 47c84d93..22847e0f 100644 --- a/src/mof/qmofdatatype.h +++ b/src/mof/qmofdatatype.h @@ -57,6 +57,7 @@ class Q_MOF_EXPORT QMofDataType : public QMofClassifier { public: explicit QMofDataType(bool createQModelingObject = true); + virtual ~QMofDataType(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofdirectedrelationship.cpp b/src/mof/qmofdirectedrelationship.cpp index 42935a4b..bb83a245 100644 --- a/src/mof/qmofdirectedrelationship.cpp +++ b/src/mof/qmofdirectedrelationship.cpp @@ -63,6 +63,14 @@ QMofDirectedRelationship::QMofDirectedRelationship() { } +/*! + Destroys the QMofDirectedRelationship. + */ +QMofDirectedRelationship::~QMofDirectedRelationship() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofDirectedRelationship. */ diff --git a/src/mof/qmofdirectedrelationship.h b/src/mof/qmofdirectedrelationship.h index d442e89f..2571fbfd 100644 --- a/src/mof/qmofdirectedrelationship.h +++ b/src/mof/qmofdirectedrelationship.h @@ -54,6 +54,8 @@ class QMofElement; class Q_MOF_EXPORT QMofDirectedRelationship : public QMofRelationship { public: + virtual ~QMofDirectedRelationship(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofelement.cpp b/src/mof/qmofelement.cpp index 3ff9bf68..d87dbc43 100644 --- a/src/mof/qmofelement.cpp +++ b/src/mof/qmofelement.cpp @@ -64,6 +64,14 @@ QMofElement::QMofElement() : { } +/*! + Destroys the QMofElement. + */ +QMofElement::~QMofElement() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofElement. */ diff --git a/src/mof/qmofelement.h b/src/mof/qmofelement.h index 20e1289d..a358bebb 100644 --- a/src/mof/qmofelement.h +++ b/src/mof/qmofelement.h @@ -55,6 +55,8 @@ class QMofComment; class Q_MOF_EXPORT QMofElement : public QMofObject { public: + virtual ~QMofElement(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofelementimport.cpp b/src/mof/qmofelementimport.cpp index 2bd81b1c..6794db0f 100644 --- a/src/mof/qmofelementimport.cpp +++ b/src/mof/qmofelementimport.cpp @@ -70,6 +70,14 @@ QMofElementImport::QMofElementImport(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofElementImportObject(this)); } +/*! + Destroys the QMofElementImport. + */ +QMofElementImport::~QMofElementImport() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofElementImport. */ @@ -79,10 +87,6 @@ QModelingElement *QMofElementImport::clone() const foreach (QMofComment *element, ownedComments()) c->addOwnedComment(dynamic_cast(element->clone())); c->setAlias(alias()); - if (importedElement()) - c->setImportedElement(dynamic_cast(importedElement()->clone())); - if (importingNamespace()) - c->setImportingNamespace(dynamic_cast(importingNamespace()->clone())); c->setVisibility(visibility()); return c; } diff --git a/src/mof/qmofelementimport.h b/src/mof/qmofelementimport.h index 3f8d67f5..e0fabb44 100644 --- a/src/mof/qmofelementimport.h +++ b/src/mof/qmofelementimport.h @@ -58,6 +58,7 @@ class Q_MOF_EXPORT QMofElementImport : public QMofDirectedRelationship { public: explicit QMofElementImport(bool createQModelingObject = true); + virtual ~QMofElementImport(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofenumeration.cpp b/src/mof/qmofenumeration.cpp index ea5bbbc6..c8f89d86 100644 --- a/src/mof/qmofenumeration.cpp +++ b/src/mof/qmofenumeration.cpp @@ -82,6 +82,14 @@ QMofEnumeration::QMofEnumeration(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofEnumerationObject(this)); } +/*! + Destroys the QMofEnumeration. + */ +QMofEnumeration::~QMofEnumeration() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofEnumeration. */ @@ -92,8 +100,6 @@ QModelingElement *QMofEnumeration::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (package()) - c->setPackage(dynamic_cast(package()->clone())); c->setLeaf(isLeaf()); foreach (QMofElementImport *element, elementImports()) c->addElementImport(dynamic_cast(element->clone())); @@ -105,8 +111,6 @@ QModelingElement *QMofEnumeration::clone() const c->addGeneralization(dynamic_cast(element->clone())); c->setAbstract(isAbstract()); c->setFinalSpecialization(isFinalSpecialization()); - foreach (QMofClassifier *element, redefinedClassifiers()) - c->addRedefinedClassifier(dynamic_cast(element->clone())); foreach (QMofProperty *element, ownedAttributes()) c->addOwnedAttribute(dynamic_cast(element->clone())); foreach (QMofOperation *element, ownedOperations()) diff --git a/src/mof/qmofenumeration.h b/src/mof/qmofenumeration.h index d7a498bf..43eadb9d 100644 --- a/src/mof/qmofenumeration.h +++ b/src/mof/qmofenumeration.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofEnumeration : public QMofDataType { public: explicit QMofEnumeration(bool createQModelingObject = true); + virtual ~QMofEnumeration(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofenumerationliteral.cpp b/src/mof/qmofenumerationliteral.cpp index f7071bfa..505a1b2e 100644 --- a/src/mof/qmofenumerationliteral.cpp +++ b/src/mof/qmofenumerationliteral.cpp @@ -73,6 +73,14 @@ QMofEnumerationLiteral::QMofEnumerationLiteral(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofEnumerationLiteralObject(this)); } +/*! + Destroys the QMofEnumerationLiteral. + */ +QMofEnumerationLiteral::~QMofEnumerationLiteral() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofEnumerationLiteral. */ @@ -87,8 +95,6 @@ QModelingElement *QMofEnumerationLiteral::clone() const c->addSlot(dynamic_cast(element->clone())); if (specification()) c->setSpecification(dynamic_cast(specification()->clone())); - if (enumeration()) - c->setEnumeration(dynamic_cast(enumeration()->clone())); return c; } diff --git a/src/mof/qmofenumerationliteral.h b/src/mof/qmofenumerationliteral.h index a49a7143..e4907e65 100644 --- a/src/mof/qmofenumerationliteral.h +++ b/src/mof/qmofenumerationliteral.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofEnumerationLiteral : public QMofInstanceSpecification { public: explicit QMofEnumerationLiteral(bool createQModelingObject = true); + virtual ~QMofEnumerationLiteral(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofexception.cpp b/src/mof/qmofexception.cpp index fa4b990a..720f7015 100644 --- a/src/mof/qmofexception.cpp +++ b/src/mof/qmofexception.cpp @@ -54,13 +54,17 @@ QMofException::QMofException(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofExceptionObject(this)); } +/*! + Destroys the QMofException. + */ +QMofException::~QMofException() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofException::clone() const { QMofException *c = new QMofException; - if (objectInError()) - c->setObjectInError(dynamic_cast(objectInError()->clone())); - if (elementInError()) - c->setElementInError(dynamic_cast(elementInError()->clone())); c->setDescription(description()); return c; } diff --git a/src/mof/qmofexception.h b/src/mof/qmofexception.h index aa4e03a4..86b2c83b 100644 --- a/src/mof/qmofexception.h +++ b/src/mof/qmofexception.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofException : public QModelingElement { public: explicit QMofException(bool createQModelingObject = true); + virtual ~QMofException(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofexpression.cpp b/src/mof/qmofexpression.cpp index b1c90f98..97a62089 100644 --- a/src/mof/qmofexpression.cpp +++ b/src/mof/qmofexpression.cpp @@ -68,6 +68,14 @@ QMofExpression::QMofExpression(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofExpressionObject(this)); } +/*! + Destroys the QMofExpression. + */ +QMofExpression::~QMofExpression() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofExpression. */ @@ -78,8 +86,6 @@ QModelingElement *QMofExpression::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); foreach (QMofValueSpecification *element, operands()) c->addOperand(dynamic_cast(element->clone())); c->setSymbol(symbol()); diff --git a/src/mof/qmofexpression.h b/src/mof/qmofexpression.h index f9f1a1f1..4c87bba0 100644 --- a/src/mof/qmofexpression.h +++ b/src/mof/qmofexpression.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofExpression : public QMofValueSpecification { public: explicit QMofExpression(bool createQModelingObject = true); + virtual ~QMofExpression(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofextent.cpp b/src/mof/qmofextent.cpp index 275d0df3..ecf99e43 100644 --- a/src/mof/qmofextent.cpp +++ b/src/mof/qmofextent.cpp @@ -57,6 +57,14 @@ QMofExtent::QMofExtent(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofExtentObject(this)); } +/*! + Destroys the QMofExtent. + */ +QMofExtent::~QMofExtent() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofExtent::clone() const { QMofExtent *c = new QMofExtent; diff --git a/src/mof/qmofextent.h b/src/mof/qmofextent.h index 37250bea..a7f600cc 100644 --- a/src/mof/qmofextent.h +++ b/src/mof/qmofextent.h @@ -59,6 +59,7 @@ class Q_MOF_EXPORT QMofExtent : public QMofObject { public: explicit QMofExtent(bool createQModelingObject = true); + virtual ~QMofExtent(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmoffactory.cpp b/src/mof/qmoffactory.cpp index c7dea8d9..a0253ea4 100644 --- a/src/mof/qmoffactory.cpp +++ b/src/mof/qmoffactory.cpp @@ -59,11 +59,17 @@ QMofFactory::QMofFactory(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofFactoryObject(this)); } +/*! + Destroys the QMofFactory. + */ +QMofFactory::~QMofFactory() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofFactory::clone() const { QMofFactory *c = new QMofFactory; - if (package()) - c->setPackage(dynamic_cast(package()->clone())); return c; } diff --git a/src/mof/qmoffactory.h b/src/mof/qmoffactory.h index cc118001..2b7ea4b9 100644 --- a/src/mof/qmoffactory.h +++ b/src/mof/qmoffactory.h @@ -61,6 +61,7 @@ class Q_MOF_EXPORT QMofFactory : public QMofElement { public: explicit QMofFactory(bool createQModelingObject = true); + virtual ~QMofFactory(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmoffeature.cpp b/src/mof/qmoffeature.cpp index 5ac824a4..3c47b9f4 100644 --- a/src/mof/qmoffeature.cpp +++ b/src/mof/qmoffeature.cpp @@ -67,6 +67,14 @@ QMofFeature::QMofFeature() : { } +/*! + Destroys the QMofFeature. + */ +QMofFeature::~QMofFeature() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofFeature. */ diff --git a/src/mof/qmoffeature.h b/src/mof/qmoffeature.h index 7c683ddc..1d5e5c16 100644 --- a/src/mof/qmoffeature.h +++ b/src/mof/qmoffeature.h @@ -54,6 +54,8 @@ class QMofClassifier; class Q_MOF_EXPORT QMofFeature : public QMofRedefinableElement { public: + virtual ~QMofFeature(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofgeneralization.cpp b/src/mof/qmofgeneralization.cpp index dedfdb7a..eaefea25 100644 --- a/src/mof/qmofgeneralization.cpp +++ b/src/mof/qmofgeneralization.cpp @@ -69,6 +69,14 @@ QMofGeneralization::QMofGeneralization(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofGeneralizationObject(this)); } +/*! + Destroys the QMofGeneralization. + */ +QMofGeneralization::~QMofGeneralization() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofGeneralization. */ @@ -77,11 +85,7 @@ QModelingElement *QMofGeneralization::clone() const QMofGeneralization *c = new QMofGeneralization; foreach (QMofComment *element, ownedComments()) c->addOwnedComment(dynamic_cast(element->clone())); - if (general()) - c->setGeneral(dynamic_cast(general()->clone())); c->setSubstitutable(isSubstitutable()); - if (specific()) - c->setSpecific(dynamic_cast(specific()->clone())); return c; } diff --git a/src/mof/qmofgeneralization.h b/src/mof/qmofgeneralization.h index 9198e750..8f9ba12b 100644 --- a/src/mof/qmofgeneralization.h +++ b/src/mof/qmofgeneralization.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofGeneralization : public QMofDirectedRelationship { public: explicit QMofGeneralization(bool createQModelingObject = true); + virtual ~QMofGeneralization(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofinstancespecification.cpp b/src/mof/qmofinstancespecification.cpp index 847d72bc..f2e100b7 100644 --- a/src/mof/qmofinstancespecification.cpp +++ b/src/mof/qmofinstancespecification.cpp @@ -71,6 +71,14 @@ QMofInstanceSpecification::QMofInstanceSpecification(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofInstanceSpecificationObject(this)); } +/*! + Destroys the QMofInstanceSpecification. + */ +QMofInstanceSpecification::~QMofInstanceSpecification() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofInstanceSpecification. */ @@ -81,8 +89,6 @@ QModelingElement *QMofInstanceSpecification::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - foreach (QMofClassifier *element, classifiers()) - c->addClassifier(dynamic_cast(element->clone())); foreach (QMofSlot *element, slots_()) c->addSlot(dynamic_cast(element->clone())); if (specification()) diff --git a/src/mof/qmofinstancespecification.h b/src/mof/qmofinstancespecification.h index f8256bc6..8793752b 100644 --- a/src/mof/qmofinstancespecification.h +++ b/src/mof/qmofinstancespecification.h @@ -57,6 +57,7 @@ class Q_MOF_EXPORT QMofInstanceSpecification : public QMofPackageableElement { public: explicit QMofInstanceSpecification(bool createQModelingObject = true); + virtual ~QMofInstanceSpecification(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofinstancevalue.cpp b/src/mof/qmofinstancevalue.cpp index c63f5291..5c8d8857 100644 --- a/src/mof/qmofinstancevalue.cpp +++ b/src/mof/qmofinstancevalue.cpp @@ -70,6 +70,14 @@ QMofInstanceValue::QMofInstanceValue(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofInstanceValueObject(this)); } +/*! + Destroys the QMofInstanceValue. + */ +QMofInstanceValue::~QMofInstanceValue() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofInstanceValue. */ @@ -80,10 +88,6 @@ QModelingElement *QMofInstanceValue::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); - if (instance()) - c->setInstance(dynamic_cast(instance()->clone())); return c; } diff --git a/src/mof/qmofinstancevalue.h b/src/mof/qmofinstancevalue.h index 99f55a71..f15ae709 100644 --- a/src/mof/qmofinstancevalue.h +++ b/src/mof/qmofinstancevalue.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofInstanceValue : public QMofValueSpecification { public: explicit QMofInstanceValue(bool createQModelingObject = true); + virtual ~QMofInstanceValue(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmoflink.cpp b/src/mof/qmoflink.cpp index bd75558b..86b45fa5 100644 --- a/src/mof/qmoflink.cpp +++ b/src/mof/qmoflink.cpp @@ -57,15 +57,17 @@ QMofLink::QMofLink(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofLinkObject(this)); } +/*! + Destroys the QMofLink. + */ +QMofLink::~QMofLink() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofLink::clone() const { QMofLink *c = new QMofLink; - if (firstElement()) - c->setFirstElement(dynamic_cast(firstElement()->clone())); - if (secondElement()) - c->setSecondElement(dynamic_cast(secondElement()->clone())); - if (association()) - c->setAssociation(dynamic_cast(association()->clone())); return c; } diff --git a/src/mof/qmoflink.h b/src/mof/qmoflink.h index 6c06b1a6..70bdb44e 100644 --- a/src/mof/qmoflink.h +++ b/src/mof/qmoflink.h @@ -56,6 +56,7 @@ class Q_MOF_EXPORT QMofLink : public QMofObject { public: explicit QMofLink(bool createQModelingObject = true); + virtual ~QMofLink(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofliteralboolean.cpp b/src/mof/qmofliteralboolean.cpp index 91709c6a..51a08cf5 100644 --- a/src/mof/qmofliteralboolean.cpp +++ b/src/mof/qmofliteralboolean.cpp @@ -69,6 +69,14 @@ QMofLiteralBoolean::QMofLiteralBoolean(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofLiteralBooleanObject(this)); } +/*! + Destroys the QMofLiteralBoolean. + */ +QMofLiteralBoolean::~QMofLiteralBoolean() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofLiteralBoolean. */ @@ -79,8 +87,6 @@ QModelingElement *QMofLiteralBoolean::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); c->setValue(value()); return c; } diff --git a/src/mof/qmofliteralboolean.h b/src/mof/qmofliteralboolean.h index 28e91337..a67567fc 100644 --- a/src/mof/qmofliteralboolean.h +++ b/src/mof/qmofliteralboolean.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofLiteralBoolean : public QMofLiteralSpecification { public: explicit QMofLiteralBoolean(bool createQModelingObject = true); + virtual ~QMofLiteralBoolean(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofliteralinteger.cpp b/src/mof/qmofliteralinteger.cpp index 3702c0ea..3d40f4c4 100644 --- a/src/mof/qmofliteralinteger.cpp +++ b/src/mof/qmofliteralinteger.cpp @@ -69,6 +69,14 @@ QMofLiteralInteger::QMofLiteralInteger(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofLiteralIntegerObject(this)); } +/*! + Destroys the QMofLiteralInteger. + */ +QMofLiteralInteger::~QMofLiteralInteger() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofLiteralInteger. */ @@ -79,8 +87,6 @@ QModelingElement *QMofLiteralInteger::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); c->setValue(value()); return c; } diff --git a/src/mof/qmofliteralinteger.h b/src/mof/qmofliteralinteger.h index dd38443b..f10897aa 100644 --- a/src/mof/qmofliteralinteger.h +++ b/src/mof/qmofliteralinteger.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofLiteralInteger : public QMofLiteralSpecification { public: explicit QMofLiteralInteger(bool createQModelingObject = true); + virtual ~QMofLiteralInteger(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofliteralnull.cpp b/src/mof/qmofliteralnull.cpp index 0bf2f69f..62a90a1a 100644 --- a/src/mof/qmofliteralnull.cpp +++ b/src/mof/qmofliteralnull.cpp @@ -68,6 +68,14 @@ QMofLiteralNull::QMofLiteralNull(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofLiteralNullObject(this)); } +/*! + Destroys the QMofLiteralNull. + */ +QMofLiteralNull::~QMofLiteralNull() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofLiteralNull. */ @@ -78,8 +86,6 @@ QModelingElement *QMofLiteralNull::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); return c; } diff --git a/src/mof/qmofliteralnull.h b/src/mof/qmofliteralnull.h index f8916377..e261311d 100644 --- a/src/mof/qmofliteralnull.h +++ b/src/mof/qmofliteralnull.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofLiteralNull : public QMofLiteralSpecification { public: explicit QMofLiteralNull(bool createQModelingObject = true); + virtual ~QMofLiteralNull(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofliteralreal.cpp b/src/mof/qmofliteralreal.cpp index ef90a29b..61a1644b 100644 --- a/src/mof/qmofliteralreal.cpp +++ b/src/mof/qmofliteralreal.cpp @@ -68,6 +68,14 @@ QMofLiteralReal::QMofLiteralReal(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofLiteralRealObject(this)); } +/*! + Destroys the QMofLiteralReal. + */ +QMofLiteralReal::~QMofLiteralReal() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofLiteralReal. */ @@ -78,8 +86,6 @@ QModelingElement *QMofLiteralReal::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); c->setValue(value()); return c; } diff --git a/src/mof/qmofliteralreal.h b/src/mof/qmofliteralreal.h index 3fb88179..1ad13e57 100644 --- a/src/mof/qmofliteralreal.h +++ b/src/mof/qmofliteralreal.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofLiteralReal : public QMofLiteralSpecification { public: explicit QMofLiteralReal(bool createQModelingObject = true); + virtual ~QMofLiteralReal(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofliteralspecification.cpp b/src/mof/qmofliteralspecification.cpp index 17b51f38..4e2d115b 100644 --- a/src/mof/qmofliteralspecification.cpp +++ b/src/mof/qmofliteralspecification.cpp @@ -66,6 +66,14 @@ QMofLiteralSpecification::QMofLiteralSpecification() { } +/*! + Destroys the QMofLiteralSpecification. + */ +QMofLiteralSpecification::~QMofLiteralSpecification() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofLiteralSpecification. */ @@ -76,8 +84,6 @@ QModelingElement *QMofLiteralSpecification::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); return c; } diff --git a/src/mof/qmofliteralspecification.h b/src/mof/qmofliteralspecification.h index 4cdd3137..94f5bec3 100644 --- a/src/mof/qmofliteralspecification.h +++ b/src/mof/qmofliteralspecification.h @@ -52,6 +52,8 @@ QT_MODULE(QtMof) class Q_MOF_EXPORT QMofLiteralSpecification : public QMofValueSpecification { public: + virtual ~QMofLiteralSpecification(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; diff --git a/src/mof/qmofliteralstring.cpp b/src/mof/qmofliteralstring.cpp index 05b257be..3fce6d94 100644 --- a/src/mof/qmofliteralstring.cpp +++ b/src/mof/qmofliteralstring.cpp @@ -68,6 +68,14 @@ QMofLiteralString::QMofLiteralString(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofLiteralStringObject(this)); } +/*! + Destroys the QMofLiteralString. + */ +QMofLiteralString::~QMofLiteralString() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofLiteralString. */ @@ -78,8 +86,6 @@ QModelingElement *QMofLiteralString::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); c->setValue(value()); return c; } diff --git a/src/mof/qmofliteralstring.h b/src/mof/qmofliteralstring.h index 527f0972..94d4b9e1 100644 --- a/src/mof/qmofliteralstring.h +++ b/src/mof/qmofliteralstring.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofLiteralString : public QMofLiteralSpecification { public: explicit QMofLiteralString(bool createQModelingObject = true); + virtual ~QMofLiteralString(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofliteralunlimitednatural.cpp b/src/mof/qmofliteralunlimitednatural.cpp index 4408bae7..c1786e00 100644 --- a/src/mof/qmofliteralunlimitednatural.cpp +++ b/src/mof/qmofliteralunlimitednatural.cpp @@ -68,6 +68,14 @@ QMofLiteralUnlimitedNatural::QMofLiteralUnlimitedNatural(bool createQModelingObj _qModelingObject = qobject_cast(new QMofLiteralUnlimitedNaturalObject(this)); } +/*! + Destroys the QMofLiteralUnlimitedNatural. + */ +QMofLiteralUnlimitedNatural::~QMofLiteralUnlimitedNatural() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofLiteralUnlimitedNatural. */ @@ -78,8 +86,6 @@ QModelingElement *QMofLiteralUnlimitedNatural::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); c->setValue(value()); return c; } diff --git a/src/mof/qmofliteralunlimitednatural.h b/src/mof/qmofliteralunlimitednatural.h index 9fe66e69..32ee82bb 100644 --- a/src/mof/qmofliteralunlimitednatural.h +++ b/src/mof/qmofliteralunlimitednatural.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofLiteralUnlimitedNatural : public QMofLiteralSpecification { public: explicit QMofLiteralUnlimitedNatural(bool createQModelingObject = true); + virtual ~QMofLiteralUnlimitedNatural(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofmultiplicityelement.cpp b/src/mof/qmofmultiplicityelement.cpp index f93bddae..4481a374 100644 --- a/src/mof/qmofmultiplicityelement.cpp +++ b/src/mof/qmofmultiplicityelement.cpp @@ -67,6 +67,14 @@ QMofMultiplicityElement::QMofMultiplicityElement() : { } +/*! + Destroys the QMofMultiplicityElement. + */ +QMofMultiplicityElement::~QMofMultiplicityElement() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofMultiplicityElement. */ diff --git a/src/mof/qmofmultiplicityelement.h b/src/mof/qmofmultiplicityelement.h index 8ed4f598..2a5e2b70 100644 --- a/src/mof/qmofmultiplicityelement.h +++ b/src/mof/qmofmultiplicityelement.h @@ -54,6 +54,8 @@ class QMofValueSpecification; class Q_MOF_EXPORT QMofMultiplicityElement : public virtual QMofElement { public: + virtual ~QMofMultiplicityElement(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofnamedelement.cpp b/src/mof/qmofnamedelement.cpp index 07a66529..2513bdc5 100644 --- a/src/mof/qmofnamedelement.cpp +++ b/src/mof/qmofnamedelement.cpp @@ -65,6 +65,14 @@ QMofNamedElement::QMofNamedElement() : { } +/*! + Destroys the QMofNamedElement. + */ +QMofNamedElement::~QMofNamedElement() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofNamedElement. */ diff --git a/src/mof/qmofnamedelement.h b/src/mof/qmofnamedelement.h index aab155b7..68b04244 100644 --- a/src/mof/qmofnamedelement.h +++ b/src/mof/qmofnamedelement.h @@ -56,6 +56,8 @@ class QMofNamespace; class Q_MOF_EXPORT QMofNamedElement : public virtual QMofElement { public: + virtual ~QMofNamedElement(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofnamespace.cpp b/src/mof/qmofnamespace.cpp index c2dfe0bc..3a7fa758 100644 --- a/src/mof/qmofnamespace.cpp +++ b/src/mof/qmofnamespace.cpp @@ -69,6 +69,14 @@ QMofNamespace::QMofNamespace() { } +/*! + Destroys the QMofNamespace. + */ +QMofNamespace::~QMofNamespace() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofNamespace. */ diff --git a/src/mof/qmofnamespace.h b/src/mof/qmofnamespace.h index ce83270e..fb2bbd2f 100644 --- a/src/mof/qmofnamespace.h +++ b/src/mof/qmofnamespace.h @@ -57,6 +57,8 @@ class QMofPackageImport; class Q_MOF_EXPORT QMofNamespace : public virtual QMofNamedElement { public: + virtual ~QMofNamespace(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofobject.cpp b/src/mof/qmofobject.cpp index c4086b47..159c7636 100644 --- a/src/mof/qmofobject.cpp +++ b/src/mof/qmofobject.cpp @@ -54,6 +54,14 @@ QMofObject::QMofObject(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofObjectObject(this)); } +/*! + Destroys the QMofObject. + */ +QMofObject::~QMofObject() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofObject::clone() const { QMofObject *c = new QMofObject; diff --git a/src/mof/qmofobject.h b/src/mof/qmofobject.h index f3c57fbd..c2b9c9d3 100644 --- a/src/mof/qmofobject.h +++ b/src/mof/qmofobject.h @@ -57,6 +57,7 @@ class Q_MOF_EXPORT QMofObject : public QModelingElement { public: explicit QMofObject(bool createQModelingObject = true); + virtual ~QMofObject(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofopaqueexpression.cpp b/src/mof/qmofopaqueexpression.cpp index 3a9097f9..5c262dd5 100644 --- a/src/mof/qmofopaqueexpression.cpp +++ b/src/mof/qmofopaqueexpression.cpp @@ -68,6 +68,14 @@ QMofOpaqueExpression::QMofOpaqueExpression(bool createQModelingObject) _qModelingObject = qobject_cast(new QMofOpaqueExpressionObject(this)); } +/*! + Destroys the QMofOpaqueExpression. + */ +QMofOpaqueExpression::~QMofOpaqueExpression() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofOpaqueExpression. */ @@ -78,8 +86,6 @@ QModelingElement *QMofOpaqueExpression::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); foreach (QString element, bodies()) c->addBody(element); foreach (QString element, languages()) diff --git a/src/mof/qmofopaqueexpression.h b/src/mof/qmofopaqueexpression.h index 5f4bb7b9..e60b9bee 100644 --- a/src/mof/qmofopaqueexpression.h +++ b/src/mof/qmofopaqueexpression.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofOpaqueExpression : public QMofValueSpecification { public: explicit QMofOpaqueExpression(bool createQModelingObject = true); + virtual ~QMofOpaqueExpression(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofoperation.cpp b/src/mof/qmofoperation.cpp index e714b994..872d6266 100644 --- a/src/mof/qmofoperation.cpp +++ b/src/mof/qmofoperation.cpp @@ -80,6 +80,14 @@ QMofOperation::QMofOperation(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofOperationObject(this)); } +/*! + Destroys the QMofOperation. + */ +QMofOperation::~QMofOperation() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofOperation. */ @@ -100,10 +108,6 @@ QModelingElement *QMofOperation::clone() const c->addPackageImport(dynamic_cast(element->clone())); if (bodyCondition()) c->setBodyCondition(dynamic_cast(bodyCondition()->clone())); - if (class_()) - c->setClass(dynamic_cast(class_()->clone())); - if (datatype()) - c->setDatatype(dynamic_cast(datatype()->clone())); c->setQuery(isQuery()); foreach (QMofParameter *element, ownedParameters()) c->addOwnedParameter(dynamic_cast(element->clone())); @@ -111,10 +115,6 @@ QModelingElement *QMofOperation::clone() const c->addPostcondition(dynamic_cast(element->clone())); foreach (QMofConstraint *element, preconditions()) c->addPrecondition(dynamic_cast(element->clone())); - foreach (QMofType *element, raisedExceptions()) - c->addRaisedException(dynamic_cast(element->clone())); - foreach (QMofOperation *element, redefinedOperations()) - c->addRedefinedOperation(dynamic_cast(element->clone())); return c; } diff --git a/src/mof/qmofoperation.h b/src/mof/qmofoperation.h index 71548022..a6699fd9 100644 --- a/src/mof/qmofoperation.h +++ b/src/mof/qmofoperation.h @@ -60,6 +60,7 @@ class Q_MOF_EXPORT QMofOperation : public QMofBehavioralFeature { public: explicit QMofOperation(bool createQModelingObject = true); + virtual ~QMofOperation(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofpackage.cpp b/src/mof/qmofpackage.cpp index 9704e347..4c6a9881 100644 --- a/src/mof/qmofpackage.cpp +++ b/src/mof/qmofpackage.cpp @@ -72,6 +72,14 @@ QMofPackage::QMofPackage(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofPackageObject(this)); } +/*! + Destroys the QMofPackage. + */ +QMofPackage::~QMofPackage() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofPackage. */ @@ -89,8 +97,6 @@ QModelingElement *QMofPackage::clone() const c->addPackageImport(dynamic_cast(element->clone())); c->setVisibility(visibility()); c->setURI(URI()); - if (nestingPackage()) - c->setNestingPackage(dynamic_cast(nestingPackage()->clone())); foreach (QMofPackageMerge *element, packageMerges()) c->addPackageMerge(dynamic_cast(element->clone())); foreach (QMofPackageableElement *element, packagedElements()) diff --git a/src/mof/qmofpackage.h b/src/mof/qmofpackage.h index d39fa266..eda7fb16 100644 --- a/src/mof/qmofpackage.h +++ b/src/mof/qmofpackage.h @@ -58,6 +58,7 @@ class Q_MOF_EXPORT QMofPackage : public QMofNamespace, public QMofPackageableEle { public: explicit QMofPackage(bool createQModelingObject = true); + virtual ~QMofPackage(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofpackageableelement.cpp b/src/mof/qmofpackageableelement.cpp index 9b576556..56de008a 100644 --- a/src/mof/qmofpackageableelement.cpp +++ b/src/mof/qmofpackageableelement.cpp @@ -65,6 +65,14 @@ QMofPackageableElement::QMofPackageableElement() : { } +/*! + Destroys the QMofPackageableElement. + */ +QMofPackageableElement::~QMofPackageableElement() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofPackageableElement. */ diff --git a/src/mof/qmofpackageableelement.h b/src/mof/qmofpackageableelement.h index 5f98bdf0..f0c8680b 100644 --- a/src/mof/qmofpackageableelement.h +++ b/src/mof/qmofpackageableelement.h @@ -54,6 +54,8 @@ QT_MODULE(QtMof) class Q_MOF_EXPORT QMofPackageableElement : public virtual QMofNamedElement { public: + virtual ~QMofPackageableElement(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofpackageimport.cpp b/src/mof/qmofpackageimport.cpp index d0fee64e..7d33cb49 100644 --- a/src/mof/qmofpackageimport.cpp +++ b/src/mof/qmofpackageimport.cpp @@ -70,6 +70,14 @@ QMofPackageImport::QMofPackageImport(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofPackageImportObject(this)); } +/*! + Destroys the QMofPackageImport. + */ +QMofPackageImport::~QMofPackageImport() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofPackageImport. */ @@ -78,10 +86,6 @@ QModelingElement *QMofPackageImport::clone() const QMofPackageImport *c = new QMofPackageImport; foreach (QMofComment *element, ownedComments()) c->addOwnedComment(dynamic_cast(element->clone())); - if (importedPackage()) - c->setImportedPackage(dynamic_cast(importedPackage()->clone())); - if (importingNamespace()) - c->setImportingNamespace(dynamic_cast(importingNamespace()->clone())); c->setVisibility(visibility()); return c; } diff --git a/src/mof/qmofpackageimport.h b/src/mof/qmofpackageimport.h index 67b05d27..f8dab118 100644 --- a/src/mof/qmofpackageimport.h +++ b/src/mof/qmofpackageimport.h @@ -58,6 +58,7 @@ class Q_MOF_EXPORT QMofPackageImport : public QMofDirectedRelationship { public: explicit QMofPackageImport(bool createQModelingObject = true); + virtual ~QMofPackageImport(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofpackagemerge.cpp b/src/mof/qmofpackagemerge.cpp index f2acd3c7..0cc7cce3 100644 --- a/src/mof/qmofpackagemerge.cpp +++ b/src/mof/qmofpackagemerge.cpp @@ -68,6 +68,14 @@ QMofPackageMerge::QMofPackageMerge(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofPackageMergeObject(this)); } +/*! + Destroys the QMofPackageMerge. + */ +QMofPackageMerge::~QMofPackageMerge() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofPackageMerge. */ @@ -76,10 +84,6 @@ QModelingElement *QMofPackageMerge::clone() const QMofPackageMerge *c = new QMofPackageMerge; foreach (QMofComment *element, ownedComments()) c->addOwnedComment(dynamic_cast(element->clone())); - if (mergedPackage()) - c->setMergedPackage(dynamic_cast(mergedPackage()->clone())); - if (receivingPackage()) - c->setReceivingPackage(dynamic_cast(receivingPackage()->clone())); return c; } diff --git a/src/mof/qmofpackagemerge.h b/src/mof/qmofpackagemerge.h index bd3f597b..01e1c97b 100644 --- a/src/mof/qmofpackagemerge.h +++ b/src/mof/qmofpackagemerge.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofPackageMerge : public QMofDirectedRelationship { public: explicit QMofPackageMerge(bool createQModelingObject = true); + virtual ~QMofPackageMerge(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofparameter.cpp b/src/mof/qmofparameter.cpp index 79947873..6228b25e 100644 --- a/src/mof/qmofparameter.cpp +++ b/src/mof/qmofparameter.cpp @@ -73,6 +73,14 @@ QMofParameter::QMofParameter(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofParameterObject(this)); } +/*! + Destroys the QMofParameter. + */ +QMofParameter::~QMofParameter() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofParameter. */ @@ -83,8 +91,6 @@ QModelingElement *QMofParameter::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); c->setOrdered(isOrdered()); c->setUnique(isUnique()); if (lowerValue()) @@ -94,8 +100,6 @@ QModelingElement *QMofParameter::clone() const if (defaultValue()) c->setDefaultValue(dynamic_cast(defaultValue()->clone())); c->setDirection(direction()); - if (operation()) - c->setOperation(dynamic_cast(operation()->clone())); return c; } diff --git a/src/mof/qmofparameter.h b/src/mof/qmofparameter.h index b41df3b6..b401c2b6 100644 --- a/src/mof/qmofparameter.h +++ b/src/mof/qmofparameter.h @@ -59,6 +59,7 @@ class Q_MOF_EXPORT QMofParameter : public QMofTypedElement, public QMofMultiplic { public: explicit QMofParameter(bool createQModelingObject = true); + virtual ~QMofParameter(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofprimitivetype.cpp b/src/mof/qmofprimitivetype.cpp index fa825b2b..4643cd16 100644 --- a/src/mof/qmofprimitivetype.cpp +++ b/src/mof/qmofprimitivetype.cpp @@ -81,6 +81,14 @@ QMofPrimitiveType::QMofPrimitiveType(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofPrimitiveTypeObject(this)); } +/*! + Destroys the QMofPrimitiveType. + */ +QMofPrimitiveType::~QMofPrimitiveType() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofPrimitiveType. */ @@ -91,8 +99,6 @@ QModelingElement *QMofPrimitiveType::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (package()) - c->setPackage(dynamic_cast(package()->clone())); c->setLeaf(isLeaf()); foreach (QMofElementImport *element, elementImports()) c->addElementImport(dynamic_cast(element->clone())); @@ -104,8 +110,6 @@ QModelingElement *QMofPrimitiveType::clone() const c->addGeneralization(dynamic_cast(element->clone())); c->setAbstract(isAbstract()); c->setFinalSpecialization(isFinalSpecialization()); - foreach (QMofClassifier *element, redefinedClassifiers()) - c->addRedefinedClassifier(dynamic_cast(element->clone())); foreach (QMofProperty *element, ownedAttributes()) c->addOwnedAttribute(dynamic_cast(element->clone())); foreach (QMofOperation *element, ownedOperations()) diff --git a/src/mof/qmofprimitivetype.h b/src/mof/qmofprimitivetype.h index bdb7da73..61c7c5c7 100644 --- a/src/mof/qmofprimitivetype.h +++ b/src/mof/qmofprimitivetype.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofPrimitiveType : public QMofDataType { public: explicit QMofPrimitiveType(bool createQModelingObject = true); + virtual ~QMofPrimitiveType(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofproperty.cpp b/src/mof/qmofproperty.cpp index d7690fe4..6dcb5623 100644 --- a/src/mof/qmofproperty.cpp +++ b/src/mof/qmofproperty.cpp @@ -84,6 +84,14 @@ QMofProperty::QMofProperty(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofPropertyObject(this)); } +/*! + Destroys the QMofProperty. + */ +QMofProperty::~QMofProperty() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofProperty. */ @@ -96,8 +104,6 @@ QModelingElement *QMofProperty::clone() const c->setVisibility(visibility()); c->setLeaf(isLeaf()); c->setStatic(isStatic()); - if (type()) - c->setType(dynamic_cast(type()->clone())); c->setOrdered(isOrdered()); c->setUnique(isUnique()); if (lowerValue()) @@ -105,24 +111,12 @@ QModelingElement *QMofProperty::clone() const if (upperValue()) c->setUpperValue(dynamic_cast(upperValue()->clone())); c->setAggregation(aggregation()); - if (association()) - c->setAssociation(dynamic_cast(association()->clone())); - if (class_()) - c->setClass(dynamic_cast(class_()->clone())); - if (datatype()) - c->setDatatype(dynamic_cast(datatype()->clone())); if (defaultValue()) c->setDefaultValue(dynamic_cast(defaultValue()->clone())); c->setDerived(isDerived()); c->setDerivedUnion(isDerivedUnion()); c->setID(isID()); c->setReadOnly(isReadOnly()); - if (owningAssociation()) - c->setOwningAssociation(dynamic_cast(owningAssociation()->clone())); - foreach (QMofProperty *element, redefinedProperties()) - c->addRedefinedProperty(dynamic_cast(element->clone())); - foreach (QMofProperty *element, subsettedProperties()) - c->addSubsettedProperty(dynamic_cast(element->clone())); return c; } diff --git a/src/mof/qmofproperty.h b/src/mof/qmofproperty.h index 9ef42302..bd5fc3c4 100644 --- a/src/mof/qmofproperty.h +++ b/src/mof/qmofproperty.h @@ -62,6 +62,7 @@ class Q_MOF_EXPORT QMofProperty : public QMofStructuralFeature { public: explicit QMofProperty(bool createQModelingObject = true); + virtual ~QMofProperty(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofredefinableelement.cpp b/src/mof/qmofredefinableelement.cpp index a6d18de9..5b0187ea 100644 --- a/src/mof/qmofredefinableelement.cpp +++ b/src/mof/qmofredefinableelement.cpp @@ -66,6 +66,14 @@ QMofRedefinableElement::QMofRedefinableElement() : { } +/*! + Destroys the QMofRedefinableElement. + */ +QMofRedefinableElement::~QMofRedefinableElement() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofRedefinableElement. */ diff --git a/src/mof/qmofredefinableelement.h b/src/mof/qmofredefinableelement.h index 2c49ea01..3fc50dbd 100644 --- a/src/mof/qmofredefinableelement.h +++ b/src/mof/qmofredefinableelement.h @@ -54,6 +54,8 @@ class QMofClassifier; class Q_MOF_EXPORT QMofRedefinableElement : public virtual QMofNamedElement { public: + virtual ~QMofRedefinableElement(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofreflectivecollection.cpp b/src/mof/qmofreflectivecollection.cpp index 3bf23d3c..a761d41b 100644 --- a/src/mof/qmofreflectivecollection.cpp +++ b/src/mof/qmofreflectivecollection.cpp @@ -51,6 +51,14 @@ QMofReflectiveCollection::QMofReflectiveCollection(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofReflectiveCollectionObject(this)); } +/*! + Destroys the QMofReflectiveCollection. + */ +QMofReflectiveCollection::~QMofReflectiveCollection() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofReflectiveCollection::clone() const { QMofReflectiveCollection *c = new QMofReflectiveCollection; diff --git a/src/mof/qmofreflectivecollection.h b/src/mof/qmofreflectivecollection.h index a923709a..752722d2 100644 --- a/src/mof/qmofreflectivecollection.h +++ b/src/mof/qmofreflectivecollection.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofReflectiveCollection : public QMofObject { public: explicit QMofReflectiveCollection(bool createQModelingObject = true); + virtual ~QMofReflectiveCollection(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofreflectivesequence.cpp b/src/mof/qmofreflectivesequence.cpp index af8d79ba..23e9eca6 100644 --- a/src/mof/qmofreflectivesequence.cpp +++ b/src/mof/qmofreflectivesequence.cpp @@ -53,6 +53,14 @@ QMofReflectiveSequence::QMofReflectiveSequence(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofReflectiveSequenceObject(this)); } +/*! + Destroys the QMofReflectiveSequence. + */ +QMofReflectiveSequence::~QMofReflectiveSequence() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofReflectiveSequence::clone() const { QMofReflectiveSequence *c = new QMofReflectiveSequence; diff --git a/src/mof/qmofreflectivesequence.h b/src/mof/qmofreflectivesequence.h index cfdbcfd5..fd06f463 100644 --- a/src/mof/qmofreflectivesequence.h +++ b/src/mof/qmofreflectivesequence.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofReflectiveSequence : public QMofReflectiveCollection { public: explicit QMofReflectiveSequence(bool createQModelingObject = true); + virtual ~QMofReflectiveSequence(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofrelationship.cpp b/src/mof/qmofrelationship.cpp index ea95b44c..115bb1ee 100644 --- a/src/mof/qmofrelationship.cpp +++ b/src/mof/qmofrelationship.cpp @@ -62,6 +62,14 @@ QMofRelationship::QMofRelationship() { } +/*! + Destroys the QMofRelationship. + */ +QMofRelationship::~QMofRelationship() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofRelationship. */ diff --git a/src/mof/qmofrelationship.h b/src/mof/qmofrelationship.h index dfa57276..93b2253c 100644 --- a/src/mof/qmofrelationship.h +++ b/src/mof/qmofrelationship.h @@ -52,6 +52,8 @@ QT_MODULE(QtMof) class Q_MOF_EXPORT QMofRelationship : public virtual QMofElement { public: + virtual ~QMofRelationship(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofslot.cpp b/src/mof/qmofslot.cpp index 90f81525..22ad8f1a 100644 --- a/src/mof/qmofslot.cpp +++ b/src/mof/qmofslot.cpp @@ -69,6 +69,14 @@ QMofSlot::QMofSlot(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofSlotObject(this)); } +/*! + Destroys the QMofSlot. + */ +QMofSlot::~QMofSlot() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofSlot. */ @@ -77,10 +85,6 @@ QModelingElement *QMofSlot::clone() const QMofSlot *c = new QMofSlot; foreach (QMofComment *element, ownedComments()) c->addOwnedComment(dynamic_cast(element->clone())); - if (definingFeature()) - c->setDefiningFeature(dynamic_cast(definingFeature()->clone())); - if (owningInstance()) - c->setOwningInstance(dynamic_cast(owningInstance()->clone())); foreach (QMofValueSpecification *element, values()) c->addValue(dynamic_cast(element->clone())); return c; diff --git a/src/mof/qmofslot.h b/src/mof/qmofslot.h index 82c08aa2..3ba8376b 100644 --- a/src/mof/qmofslot.h +++ b/src/mof/qmofslot.h @@ -57,6 +57,7 @@ class Q_MOF_EXPORT QMofSlot : public QMofElement { public: explicit QMofSlot(bool createQModelingObject = true); + virtual ~QMofSlot(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofstructuralfeature.cpp b/src/mof/qmofstructuralfeature.cpp index 1a3ef007..e056e1a0 100644 --- a/src/mof/qmofstructuralfeature.cpp +++ b/src/mof/qmofstructuralfeature.cpp @@ -70,6 +70,14 @@ QMofStructuralFeature::QMofStructuralFeature() : { } +/*! + Destroys the QMofStructuralFeature. + */ +QMofStructuralFeature::~QMofStructuralFeature() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofStructuralFeature. */ @@ -82,8 +90,6 @@ QModelingElement *QMofStructuralFeature::clone() const c->setVisibility(visibility()); c->setLeaf(isLeaf()); c->setStatic(isStatic()); - if (type()) - c->setType(dynamic_cast(type()->clone())); c->setOrdered(isOrdered()); c->setUnique(isUnique()); if (lowerValue()) diff --git a/src/mof/qmofstructuralfeature.h b/src/mof/qmofstructuralfeature.h index dfb0adee..527a54f4 100644 --- a/src/mof/qmofstructuralfeature.h +++ b/src/mof/qmofstructuralfeature.h @@ -54,6 +54,8 @@ QT_MODULE(QtMof) class Q_MOF_EXPORT QMofStructuralFeature : public QMofFeature, public virtual QMofTypedElement, public QMofMultiplicityElement { public: + virtual ~QMofStructuralFeature(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmoftag.cpp b/src/mof/qmoftag.cpp index 03ddaa0a..9ed8cd5e 100644 --- a/src/mof/qmoftag.cpp +++ b/src/mof/qmoftag.cpp @@ -51,15 +51,19 @@ QMofTag::QMofTag(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofTagObject(this)); } +/*! + Destroys the QMofTag. + */ +QMofTag::~QMofTag() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofTag::clone() const { QMofTag *c = new QMofTag; c->setName(name()); c->setValue(value()); - foreach (QMofElement *element, elements()) - c->addElement(dynamic_cast(element->clone())); - if (tagOwner()) - c->setTagOwner(dynamic_cast(tagOwner()->clone())); return c; } diff --git a/src/mof/qmoftag.h b/src/mof/qmoftag.h index 76017056..c69b3a79 100644 --- a/src/mof/qmoftag.h +++ b/src/mof/qmoftag.h @@ -53,6 +53,7 @@ class Q_MOF_EXPORT QMofTag : public QMofElement { public: explicit QMofTag(bool createQModelingObject = true); + virtual ~QMofTag(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmoftype.cpp b/src/mof/qmoftype.cpp index 99ea1eb1..92740642 100644 --- a/src/mof/qmoftype.cpp +++ b/src/mof/qmoftype.cpp @@ -68,6 +68,14 @@ QMofType::QMofType() : { } +/*! + Destroys the QMofType. + */ +QMofType::~QMofType() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofType. */ @@ -78,8 +86,6 @@ QModelingElement *QMofType::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (package()) - c->setPackage(dynamic_cast(package()->clone())); return c; } diff --git a/src/mof/qmoftype.h b/src/mof/qmoftype.h index 34a85445..d5af9509 100644 --- a/src/mof/qmoftype.h +++ b/src/mof/qmoftype.h @@ -55,6 +55,8 @@ class QMofPackage; class Q_MOF_EXPORT QMofType : public QMofPackageableElement { public: + virtual ~QMofType(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmoftypedelement.cpp b/src/mof/qmoftypedelement.cpp index 6298452e..637c6ad5 100644 --- a/src/mof/qmoftypedelement.cpp +++ b/src/mof/qmoftypedelement.cpp @@ -66,6 +66,14 @@ QMofTypedElement::QMofTypedElement() : { } +/*! + Destroys the QMofTypedElement. + */ +QMofTypedElement::~QMofTypedElement() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofTypedElement. */ @@ -76,8 +84,6 @@ QModelingElement *QMofTypedElement::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); return c; } diff --git a/src/mof/qmoftypedelement.h b/src/mof/qmoftypedelement.h index 3614c82e..61c3c6d9 100644 --- a/src/mof/qmoftypedelement.h +++ b/src/mof/qmoftypedelement.h @@ -54,6 +54,8 @@ class QMofType; class Q_MOF_EXPORT QMofTypedElement : public virtual QMofNamedElement { public: + virtual ~QMofTypedElement(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; // Owned attributes diff --git a/src/mof/qmofuriextent.cpp b/src/mof/qmofuriextent.cpp index ae8787a1..9c15fd09 100644 --- a/src/mof/qmofuriextent.cpp +++ b/src/mof/qmofuriextent.cpp @@ -53,6 +53,14 @@ QMofURIExtent::QMofURIExtent(bool createQModelingObject) : _qModelingObject = qobject_cast(new QMofURIExtentObject(this)); } +/*! + Destroys the QMofURIExtent. + */ +QMofURIExtent::~QMofURIExtent() +{ + QModelingElement::deleteQModelingObject(); +} + QModelingElement *QMofURIExtent::clone() const { QMofURIExtent *c = new QMofURIExtent; diff --git a/src/mof/qmofuriextent.h b/src/mof/qmofuriextent.h index f7ae8f69..4fc4a11b 100644 --- a/src/mof/qmofuriextent.h +++ b/src/mof/qmofuriextent.h @@ -55,6 +55,7 @@ class Q_MOF_EXPORT QMofURIExtent : public QMofExtent { public: explicit QMofURIExtent(bool createQModelingObject = true); + virtual ~QMofURIExtent(); virtual QModelingElement *clone() const; diff --git a/src/mof/qmofvaluespecification.cpp b/src/mof/qmofvaluespecification.cpp index a9f85815..b7eea522 100644 --- a/src/mof/qmofvaluespecification.cpp +++ b/src/mof/qmofvaluespecification.cpp @@ -66,6 +66,14 @@ QMofValueSpecification::QMofValueSpecification() { } +/*! + Destroys the QMofValueSpecification. + */ +QMofValueSpecification::~QMofValueSpecification() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QMofValueSpecification. */ @@ -76,8 +84,6 @@ QModelingElement *QMofValueSpecification::clone() const c->addOwnedComment(dynamic_cast(element->clone())); c->setName(name()); c->setVisibility(visibility()); - if (type()) - c->setType(dynamic_cast(type()->clone())); return c; } diff --git a/src/mof/qmofvaluespecification.h b/src/mof/qmofvaluespecification.h index a44166b9..b1cfbe79 100644 --- a/src/mof/qmofvaluespecification.h +++ b/src/mof/qmofvaluespecification.h @@ -53,6 +53,8 @@ QT_MODULE(QtMof) class Q_MOF_EXPORT QMofValueSpecification : public QMofPackageableElement, public QMofTypedElement { public: + virtual ~QMofValueSpecification(); + Q_DECL_HIDDEN virtual QModelingElement *clone() const; diff --git a/src/saduseprofile/qsaduseprofileprocesscomponent.cpp b/src/saduseprofile/qsaduseprofileprocesscomponent.cpp index 28a6ea9e..50e652e7 100644 --- a/src/saduseprofile/qsaduseprofileprocesscomponent.cpp +++ b/src/saduseprofile/qsaduseprofileprocesscomponent.cpp @@ -64,14 +64,20 @@ QSADuseProfileProcessComponent::QSADuseProfileProcessComponent(bool createQModel _qModelingObject = qobject_cast(new QSADuseProfileProcessComponentObject(this)); } +/*! + Destroys the QSADuseProfileProcessComponent. + */ +QSADuseProfileProcessComponent::~QSADuseProfileProcessComponent() +{ + QModelingElement::deleteQModelingObject(); +} + /*! Returns a deep-copied clone of the QSADuseProfileProcessComponent. */ QModelingElement *QSADuseProfileProcessComponent::clone() const { QSADuseProfileProcessComponent *c = new QSADuseProfileProcessComponent; - if (base_Component()) - c->setBase_Component(dynamic_cast(base_Component()->clone())); return c; } diff --git a/src/saduseprofile/qsaduseprofileprocesscomponent.h b/src/saduseprofile/qsaduseprofileprocesscomponent.h index 54230bd3..2512f3bf 100644 --- a/src/saduseprofile/qsaduseprofileprocesscomponent.h +++ b/src/saduseprofile/qsaduseprofileprocesscomponent.h @@ -55,6 +55,7 @@ class Q_SADUSEPROFILE_EXPORT QSADuseProfileProcessComponent : public QModelingEl { public: explicit QSADuseProfileProcessComponent(bool createQModelingObject = true); + virtual ~QSADuseProfileProcessComponent(); virtual QModelingElement *clone() const; diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 4197a886..2fa25521 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -4,4 +4,5 @@ SUBDIRS = \ qtumlcontainment \ qtumlprovidedrequiredinterfaces \ qtumlconnectortypeandcomponentparts \ - qtumlguardedcollection + qtumlguardedcollection \ + qtmofguardedcollection diff --git a/tests/auto/qtmofguardedcollection/qtmofguardedcollection.pro b/tests/auto/qtmofguardedcollection/qtmofguardedcollection.pro new file mode 100644 index 00000000..24c40c7a --- /dev/null +++ b/tests/auto/qtmofguardedcollection/qtmofguardedcollection.pro @@ -0,0 +1,7 @@ +CONFIG += testcase +TARGET = tst_qtmofguardedcollection + +QT = modeling mof testlib + +SOURCES += \ + tst_qtmofguardedcollection.cpp \ diff --git a/tests/auto/qtmofguardedcollection/tst_qtmofguardedcollection.cpp b/tests/auto/qtmofguardedcollection/tst_qtmofguardedcollection.cpp new file mode 100644 index 00000000..f5af9b63 --- /dev/null +++ b/tests/auto/qtmofguardedcollection/tst_qtmofguardedcollection.cpp @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Sandro S. Andrade +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtMof module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +#include + +#include + +class TestQtMofGuardedCollection : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void qtmofguardedcollection(); +}; + +void TestQtMofGuardedCollection::qtmofguardedcollection() +{ + QMofComment *c1 = new QMofComment; + c1->asQModelingObject()->setObjectName("c1"); + QMofComment *c2 = new QMofComment; + c2->asQModelingObject()->setObjectName("c2"); + + c1->addOwnedComment(c2); + + QCOMPARE(c1->ownedComments().size(), 1); + + delete c2; + + QCOMPARE(c1->ownedComments().size(), 0); + + delete c1; +} + +QTEST_MAIN(TestQtMofGuardedCollection) +#include "tst_qtmofguardedcollection.moc" + -- cgit v1.2.3