diff options
author | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-13 14:25:09 -0300 |
---|---|---|
committer | Sandro S. Andrade <sandroandrade@kde.org> | 2013-10-13 19:26:30 +0200 |
commit | def69b5407929c004dfa966b41520faab45b4980 (patch) | |
tree | 9d05f4da74ab0dff47a37fc2556059fe3bb31da1 /src/mof/qmofprimitivetype.cpp | |
parent | 0c0b3b07143b672c6f0a310c5eb5c6a8a476c573 (diff) |
Add new implementation of MOF metamodel
Change-Id: Ic44e34cbbb5e60f185b43528181e76e5364a3958
Reviewed-by: Sandro S. Andrade <sandroandrade@kde.org>
Diffstat (limited to 'src/mof/qmofprimitivetype.cpp')
-rw-r--r-- | src/mof/qmofprimitivetype.cpp | 80 |
1 files changed, 49 insertions, 31 deletions
diff --git a/src/mof/qmofprimitivetype.cpp b/src/mof/qmofprimitivetype.cpp index 0a9c65b8..e4dfaba7 100644 --- a/src/mof/qmofprimitivetype.cpp +++ b/src/mof/qmofprimitivetype.cpp @@ -39,19 +39,27 @@ ** ****************************************************************************/ #include "qmofprimitivetype.h" -#include "qmofprimitivetype_p.h" -#include <QtWrappedObjects/QtWrappedObjectsNamespace> +#include "private/qmofprimitivetypeobject_p.h" -QT_BEGIN_NAMESPACE - -QMofPrimitiveTypePrivate::QMofPrimitiveTypePrivate() -{ -} - -QMofPrimitiveTypePrivate::~QMofPrimitiveTypePrivate() -{ -} +#include <QtMof/QMofClass> +#include <QtMof/QMofClassifier> +#include <QtMof/QMofComment> +#include <QtMof/QMofConstraint> +#include <QtMof/QMofElement> +#include <QtMof/QMofElementImport> +#include <QtMof/QMofFeature> +#include <QtMof/QMofGeneralization> +#include <QtMof/QMofNamedElement> +#include <QtMof/QMofNamespace> +#include <QtMof/QMofObject> +#include <QtMof/QMofOperation> +#include <QtMof/QMofPackage> +#include <QtMof/QMofPackageableElement> +#include <QtMof/QMofPackageImport> +#include <QtMof/QMofProperty> +#include <QtMof/QMofRedefinableElement> +#include <QtMof/QMofType> /*! \class QMofPrimitiveType @@ -60,29 +68,39 @@ QMofPrimitiveTypePrivate::~QMofPrimitiveTypePrivate() \brief A primitive type defines a predefined data type, without any relevant substructure (i.e., it has no parts in the context of UML). A primitive datatype may have an algebra and operations defined outside of UML, for example, mathematically. */ - -QMofPrimitiveType::QMofPrimitiveType(QWrappedObject *wrapper, QWrappedObject *parent) : - QMofDataType(*new QMofPrimitiveTypePrivate, wrapper, parent) +QMofPrimitiveType::QMofPrimitiveType(bool createQModelingObject) : + QMofDataType(false) { - setPropertyData(); + if (createQModelingObject) + _qModelingObject = qobject_cast<QModelingObject *>(new QMofPrimitiveTypeObject(this)); } -QMofPrimitiveType::QMofPrimitiveType(QMofPrimitiveTypePrivate &dd, QWrappedObject *wrapper, QWrappedObject *parent) : - QMofDataType(dd, wrapper, parent) +QModelingElement *QMofPrimitiveType::clone() const { - setPropertyData(); + QMofPrimitiveType *c = new QMofPrimitiveType; + foreach (QMofComment *element, ownedComments()) + c->addOwnedComment(dynamic_cast<QMofComment *>(element->clone())); + c->setName(name()); + c->setVisibility(visibility()); + if (package()) + c->setPackage(dynamic_cast<QMofPackage *>(package()->clone())); + c->setLeaf(isLeaf()); + foreach (QMofElementImport *element, elementImports()) + c->addElementImport(dynamic_cast<QMofElementImport *>(element->clone())); + foreach (QMofConstraint *element, ownedRules()) + c->addOwnedRule(dynamic_cast<QMofConstraint *>(element->clone())); + foreach (QMofPackageImport *element, packageImports()) + c->addPackageImport(dynamic_cast<QMofPackageImport *>(element->clone())); + foreach (QMofGeneralization *element, generalizations()) + c->addGeneralization(dynamic_cast<QMofGeneralization *>(element->clone())); + c->setAbstract(isAbstract()); + c->setFinalSpecialization(isFinalSpecialization()); + foreach (QMofClassifier *element, redefinedClassifiers()) + c->addRedefinedClassifier(dynamic_cast<QMofClassifier *>(element->clone())); + foreach (QMofProperty *element, ownedAttributes()) + c->addOwnedAttribute(dynamic_cast<QMofProperty *>(element->clone())); + foreach (QMofOperation *element, ownedOperations()) + c->addOwnedOperation(dynamic_cast<QMofOperation *>(element->clone())); + return c; } -QMofPrimitiveType::~QMofPrimitiveType() -{ -} - -void QMofPrimitiveType::setPropertyData() -{ - QMofDataType::setPropertyData(); -} - -QT_END_NAMESPACE - -#include "moc_qmofprimitivetype.cpp" - |