diff options
Diffstat (limited to 'src/uml/qoperation.cpp')
-rw-r--r-- | src/uml/qoperation.cpp | 168 |
1 files changed, 44 insertions, 124 deletions
diff --git a/src/uml/qoperation.cpp b/src/uml/qoperation.cpp index ef8bf98f..58c85778 100644 --- a/src/uml/qoperation.cpp +++ b/src/uml/qoperation.cpp @@ -55,26 +55,17 @@ QT_BEGIN_NAMESPACE_QTUML QOperationPrivate::QOperationPrivate() : isQuery(false), - ownedParameters(new QList<QParameter *>), bodyCondition(0), - redefinedOperations(new QSet<QOperation *>), - postconditions(new QSet<QConstraint *>), datatype(0), templateParameter(0), interface(0), - preconditions(new QSet<QConstraint *>), - class_(0), - raisedExceptions(new QSet<QType *>) + class_(0) { } QOperationPrivate::~QOperationPrivate() { - delete ownedParameters; - delete redefinedOperations; - delete postconditions; - delete preconditions; - delete raisedExceptions; + qDeleteAll(ownedParameters); } /*! @@ -112,7 +103,7 @@ QOperation::~QOperation() /*! The Elements owned by this element. */ -const QSet<QElement *> *QOperation::ownedElements() const +const QSet<QElement *> &QOperation::ownedElements() const { return (qwrappedobject_cast<const QElement *>(this))->ownedElements(); } @@ -128,7 +119,7 @@ QElement *QOperation::owner() const /*! The Comments owned by this element. */ -const QSet<QComment *> *QOperation::ownedComments() const +const QSet<QComment *> &QOperation::ownedComments() const { return (qwrappedobject_cast<const QElement *>(this))->ownedComments(); } @@ -163,7 +154,7 @@ void QOperation::setOwnedTemplateSignature(QTemplateSignature *ownedTemplateSign /*! The optional bindings from this element to templates. */ -const QSet<QTemplateBinding *> *QOperation::templateBindings() const +const QSet<QTemplateBinding *> &QOperation::templateBindings() const { return (qwrappedobject_cast<const QTemplateableElement *>(this))->templateBindings(); } @@ -244,7 +235,7 @@ QNamespace *QOperation::namespace_() const /*! Indicates the dependencies that reference the client. */ -const QSet<QDependency *> *QOperation::clientDependencies() const +const QSet<QDependency *> &QOperation::clientDependencies() const { return (qwrappedobject_cast<const QNamedElement *>(this))->clientDependencies(); } @@ -266,7 +257,7 @@ void QOperation::removeClientDependency(QDependency *clientDependency) /*! References the PackageImports owned by the Namespace. */ -const QSet<QPackageImport *> *QOperation::packageImports() const +const QSet<QPackageImport *> &QOperation::packageImports() const { return (qwrappedobject_cast<const QNamespace *>(this))->packageImports(); } @@ -284,7 +275,7 @@ void QOperation::removePackageImport(QPackageImport *packageImport) /*! A collection of NamedElements identifiable within the Namespace, either by being owned or by being introduced by importing or inheritance. */ -const QSet<QNamedElement *> *QOperation::members() const +const QSet<QNamedElement *> &QOperation::members() const { return (qwrappedobject_cast<const QNamespace *>(this))->members(); } @@ -292,7 +283,7 @@ const QSet<QNamedElement *> *QOperation::members() const /*! References the PackageableElements that are members of this Namespace as a result of either PackageImports or ElementImports. */ -const QSet<QPackageableElement *> *QOperation::importedMembers() const +const QSet<QPackageableElement *> &QOperation::importedMembers() const { return (qwrappedobject_cast<const QNamespace *>(this))->importedMembers(); } @@ -300,7 +291,7 @@ const QSet<QPackageableElement *> *QOperation::importedMembers() const /*! References the ElementImports owned by the Namespace. */ -const QSet<QElementImport *> *QOperation::elementImports() const +const QSet<QElementImport *> &QOperation::elementImports() const { return (qwrappedobject_cast<const QNamespace *>(this))->elementImports(); } @@ -318,7 +309,7 @@ void QOperation::removeElementImport(QElementImport *elementImport) /*! Specifies a set of Constraints owned by this Namespace. */ -const QSet<QConstraint *> *QOperation::ownedRules() const +const QSet<QConstraint *> &QOperation::ownedRules() const { return (qwrappedobject_cast<const QNamespace *>(this))->ownedRules(); } @@ -336,7 +327,7 @@ void QOperation::removeOwnedRule(QConstraint *ownedRule) /*! A collection of NamedElements owned by the Namespace. */ -const QSet<QNamedElement *> *QOperation::ownedMembers() const +const QSet<QNamedElement *> &QOperation::ownedMembers() const { return (qwrappedobject_cast<const QNamespace *>(this))->ownedMembers(); } @@ -370,7 +361,7 @@ void QOperation::unsetLeaf() /*! The redefinable element that is being redefined by this element. */ -const QSet<QRedefinableElement *> *QOperation::redefinedElements() const +const QSet<QRedefinableElement *> &QOperation::redefinedElements() const { return (qwrappedobject_cast<const QRedefinableElement *>(this))->redefinedElements(); } @@ -378,7 +369,7 @@ const QSet<QRedefinableElement *> *QOperation::redefinedElements() const /*! References the contexts that this element may be redefined from. */ -const QSet<QClassifier *> *QOperation::redefinitionContexts() const +const QSet<QClassifier *> &QOperation::redefinitionContexts() const { return (qwrappedobject_cast<const QRedefinableElement *>(this))->redefinitionContexts(); } @@ -412,7 +403,7 @@ void QOperation::unsetStatic() /*! The Classifiers that have this Feature as a feature. */ -const QSet<QClassifier *> *QOperation::featuringClassifiers() const +const QSet<QClassifier *> &QOperation::featuringClassifiers() const { return (qwrappedobject_cast<const QFeature *>(this))->featuringClassifiers(); } @@ -464,7 +455,7 @@ void QOperation::unsetAbstract() /*! The ParameterSets owned by this BehavioralFeature. */ -const QSet<QParameterSet *> *QOperation::ownedParameterSets() const +const QSet<QParameterSet *> &QOperation::ownedParameterSets() const { return (qwrappedobject_cast<const QBehavioralFeature *>(this))->ownedParameterSets(); } @@ -482,7 +473,7 @@ void QOperation::removeOwnedParameterSet(QParameterSet *ownedParameterSet) /*! A behavioral description that implements the behavioral feature. There may be at most one behavior for a particular pairing of a classifier (as owner of the behavior) and a behavioral feature (as specification of the behavior). */ -const QSet<QBehavior *> *QOperation::methods() const +const QSet<QBehavior *> &QOperation::methods() const { return (qwrappedobject_cast<const QBehavioralFeature *>(this))->methods(); } @@ -599,7 +590,7 @@ bool QOperation::isOrdered() const /*! Specifies the ordered set of formal parameters of this BehavioralFeature.Specifies the parameters owned by this Operation. */ -const QList<QParameter *> *QOperation::ownedParameters() const +const QList<QParameter *> &QOperation::ownedParameters() const { // This is a read-write association end @@ -612,8 +603,8 @@ void QOperation::addOwnedParameter(QParameter *ownedParameter) // This is a read-write association end Q_D(QOperation); - if (!d->ownedParameters->contains(ownedParameter)) { - d->ownedParameters->append(ownedParameter); + if (!d->ownedParameters.contains(ownedParameter)) { + d->ownedParameters.append(ownedParameter); qTopLevelWrapper(ownedParameter)->setParent(qTopLevelWrapper(this)); // Adjust opposite property @@ -626,8 +617,8 @@ void QOperation::removeOwnedParameter(QParameter *ownedParameter) // This is a read-write association end Q_D(QOperation); - if (d->ownedParameters->contains(ownedParameter)) { - d->ownedParameters->removeAll(ownedParameter); + if (d->ownedParameters.contains(ownedParameter)) { + d->ownedParameters.removeAll(ownedParameter); qTopLevelWrapper(ownedParameter)->setParent(0); // Adjust opposite property @@ -667,7 +658,7 @@ void QOperation::setBodyCondition(QConstraint *bodyCondition) /*! References the Operations that are redefined by this Operation. */ -const QSet<QOperation *> *QOperation::redefinedOperations() const +const QSet<QOperation *> &QOperation::redefinedOperations() const { // This is a read-write association end @@ -680,8 +671,8 @@ void QOperation::addRedefinedOperation(QOperation *redefinedOperation) // This is a read-write association end Q_D(QOperation); - if (!d->redefinedOperations->contains(redefinedOperation)) { - d->redefinedOperations->insert(redefinedOperation); + if (!d->redefinedOperations.contains(redefinedOperation)) { + d->redefinedOperations.insert(redefinedOperation); // Adjust subsetted property(ies) (qwrappedobject_cast<QRedefinableElementPrivate *>(d))->addRedefinedElement(qwrappedobject_cast<QRedefinableElement *>(redefinedOperation)); @@ -693,8 +684,8 @@ void QOperation::removeRedefinedOperation(QOperation *redefinedOperation) // This is a read-write association end Q_D(QOperation); - if (d->redefinedOperations->contains(redefinedOperation)) { - d->redefinedOperations->remove(redefinedOperation); + if (d->redefinedOperations.contains(redefinedOperation)) { + d->redefinedOperations.remove(redefinedOperation); // Adjust subsetted property(ies) (qwrappedobject_cast<QRedefinableElementPrivate *>(d))->removeRedefinedElement(qwrappedobject_cast<QRedefinableElement *>(redefinedOperation)); @@ -704,7 +695,7 @@ void QOperation::removeRedefinedOperation(QOperation *redefinedOperation) /*! An optional set of Constraints specifying the state of the system when the Operation is completed. */ -const QSet<QConstraint *> *QOperation::postconditions() const +const QSet<QConstraint *> &QOperation::postconditions() const { // This is a read-write association end @@ -717,8 +708,8 @@ void QOperation::addPostcondition(QConstraint *postcondition) // This is a read-write association end Q_D(QOperation); - if (!d->postconditions->contains(postcondition)) { - d->postconditions->insert(postcondition); + if (!d->postconditions.contains(postcondition)) { + d->postconditions.insert(postcondition); // Adjust subsetted property(ies) (qwrappedobject_cast<QNamespace *>(this))->addOwnedRule(qwrappedobject_cast<QConstraint *>(postcondition)); @@ -730,8 +721,8 @@ void QOperation::removePostcondition(QConstraint *postcondition) // This is a read-write association end Q_D(QOperation); - if (d->postconditions->contains(postcondition)) { - d->postconditions->remove(postcondition); + if (d->postconditions.contains(postcondition)) { + d->postconditions.remove(postcondition); // Adjust subsetted property(ies) (qwrappedobject_cast<QNamespace *>(this))->removeOwnedRule(qwrappedobject_cast<QConstraint *>(postcondition)); @@ -863,7 +854,7 @@ QType *QOperation::type() const /*! An optional set of Constraints on the state of the system when the Operation is invoked. */ -const QSet<QConstraint *> *QOperation::preconditions() const +const QSet<QConstraint *> &QOperation::preconditions() const { // This is a read-write association end @@ -876,8 +867,8 @@ void QOperation::addPrecondition(QConstraint *precondition) // This is a read-write association end Q_D(QOperation); - if (!d->preconditions->contains(precondition)) { - d->preconditions->insert(precondition); + if (!d->preconditions.contains(precondition)) { + d->preconditions.insert(precondition); // Adjust subsetted property(ies) (qwrappedobject_cast<QNamespace *>(this))->addOwnedRule(qwrappedobject_cast<QConstraint *>(precondition)); @@ -889,8 +880,8 @@ void QOperation::removePrecondition(QConstraint *precondition) // This is a read-write association end Q_D(QOperation); - if (d->preconditions->contains(precondition)) { - d->preconditions->remove(precondition); + if (d->preconditions.contains(precondition)) { + d->preconditions.remove(precondition); // Adjust subsetted property(ies) (qwrappedobject_cast<QNamespace *>(this))->removeOwnedRule(qwrappedobject_cast<QConstraint *>(precondition)); @@ -942,7 +933,7 @@ void QOperation::setClass_(QClass *class_) /*! References the Types representing exceptions that may be raised during an invocation of this operation. */ -const QSet<QType *> *QOperation::raisedExceptions() const +const QSet<QType *> &QOperation::raisedExceptions() const { // This is a read-write association end @@ -955,8 +946,8 @@ void QOperation::addRaisedException(QType *raisedException) // This is a read-write association end Q_D(QOperation); - if (!d->raisedExceptions->contains(raisedException)) { - d->raisedExceptions->insert(raisedException); + if (!d->raisedExceptions.contains(raisedException)) { + d->raisedExceptions.insert(raisedException); } } @@ -965,8 +956,8 @@ void QOperation::removeRaisedException(QType *raisedException) // This is a read-write association end Q_D(QOperation); - if (d->raisedExceptions->contains(raisedException)) { - d->raisedExceptions->remove(raisedException); + if (d->raisedExceptions.contains(raisedException)) { + d->raisedExceptions.remove(raisedException); } } @@ -984,82 +975,11 @@ bool QOperation::isConsistentWith(const QRedefinableElement *redefinee) const /*! The query returnResult() returns the set containing the return parameter of the Operation if one exists, otherwise, it returns an empty set */ -const QSet<QParameter *> *QOperation::returnResult() const +const QSet<QParameter *> &QOperation::returnResult() const { qWarning("QOperation::returnResult: operation to be implemented"); - return 0; // change here to your derived return -} - -void QOperation::registerMetaTypes() const -{ - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QOperation) *>("QT_PREPEND_NAMESPACE_QTUML(QOperation) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QOperation) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QOperation) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QOperation) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QOperation) *> *"); - qRegisterMetaType<QOperation *>("QOperation *"); - qRegisterMetaType<const QSet<QOperation *> *>("const QSet<QOperation *> *"); - qRegisterMetaType<const QList<QOperation *> *>("const QList<QOperation *> *"); - - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QRedefinableElement) *>("QT_PREPEND_NAMESPACE_QTUML(QRedefinableElement) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QRedefinableElement) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QRedefinableElement) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QRedefinableElement) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QRedefinableElement) *> *"); - qRegisterMetaType<QRedefinableElement *>("QRedefinableElement *"); - qRegisterMetaType<const QSet<QRedefinableElement *> *>("const QSet<QRedefinableElement *> *"); - qRegisterMetaType<const QList<QRedefinableElement *> *>("const QList<QRedefinableElement *> *"); - - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QType) *>("QT_PREPEND_NAMESPACE_QTUML(QType) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QType) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QType) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QType) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QType) *> *"); - qRegisterMetaType<QType *>("QType *"); - qRegisterMetaType<const QSet<QType *> *>("const QSet<QType *> *"); - qRegisterMetaType<const QList<QType *> *>("const QList<QType *> *"); - - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QOperationTemplateParameter) *>("QT_PREPEND_NAMESPACE_QTUML(QOperationTemplateParameter) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QOperationTemplateParameter) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QOperationTemplateParameter) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QOperationTemplateParameter) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QOperationTemplateParameter) *> *"); - qRegisterMetaType<QOperationTemplateParameter *>("QOperationTemplateParameter *"); - qRegisterMetaType<const QSet<QOperationTemplateParameter *> *>("const QSet<QOperationTemplateParameter *> *"); - qRegisterMetaType<const QList<QOperationTemplateParameter *> *>("const QList<QOperationTemplateParameter *> *"); - - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QParameter) *>("QT_PREPEND_NAMESPACE_QTUML(QParameter) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QParameter) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QParameter) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QParameter) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QParameter) *> *"); - qRegisterMetaType<QParameter *>("QParameter *"); - qRegisterMetaType<const QSet<QParameter *> *>("const QSet<QParameter *> *"); - qRegisterMetaType<const QList<QParameter *> *>("const QList<QParameter *> *"); - - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QInterface) *>("QT_PREPEND_NAMESPACE_QTUML(QInterface) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QInterface) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QInterface) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QInterface) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QInterface) *> *"); - qRegisterMetaType<QInterface *>("QInterface *"); - qRegisterMetaType<const QSet<QInterface *> *>("const QSet<QInterface *> *"); - qRegisterMetaType<const QList<QInterface *> *>("const QList<QInterface *> *"); - - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QConstraint) *>("QT_PREPEND_NAMESPACE_QTUML(QConstraint) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QConstraint) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QConstraint) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QConstraint) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QConstraint) *> *"); - qRegisterMetaType<QConstraint *>("QConstraint *"); - qRegisterMetaType<const QSet<QConstraint *> *>("const QSet<QConstraint *> *"); - qRegisterMetaType<const QList<QConstraint *> *>("const QList<QConstraint *> *"); - - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QDataType) *>("QT_PREPEND_NAMESPACE_QTUML(QDataType) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QDataType) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QDataType) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QDataType) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QDataType) *> *"); - qRegisterMetaType<QDataType *>("QDataType *"); - qRegisterMetaType<const QSet<QDataType *> *>("const QSet<QDataType *> *"); - qRegisterMetaType<const QList<QDataType *> *>("const QList<QDataType *> *"); - - qRegisterMetaType<QT_PREPEND_NAMESPACE_QTUML(QClass) *>("QT_PREPEND_NAMESPACE_QTUML(QClass) *"); - qRegisterMetaType<const QSet<QT_PREPEND_NAMESPACE_QTUML(QClass) *> *>("const QSet<QT_PREPEND_NAMESPACE_QTUML(QClass) *> *"); - qRegisterMetaType<const QList<QT_PREPEND_NAMESPACE_QTUML(QClass) *> *>("const QList<QT_PREPEND_NAMESPACE_QTUML(QClass) *> *"); - qRegisterMetaType<QClass *>("QClass *"); - qRegisterMetaType<const QSet<QClass *> *>("const QSet<QClass *> *"); - qRegisterMetaType<const QList<QClass *> *>("const QList<QClass *> *"); - - QWrappedObject::registerMetaTypes(); - - foreach (QWrappedObject *wrappedObject, wrappedObjects()) - wrappedObject->registerMetaTypes(); + return *(new QSet<QParameter *>); // change here to your derived return } #include "moc_qoperation.cpp" |