summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/uml/duse-mt/duse-mt.pro3
-rw-r--r--examples/uml/xmi-read/xmi-read.pro2
-rw-r--r--scripts/templates/common.tmpl27
-rw-r--r--src/plugins/metamodels/uml/qumlmetamodel.cpp1
-rw-r--r--src/wrappedobjects/doc/qtwrappedobjects.qdocconf41
-rw-r--r--src/wrappedobjects/doc/snippets/code/doc_src_qtwrappedobjects.cpp43
-rw-r--r--src/wrappedobjects/doc/snippets/code/doc_src_qtwrappedobjects.pro3
-rw-r--r--src/wrappedobjects/doc/src/qtwrappedobjects.qdoc66
-rw-r--r--src/wrappedobjects/qmetamodelplugin.cpp53
-rw-r--r--src/wrappedobjects/qmetamodelplugin.h71
-rw-r--r--src/wrappedobjects/qmetawrappedobject.cpp177
-rw-r--r--src/wrappedobjects/qmetawrappedobject.h109
-rw-r--r--src/wrappedobjects/qmetawrappedobject_p.h73
-rw-r--r--src/wrappedobjects/qtwrappedobjectsglobal.h61
-rw-r--r--src/wrappedobjects/qtwrappedobjectsnamespace.cpp52
-rw-r--r--src/wrappedobjects/qtwrappedobjectsnamespace.h84
-rw-r--r--src/wrappedobjects/qwrappedobject.cpp201
-rw-r--r--src/wrappedobjects/qwrappedobject.h184
-rw-r--r--src/wrappedobjects/qwrappedobject_p.h92
-rw-r--r--src/wrappedobjects/qwrappedobjectpointer.h73
-rw-r--r--src/wrappedobjects/qxmireader.cpp317
-rw-r--r--src/wrappedobjects/qxmireader.h84
-rw-r--r--src/wrappedobjects/qxmireader_p.h80
-rw-r--r--src/wrappedobjects/qxmiwriter.cpp304
-rw-r--r--src/wrappedobjects/qxmiwriter.h83
-rw-r--r--src/wrappedobjects/qxmiwriter_p.h81
-rw-r--r--src/wrappedobjects/wrappedobjects.pro34
27 files changed, 27 insertions, 2372 deletions
diff --git a/examples/uml/duse-mt/duse-mt.pro b/examples/uml/duse-mt/duse-mt.pro
index 44864a4a..18428a8b 100644
--- a/examples/uml/duse-mt/duse-mt.pro
+++ b/examples/uml/duse-mt/duse-mt.pro
@@ -4,7 +4,8 @@
#
#-------------------------------------------------
-QT = modelingwidgets script quick quick-private qml duse
+#QT = modelingwidgets script quick quick-private qml duse
+QT = script quick quick-private qml
TARGET = duse-mt
TEMPLATE = app
diff --git a/examples/uml/xmi-read/xmi-read.pro b/examples/uml/xmi-read/xmi-read.pro
index 0a4201a8..99dd3b2f 100644
--- a/examples/uml/xmi-read/xmi-read.pro
+++ b/examples/uml/xmi-read/xmi-read.pro
@@ -3,7 +3,7 @@ TARGET = xmi-read
DEPENDPATH += .
INCLUDEPATH += .
-QT += wrappedobjects
+QT += modeling
QT -= gui
# Input
diff --git a/scripts/templates/common.tmpl b/scripts/templates/common.tmpl
index e3a8476f..2b968ee9 100644
--- a/scripts/templates/common.tmpl
+++ b/scripts/templates/common.tmpl
@@ -217,13 +217,16 @@ ${parameter.findvalue("@name")}
[%- SET derivedUnion = attribute.findvalue("@isDerivedUnion") %]
[% IF qtType.match("QList|QSet") %]const [% END %]${qtType}Q${namespace}${originalClassName}Object::${qtAttribute}() const
{
- [%- IF qtType.match("QList|QSet") %]
+ [%- IF qtType.match("QList|QSet") && !qtType.match("QString") %]
${qtType}[% IF qtType.match("QList") %]list[% ELSE %]set[% END %];
foreach (Q${originalQtType.remove("QList<").remove("QSet<").remove(">").trim.remove("^Q")}element, qmodelingobjectproperty_cast<Q${namespace}${originalClassName} *>(this)->${qtAttribute}())
[% IF qtType.match("QList") %]list[% ELSE %]set[% END %].[% IF qtType.match("QList") %]append[% ELSE %]insert[% END %](element->asQObject());
return [% IF qtType.match("QList") %]list[% ELSE %]set[% END %];
[%- ELSIF qtType.match('\*$') %]
- return qmodelingobjectproperty_cast<Q${namespace}${originalClassName} *>(this)->${qtAttribute}()->asQObject();
+ if (!qmodelingobjectproperty_cast<Q${namespace}${originalClassName} *>(this)->${qtAttribute}())
+ return 0;
+ else
+ return qmodelingobjectproperty_cast<Q${namespace}${originalClassName} *>(this)->${qtAttribute}()->asQObject();
[%- ELSE %]
return qmodelingobjectproperty_cast<Q${namespace}${originalClassName} *>(this)->${qtAttribute}();
[%- END %]
@@ -286,7 +289,19 @@ ${parameter.findvalue("@name")}
[% IF qtType.match("QList") %]list[% ELSE %]set[% END %].[% IF return.match("QList") %]append[% ELSE %]insert[% END %](element->asQObject());
return [% IF qtType.match("QList") %]list[% ELSE %]set[% END %];
[%- ELSIF !return.match("QList|QSet") && return.match('\*$') %]
- return qmodelingobjectproperty_cast<Q${namespace}${originalClassName} *>(this)->${operationName}(
+ if (!qmodelingobjectproperty_cast<Q${namespace}${originalClassName} *>(this)->${operationName}(
+ [%- FOREACH parameter = operation.findnodes("ownedParameter[@direction!='return']") -%]
+ [%- qtType = QT_TYPE(namespace, parameter, "true") -%]
+ [%- IF qtType.match('\*$') -%]
+qmodelingobjectproperty_cast<${qtType.remove("QList<").remove("QSet<").remove(">")}>(${parameter.findvalue("@name")})
+ [%- ELSE -%]
+${parameter.findvalue("@name")}
+ [%- END -%]
+ [%- IF !loop.last %], [% END -%]
+ [%- END -%]))
+ return 0;
+ else
+ return qmodelingobjectproperty_cast<Q${namespace}${originalClassName} *>(this)->${operationName}(
[%- FOREACH parameter = operation.findnodes("ownedParameter[@direction!='return']") -%]
[%- qtType = QT_TYPE(namespace, parameter, "true") -%]
[%- IF qtType.match('\*$') -%]
@@ -409,9 +424,13 @@ void Q${namespace}${originalClassName}Object::set${attributeName.remove("^Is")}(
[%- SET className = class.findvalue("@name") -%]
[%- SET qtAttribute = QT_ATTRIBUTE(attribute) -%]
[%- NEXT IF redefinedProperties.grep("^${className}-${qtAttribute}$").size > 0 -%]
- [%- IF qtType.match("QList|QSet") && qtType.match('\*') %]
+ [%- IF qtType.match("QList|QSet") %]
foreach (${qtType.remove("QList<").remove("QSet<").remove(">").replace('\* ', '*')}element, ${attributeName}())
+ [%- IF qtType.match('\*') %]
c->add${attributeName.ucfirst}(dynamic_cast<${qtType.remove("QList<").remove("QSet<").remove(">").replace('\* ', '*')}>(element->clone()));
+ [%- ELSE %]
+ c->add${attributeName.ucfirst}(element);
+ [%- END -%]
[%- ELSIF qtType.match('\*') %]
if (${attributeName}())
c->set${attributeName.ucfirst}(dynamic_cast<${qtType.remove("QList<").remove("QSet<").remove(">").replace('\* ', '*')}>(${attributeName}()->clone()));
diff --git a/src/plugins/metamodels/uml/qumlmetamodel.cpp b/src/plugins/metamodels/uml/qumlmetamodel.cpp
index 1e4d7061..65473434 100644
--- a/src/plugins/metamodels/uml/qumlmetamodel.cpp
+++ b/src/plugins/metamodels/uml/qumlmetamodel.cpp
@@ -44,6 +44,7 @@ QT_BEGIN_NAMESPACE
void QUmlMetaModel::init(QScriptEngine *scriptEngine)
{
+ Q_UNUSED(scriptEngine);
}
QT_END_NAMESPACE
diff --git a/src/wrappedobjects/doc/qtwrappedobjects.qdocconf b/src/wrappedobjects/doc/qtwrappedobjects.qdocconf
deleted file mode 100644
index d7a3980d..00000000
--- a/src/wrappedobjects/doc/qtwrappedobjects.qdocconf
+++ /dev/null
@@ -1,41 +0,0 @@
-include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
-
-project = QtWrappedObjects
-description = Qt WrappedObjects Reference Documentation
-url = http://qt-project.org/doc/qtwrappedobjects
-version = 5.0.0
-
-examplesinstallpath = wrappedobjects
-
-qhp.projects = QtWrappedObjects
-
-qhp.QtWrappedObjects.file = qtwrappedobjects.qhp
-qhp.QtWrappedObjects.namespace = org.qt-project.qtwrappedobjects.500
-qhp.QtWrappedObjects.virtualFolder = qtwrappedobjects
-qhp.QtWrappedObjects.indexTitle = Qt WrappedObjects
-qhp.QtWrappedObjects.indexRoot =
-
-qhp.QtWrappedObjects.filterAttributes = qtwrappedobjects 5.0.0 qtrefdoc
-qhp.QtWrappedObjects.customFilters.Qt.name = QtWrappedObjects 5.0.0
-qhp.QtWrappedObjects.customFilters.Qt.filterAttributes = qtwrappedobjects 5.0.0
-
-qhp.QtWrappedObjects.subprojects = classes
-qhp.QtWrappedObjects.subprojects.classes.title = C++ Classes
-qhp.QtWrappedObjects.subprojects.classes.indexTitle = Qt WrappedObjects C++ Classes
-qhp.QtWrappedObjects.subprojects.classes.selectors = class fake:headerfile
-qhp.QtWrappedObjects.subprojects.classes.sortPages = true
-tagfile = ../../../doc/qtwrappedobjects/qtwrappedobjects.tags
-
-depends += qtcore qtdoc
-
-headerdirs += ..
-
-sourcedirs += .. \
- ../../../examples/wrappedobjects/doc/src
-
-exampledirs += ../../../examples/wrappedobjects \
- ../ \
- snippets
-
-imagedirs += images \
- ../../../examples/wrappedobjects/doc/images
diff --git a/src/wrappedobjects/doc/snippets/code/doc_src_qtwrappedobjects.cpp b/src/wrappedobjects/doc/snippets/code/doc_src_qtwrappedobjects.cpp
deleted file mode 100644
index 4c5dae75..00000000
--- a/src/wrappedobjects/doc/snippets/code/doc_src_qtwrappedobjects.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-//! [0]
-#include <QtWrappedObjects>
-//! [0]
diff --git a/src/wrappedobjects/doc/snippets/code/doc_src_qtwrappedobjects.pro b/src/wrappedobjects/doc/snippets/code/doc_src_qtwrappedobjects.pro
deleted file mode 100644
index 3fc2ca40..00000000
--- a/src/wrappedobjects/doc/snippets/code/doc_src_qtwrappedobjects.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-#! [0]
-QT += wrappedobjects
-#! [0]
diff --git a/src/wrappedobjects/doc/src/qtwrappedobjects.qdoc b/src/wrappedobjects/doc/src/qtwrappedobjects.qdoc
deleted file mode 100644
index 8c6e2334..00000000
--- a/src/wrappedobjects/doc/src/qtwrappedobjects.qdoc
+++ /dev/null
@@ -1,66 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-/*!
- \page qtwrappedobjects-index.html
- \title Qt WrappedObjects
- \brief Provide facility classes for wrapped objects as an alternative to multiple inheritance.
-
- Qt WrappedObjects is an add-on module which provides facility classes for wrapped objects as an alternative to multiple inheritance.
-
- \section1 Getting Started
- To enable Qt WrappedObjects in a project, add this directive into the C++ files:
- \code
- #include <QtWrappedObjects>
- \endcode
- To link against the Qt WrappedObjects module, add this line to the project file:
- \code
- QT += wrappedobjects
- \endcode
-
- \section1 Reference
- These are links to the API reference materials.
- \list
- \li \l{Qt WrappedObjects Module C++ Classes}{C++ classes}
- \endlist
-*/
-
-/*!
- \module QtWrappedObjects
- \title Qt WrappedObjects Module C++ Classes
- \ingroup modules
- \brief Provide facility classes for wrapped objects as an alternative to multiple inheritance.
-
- To include the definitions of the module's classes, use the
- following directive:
-
- \snippet code/doc_src_qtwrappedobjects.cpp 0
-
- To link against the module, add this line to your \l qmake \c
- .pro file:
-
- \snippet code/doc_src_qtwrappedobjects.pro 0
-*/
diff --git a/src/wrappedobjects/qmetamodelplugin.cpp b/src/wrappedobjects/qmetamodelplugin.cpp
deleted file mode 100644
index 77291458..00000000
--- a/src/wrappedobjects/qmetamodelplugin.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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 "qmetamodelplugin.h"
-
-QT_BEGIN_NAMESPACE
-
-QMetaModelPlugin::QMetaModelPlugin(QObject *parent)
- : QObject(parent)
-{
-}
-
-#include "moc_qmetamodelplugin.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjects/qmetamodelplugin.h b/src/wrappedobjects/qmetamodelplugin.h
deleted file mode 100644
index 7edf90fe..00000000
--- a/src/wrappedobjects/qmetamodelplugin.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QMETAMODELPLUGIN_H
-#define QTWRAPPEDOBJECTS_QMETAMODELPLUGIN_H
-
-#include <QtWrappedObjects/QtWrappedObjectsGlobal>
-
-#include <QtCore/QObject>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class QScriptEngine;
-
-class Q_WRAPPEDOBJECTS_EXPORT QMetaModelPlugin : public QObject
-{
- Q_OBJECT
-
-public:
- explicit QMetaModelPlugin(QObject *parent = 0);
-
- virtual void initMetaModel(QScriptEngine *scriptEngine = 0) = 0;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QMETAMODELPLUGIN_H
-
diff --git a/src/wrappedobjects/qmetawrappedobject.cpp b/src/wrappedobjects/qmetawrappedobject.cpp
deleted file mode 100644
index ad9e1087..00000000
--- a/src/wrappedobjects/qmetawrappedobject.cpp
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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 "qmetawrappedobject.h"
-#include "qmetawrappedobject_p.h"
-#include "qwrappedobject.h"
-
-#include <QtCore/QStringList>
-#include <QtCore/QStack>
-
-QT_BEGIN_NAMESPACE
-
-QMetaWrappedObjectPrivate::QMetaWrappedObjectPrivate()
-{
-}
-
-QMetaWrappedObjectPrivate::~QMetaWrappedObjectPrivate()
-{
-}
-
-/*!
- \class QMetaWrappedObject
-
- \inmodule QtWrappedObjects
-
- \brief The QMetaWrappedObject class provides meta information about a QWrappedObject.
- */
-
-QMetaWrappedObject::QMetaWrappedObject(QWrappedObject *wrappedObject)
- : d_ptr(new QMetaWrappedObjectPrivate)
-{
- initialize(wrappedObject);
-}
-
-QMetaWrappedObject::QMetaWrappedObject(QMetaWrappedObjectPrivate &dd, QWrappedObject *wrappedObject)
- : d_ptr(&dd)
-{
- initialize(wrappedObject);
-}
-
-void QMetaWrappedObject::initialize(QWrappedObject *wrappedObject)
-{
- d_ptr->q_ptr = this;
- d_ptr->wrappedObject = wrappedObject;
-
- QStringList visitedClasses;
- QStringList visitedProperties;
- handleWrappedObjectProperties(d_ptr->wrappedObject, d_ptr->wrappedObject->metaObject(), visitedClasses, visitedProperties);
-}
-
-QMetaWrappedObject::~QMetaWrappedObject()
-{
- delete d_ptr;
-}
-
-int QMetaWrappedObject::propertyGroupCount() const
-{
- return d_ptr->propertyGroupInfos.count();
-}
-
-int QMetaWrappedObject::propertyCount() const
-{
- return d_ptr->propertyInfos.count();
-}
-
-int QMetaWrappedObject::propertyCount(int groupIndex) const
-{
- return (groupIndex < d_ptr->propertyGroupInfos.count() - 1) ?
- d_ptr->propertyGroupInfos[groupIndex+1].second - d_ptr->propertyGroupInfos[groupIndex].second
- :
- d_ptr->propertyInfos.count() - d_ptr->propertyGroupInfos[groupIndex].second;
-}
-
-QMetaPropertyInfo &QMetaWrappedObject::property(int index) const
-{
- QList<QMetaPropertyInfo>::iterator i = d_ptr->propertyInfos.begin();
- return *(i+index);
-}
-
-QMetaPropertyInfo &QMetaWrappedObject::property(int groupIndex, int index) const
-{
- QList<QMetaPropertyInfo>::iterator i = d_ptr->propertyInfos.begin();
- return *(i+d_ptr->propertyGroupInfos[groupIndex].second+index);
-}
-
-int QMetaWrappedObject::indexOfProperty(const char *name) const
-{
- QList<QMetaPropertyInfo>::const_iterator iend = d_ptr->propertyInfos.constEnd();
- for (QList<QMetaPropertyInfo>::const_iterator i = d_ptr->propertyInfos.constBegin(); i < iend; ++i)
- if (*i == name)
- return i-d_ptr->propertyInfos.constBegin();
- return -1;
-}
-
-int QMetaWrappedObject::indexOfGroup(const char *name) const
-{
- QList< QPair<QString, int> >::const_iterator iend = d_ptr->propertyGroupInfos.constEnd();
- for (QList< QPair<QString, int> >::const_iterator i = d_ptr->propertyGroupInfos.constBegin(); i < iend; ++i)
- if (i->first == QString::fromLatin1(name))
- return i-d_ptr->propertyGroupInfos.constBegin();
- return -1;
-}
-
-void QMetaWrappedObject::handleWrappedObjectProperties(const QWrappedObject *wrappingObject, const QMetaObject *metaObject, QStringList &visitedClasses, QStringList &visitedProperties) const
-{
- if (!metaObject)
- return;
-
- if (metaObject->superClass() && !visitedClasses.contains(QString::fromLatin1(metaObject->superClass()->className())))
- handleWrappedObjectProperties(wrappingObject, metaObject->superClass(), visitedClasses, visitedProperties);
-
- if (QString::fromLatin1(metaObject->className()) == QString::fromLatin1("QWrappedObject")) {
- foreach (QWrappedObject *wrappedObject, wrappingObject->wrappedObjects())
- handleWrappedObjectProperties(wrappedObject, wrappedObject->metaObject(), visitedClasses, visitedProperties);
- }
-
- QMetaPropertyInfo propertyInfo;
- visitedClasses << QString::fromLatin1(metaObject->className());
- propertyInfo.propertyMetaObject = metaObject;
- propertyInfo.propertyWrappedObject = const_cast<QWrappedObject *>(wrappingObject);
- int propertyCount = metaObject->propertyCount();
- if (propertyCount - metaObject->propertyOffset() > 0)
- d_ptr->propertyGroupInfos << QPair<QString, int>(QString::fromLatin1(metaObject->className()), d_ptr->propertyInfos.size());
- for (int i = metaObject->propertyOffset(); i < propertyCount; ++i) {
- propertyInfo.metaProperty = metaObject->property(i);
- int index;
- if ((index = d_ptr->propertyInfos.indexOf(propertyInfo)) != -1 && QWrappedObject::propertyData(QString::fromLatin1(metaObject->className()), propertyInfo.metaProperty, QtWrappedObjects::RedefinedPropertiesRole).toString() != QString::fromLatin1("")) {
- d_ptr->propertyInfos.removeAll(propertyInfo);
- QList< QPair<QString, int> >::iterator iend = d_ptr->propertyGroupInfos.end();
- for (QList< QPair<QString, int> >::iterator i = d_ptr->propertyGroupInfos.begin(); i < iend; ++i)
- if (i->second > index)
- i->second--;
- }
- if (!d_ptr->propertyInfos.contains(propertyInfo))
- d_ptr->propertyInfos << propertyInfo;
- }
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjects/qmetawrappedobject.h b/src/wrappedobjects/qmetawrappedobject.h
deleted file mode 100644
index 2b344309..00000000
--- a/src/wrappedobjects/qmetawrappedobject.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QMETAWRAPPEDOBJECT_H
-#define QTWRAPPEDOBJECTS_QMETAWRAPPEDOBJECT_H
-
-#include <QtWrappedObjects/QtWrappedObjectsGlobal>
-
-#include <QtCore/QMetaProperty>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class QWrappedObject;
-class QMetaWrappedObjectPrivate;
-
-struct Q_WRAPPEDOBJECTS_EXPORT QMetaPropertyInfo
-{
- QMetaProperty metaProperty;
- const QMetaObject *propertyMetaObject;
- QWrappedObject *propertyWrappedObject;
-
- inline bool operator==(const QMetaPropertyInfo &other) const
- {
- return qstrcmp(metaProperty.name(), other.metaProperty.name()) == 0 ? true:false;
- }
-
- inline bool operator==(const char *name) const
- {
- return qstrcmp(metaProperty.name(), name) == 0 ? true:false;
- }
-};
-
-class Q_WRAPPEDOBJECTS_EXPORT QMetaWrappedObject
-{
- Q_DISABLE_COPY(QMetaWrappedObject)
- Q_DECLARE_PRIVATE(QMetaWrappedObject)
-
-public:
- virtual ~QMetaWrappedObject();
-
- int propertyGroupCount() const;
- int propertyCount() const;
- int propertyCount(int groupIndex) const;
- QMetaPropertyInfo &property(int index) const;
- QMetaPropertyInfo &property(int groupIndex, int index) const;
- int indexOfProperty(const char *name) const;
- int indexOfGroup(const char *name) const;
-
-protected:
- explicit QMetaWrappedObject(QWrappedObject *wrappedObject);
- explicit QMetaWrappedObject(QMetaWrappedObjectPrivate &dd, QWrappedObject *wrappedObject);
- void initialize(QWrappedObject *wrappedObject);
- void handleWrappedObjectProperties(const QWrappedObject *wrappingObject, const QMetaObject *metaObject, QStringList &visitedClasses, QStringList &visitedProperties) const;
-
- QMetaWrappedObjectPrivate *d_ptr;
-
- friend class QWrappedObject;
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QMetaPropertyInfo) *)
-Q_DECLARE_METATYPE(QT_PREPEND_NAMESPACE(QMetaPropertyInfo))
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QMETAWRAPPEDOBJECT_H
-
diff --git a/src/wrappedobjects/qmetawrappedobject_p.h b/src/wrappedobjects/qmetawrappedobject_p.h
deleted file mode 100644
index f5f7339d..00000000
--- a/src/wrappedobjects/qmetawrappedobject_p.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QMETAWRAPPEDOBJECT_P_H
-#define QTWRAPPEDOBJECTS_QMETAWRAPPEDOBJECT_P_H
-
-#include "qtwrappedobjectsglobal.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class Q_WRAPPEDOBJECTS_EXPORT QMetaWrappedObjectPrivate
-{
- Q_DECLARE_PUBLIC(QMetaWrappedObject)
-
-public:
- explicit QMetaWrappedObjectPrivate();
- virtual ~QMetaWrappedObjectPrivate();
-
- const QWrappedObject *wrappedObject;
- QList<QMetaPropertyInfo> propertyInfos;
- QList< QPair<QString, int> > propertyGroupInfos;
-
-protected:
- QMetaWrappedObject *q_ptr;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QMETAWRAPPEDOBJECT_P_H
-
diff --git a/src/wrappedobjects/qtwrappedobjectsglobal.h b/src/wrappedobjects/qtwrappedobjectsglobal.h
deleted file mode 100644
index ed8b6a7f..00000000
--- a/src/wrappedobjects/qtwrappedobjectsglobal.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTSGLOBAL_H
-#define QTWRAPPEDOBJECTSGLOBAL_H
-
-#include <QtCore/QtGlobal>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_WRAPPEDOBJECTS_LIB)
-# define Q_WRAPPEDOBJECTS_EXPORT Q_DECL_EXPORT
-# else
-# define Q_WRAPPEDOBJECTS_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_WRAPPEDOBJECTS_EXPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QTWRAPPEDOBJECTSGLOBAL_H
-
diff --git a/src/wrappedobjects/qtwrappedobjectsnamespace.cpp b/src/wrappedobjects/qtwrappedobjectsnamespace.cpp
deleted file mode 100644
index e79c078b..00000000
--- a/src/wrappedobjects/qtwrappedobjectsnamespace.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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 "qtwrappedobjectsnamespace.h"
-
-QT_BEGIN_NAMESPACE
-
-QtWrappedObjects::QtWrappedObjects()
-{
-}
-
-#include "moc_qtwrappedobjectsnamespace.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjects/qtwrappedobjectsnamespace.h b/src/wrappedobjects/qtwrappedobjectsnamespace.h
deleted file mode 100644
index 617adc28..00000000
--- a/src/wrappedobjects/qtwrappedobjectsnamespace.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTSNAMESPACE_H
-#define QTWRAPPEDOBJECTSNAMESPACE_H
-
-#include <QtWrappedObjects/QtWrappedObjectsGlobal>
-
-#include <QtCore/QObject>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class Q_WRAPPEDOBJECTS_EXPORT QtWrappedObjects : public QObject
-{
- Q_OBJECT
-
- Q_ENUMS(MetaPropertyDataRole)
-
-public:
- enum MetaPropertyDataRole
- {
- MetaObjectRole = 0,
- WrappedObjectRole,
- AggregationRole,
- OppositeEndRole,
- DocumentationRole,
- RedefinedPropertiesRole,
- SubsettedPropertiesRole,
- IsDerivedUnionRole,
- GroupRole,
- UserRole = 0x0100
- };
-
-private:
- explicit QtWrappedObjects();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTSNAMESPACE_H
-
diff --git a/src/wrappedobjects/qwrappedobject.cpp b/src/wrappedobjects/qwrappedobject.cpp
deleted file mode 100644
index cc97b401..00000000
--- a/src/wrappedobjects/qwrappedobject.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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 "qwrappedobject.h"
-#include "qwrappedobject_p.h"
-#include "qmetawrappedobject.h"
-
-QT_BEGIN_NAMESPACE
-
-QWrappedObjectPrivate::QWrappedObjectPrivate(int version)
- : QObjectPrivate(version), wrapper(0), metaWrappedObject(0), role(QWrappedObject::ModelElementRole)
-{
-}
-
-QWrappedObjectPrivate::~QWrappedObjectPrivate()
-{
- delete metaWrappedObject;
- qDeleteAll(wrappedObjects);
-}
-
-QWrappedObjectPrivate *QWrappedObjectPrivate::get(QWrappedObject *o)
-{
- return dynamic_cast<QWrappedObjectPrivate *>(o->d_func());
-}
-
-/*!
- \class QWrappedObject
-
- \inmodule QtWrappedObjects
-
- \brief The QWrappedObject class provides a QObject which can be wrapped by another QWrappedObject.
- */
-
-QHash< QString, QHash< QString, QHash<QtWrappedObjects::MetaPropertyDataRole, QVariant> > > QWrappedObject::propertyDataHash;
-
-QWrappedObject::QWrappedObject(QWrappedObject *wrapper, QWrappedObject *parent) :
- QObject(*new QWrappedObjectPrivate, parent)
-{
- initialize(wrapper);
-}
-
-QWrappedObject::QWrappedObject(QWrappedObjectPrivate &dd, QWrappedObject *wrapper, QWrappedObject *parent) :
- QObject(dd, parent)
-{
- initialize(wrapper);
-}
-
-QWrappedObject::~QWrappedObject()
-{
-}
-
-void QWrappedObject::setObjectName(const QString &name)
-{
- QWrappedObject *topLevelWrapperObject = qTopLevelWrapper(this);
- if (topLevelWrapperObject->metaObject()->indexOfProperty("name") != -1)
- topLevelWrapperObject->setProperty("name", name);
-
- QObject::setObjectName(name);
-}
-
-void QWrappedObject::setRole(QWrappedObject::WrappedObjectRole role)
-{
- Q_D(QWrappedObject);
- d->role = role;
-}
-
-QWrappedObject::WrappedObjectRole QWrappedObject::role() const
-{
- Q_D(const QWrappedObject);
- return d->role;
-}
-
-void QWrappedObject::initialize(QWrappedObject *wrapper)
-{
- setWrapper(wrapper);
- setPropertyData();
-}
-
-void QWrappedObject::setPropertyData()
-{
-}
-
-const QList<QWrappedObject *> &QWrappedObject::wrappedObjects() const
-{
- Q_D(const QWrappedObject);
- return d->wrappedObjects;
-}
-
-void QWrappedObject::setWrapper(QWrappedObject *wrapper)
-{
- Q_D(QWrappedObject);
- if (wrapper == d->wrapper)
- return;
-
- if (d->wrapper)
- d->wrapper->d_func()->wrappedObjects.removeAll(this);
-
- d->wrapper = wrapper;
-
- if (wrapper)
- wrapper->d_func()->wrappedObjects.append(this);
-}
-
-QWrappedObject *QWrappedObject::wrapper() const
-{
- Q_D(const QWrappedObject);
- return d->wrapper;
-}
-
-const QMetaWrappedObject *QWrappedObject::metaWrappedObject()
-{
- Q_D(QWrappedObject);
- if (!d->metaWrappedObject)
- d->metaWrappedObject = new QMetaWrappedObject(qTopLevelWrapper(this));
- return d->metaWrappedObject;
-}
-
-bool QWrappedObject::setProperty(const char *name, const QVariant &value)
-{
- Q_D(QWrappedObject);
- int index;
- metaWrappedObject();
- if ((index = d->metaWrappedObject->indexOfProperty(name)) != -1) {
- QMetaPropertyInfo metaPropertyInfo = d->metaWrappedObject->property(index);
- metaPropertyInfo.metaProperty.write(metaPropertyInfo.propertyWrappedObject, value);
- return true;
- }
- else
- return false;
-}
-
-QVariant QWrappedObject::property(const char *name) const
-{
- Q_D(const QWrappedObject);
- int index;
- if ((index = d->metaWrappedObject->indexOfProperty(name)) != -1) {
- QMetaPropertyInfo metaPropertyInfo = d->metaWrappedObject->property(index);
- return metaPropertyInfo.metaProperty.read(metaPropertyInfo.propertyWrappedObject);
- }
- else
- return QVariant();
-}
-
-QVariant QWrappedObject::propertyData(QString className, QMetaProperty metaProperty, QtWrappedObjects::MetaPropertyDataRole role)
-{
- return propertyDataHash[className][QString::fromLatin1(metaProperty.name())][role];
-}
-
-bool QWrappedObject::isPropertyModified(QMetaProperty metaProperty) const
-{
- Q_D(const QWrappedObject);
- return d->modifiedResettableProperties.contains(QString::fromLatin1(metaProperty.name()));
-}
-
-void QWrappedObject::setQmlContextProperties(QQmlContext *qmlContext)
-{
- foreach (QWrappedObject *childWrappedObject, wrappedObjects())
- childWrappedObject->setQmlContextProperties(qmlContext);
-}
-
-#include "moc_qwrappedobject.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjects/qwrappedobject.h b/src/wrappedobjects/qwrappedobject.h
deleted file mode 100644
index 33f14978..00000000
--- a/src/wrappedobjects/qwrappedobject.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QWRAPPEDOBJECT_H
-#define QTWRAPPEDOBJECTS_QWRAPPEDOBJECT_H
-
-#include <QtWrappedObjects/QtWrappedObjectsGlobal>
-#include <QtWrappedObjects/QtWrappedObjectsNamespace>
-
-#include <QtCore/QObject>
-
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptValueIterator>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class QQmlContext;
-class QMetaWrappedObject;
-class QWrappedObjectPrivate;
-
-class Q_WRAPPEDOBJECTS_EXPORT QWrappedObject : public QObject
-{
- Q_OBJECT
-
- Q_DISABLE_COPY(QWrappedObject)
- Q_DECLARE_PRIVATE(QWrappedObject)
-
-public:
- Q_INVOKABLE explicit QWrappedObject(QWrappedObject *wrapper = 0, QWrappedObject *parent = 0);
- virtual ~QWrappedObject();
-
- void setObjectName(const QString &name);
-
- enum WrappedObjectRole
- {
- ModelElementRole = 0,
- ImportedElementRole,
- ImportedPackageRole,
- AppliedProfileRole
- };
- void setRole(WrappedObjectRole role);
- WrappedObjectRole role() const;
-
- const QList<QWrappedObject *> &wrappedObjects() const;
-
- void setWrapper(QWrappedObject *wrapper);
- QWrappedObject *wrapper() const;
-
- const QMetaWrappedObject *metaWrappedObject();
- bool setProperty(const char *name, const QVariant &value);
- QVariant property(const char *name) const;
-
- static QVariant propertyData(QString className, QMetaProperty metaProperty, QtWrappedObjects::MetaPropertyDataRole role);
-
- bool isPropertyModified(QMetaProperty metaProperty) const;
-
- virtual void setQmlContextProperties(QQmlContext *qmlContext);
-
-protected:
- explicit QWrappedObject(QWrappedObjectPrivate &dd, QWrappedObject *wrapper = 0, QWrappedObject *parent = 0);
-
- void initialize(QWrappedObject *wrapper);
- virtual void setPropertyData();
-
- static QHash< QString, QHash< QString, QHash<QtWrappedObjects::MetaPropertyDataRole, QVariant> > > propertyDataHash;
-};
-
-QT_END_NAMESPACE
-
-template <class T>
-inline T qwrappedobject_cast(QT_PREPEND_NAMESPACE(QWrappedObject) *base, bool restoreToWrapper = true)
-{
- if (!base)
- return T();
- while (restoreToWrapper && base->wrapper())
- base = base->wrapper();
- if (dynamic_cast<T>(base))
- return dynamic_cast<T>(base);
- foreach (QT_PREPEND_NAMESPACE(QWrappedObject) *wrappedObject, base->wrappedObjects()) {
- T returnValue = qwrappedobject_cast<T>(wrappedObject, false);
- if (returnValue != T())
- return returnValue;
- }
- return T(); // not found
-}
-
-template <class T>
-inline T qwrappedobject_cast(const QT_PREPEND_NAMESPACE(QWrappedObject) *base, bool restoreToWrapper = true)
-{
- return qwrappedobject_cast<T>(const_cast<QT_PREPEND_NAMESPACE(QWrappedObject) *>(base), restoreToWrapper);
-}
-
-inline QT_PREPEND_NAMESPACE(QWrappedObject) *qTopLevelWrapper(QT_PREPEND_NAMESPACE(QWrappedObject) *wrapped)
-{
- if (!wrapped)
- return 0;
- while (wrapped->wrapper())
- wrapped = wrapped->wrapper();
- return wrapped;
-}
-
-template <class T>
-QScriptValue qSetToScriptValue(QScriptEngine *engine, const QSet<T *> &elements)
-{
- QScriptValue array = engine->newArray();
- foreach (T *element, elements)
- array.property(QString::fromLatin1("push")).call(array, QScriptValueList() << engine->newQObject(qTopLevelWrapper(element)));
- return array;
-}
-
-template <class T>
-void scriptValueToQSet(const QScriptValue &obj, QSet<T *> &elements)
-{
- QScriptValueIterator it(obj);
- while (it.hasNext()) {
- it.next();
- elements.insert(qobject_cast<T *>(it.value().toQObject()));
- }
-}
-
-template <class T>
-QScriptValue qListToScriptValue(QScriptEngine *engine, const QList<T *> &elements)
-{
- QScriptValue array = engine->newArray();
- foreach (T *element, elements)
- array.property(QString::fromLatin1("push")).call(array, QScriptValueList() << engine->newQObject(qTopLevelWrapper(element)));
- return array;
-}
-
-template <class T>
-void scriptValueToQList(const QScriptValue &obj, QList<T *> &elements)
-{
- QScriptValueIterator it(obj);
- while (it.hasNext()) {
- it.next();
- elements.append(qobject_cast<T *>(it.value().toQObject()));
- }
-}
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QWRAPPEDOBJECT_H
-
diff --git a/src/wrappedobjects/qwrappedobject_p.h b/src/wrappedobjects/qwrappedobject_p.h
deleted file mode 100644
index 458ee696..00000000
--- a/src/wrappedobjects/qwrappedobject_p.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QWRAPPEDOBJECT_P_H
-#define QTWRAPPEDOBJECTS_QWRAPPEDOBJECT_P_H
-
-#include "qtwrappedobjectsglobal.h"
-#include "private/qobject_p.h"
-
-#include <QtCore/QStringList>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class Q_WRAPPEDOBJECTS_EXPORT QWrappedObjectPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QWrappedObject)
-
-public:
- explicit QWrappedObjectPrivate(int version = QObjectPrivateVersion);
- virtual ~QWrappedObjectPrivate();
-
- static QWrappedObjectPrivate *get(QWrappedObject *o);
-
- QList<QWrappedObject *> wrappedObjects;
- QWrappedObject *wrapper;
- QMetaWrappedObject *metaWrappedObject;
- QStringList modifiedResettableProperties;
- QWrappedObject::WrappedObjectRole role;
-};
-
-QT_END_NAMESPACE
-
-template <class T>
-inline T qwrappedobject_cast(QT_PREPEND_NAMESPACE(QWrappedObjectPrivate) *base, bool restoreToWrapper = true)
-{
- while (restoreToWrapper && base->wrapper)
- base = base->get(base->wrapper);
- if (dynamic_cast<T>(base))
- return dynamic_cast<T>(base);
- foreach (QT_PREPEND_NAMESPACE(QWrappedObject) *wrappedObject, base->wrappedObjects) {
- T returnValue = qwrappedobject_cast<T>(base->get(wrappedObject), false);
- if (returnValue != T())
- return returnValue;
- }
- return T(); // not found
-}
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QWRAPPEDOBJECT_P_H
-
diff --git a/src/wrappedobjects/qwrappedobjectpointer.h b/src/wrappedobjects/qwrappedobjectpointer.h
deleted file mode 100644
index 1369e886..00000000
--- a/src/wrappedobjects/qwrappedobjectpointer.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QWRAPPEDOBJECTPOINTER_H
-#define QTWRAPPEDOBJECTS_QWRAPPEDOBJECTPOINTER_H
-
-#include <QtWrappedObjects/QWrappedObject>
-
-#include <QtCore/QtGlobal>
-#include <QtCore/QPointer>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-template <typename T>
-class QWrappedObjectPointer : public QPointer<T>
-{
-public:
- inline QWrappedObjectPointer(T *p = 0) : QPointer<T>(p) { }
- inline ~QWrappedObjectPointer() { }
-
- template <typename U> inline operator U *()
- {
- return qwrappedobject_cast<U *>(QPointer<T>::data());
- }
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QWRAPPEDOBJECTPOINTER_H
-
diff --git a/src/wrappedobjects/qxmireader.cpp b/src/wrappedobjects/qxmireader.cpp
deleted file mode 100644
index 0e1d7b9b..00000000
--- a/src/wrappedobjects/qxmireader.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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 "qxmireader.h"
-#include "qxmireader_p.h"
-#include "qwrappedobject.h"
-#include "qmetamodelplugin.h"
-#include "qmetawrappedobject.h"
-
-#include <QtCore/QDir>
-#include <QtCore/QUrl>
-#include <QtCore/QStack>
-#include <QtCore/QJsonObject>
-#include <QtCore/QPluginLoader>
-#include <QtCore/QCoreApplication>
-
-QT_BEGIN_NAMESPACE
-
-QXmiReaderPrivate::QXmiReaderPrivate()
-{
-}
-
-QXmiReaderPrivate::~QXmiReaderPrivate()
-{
-}
-
-QXmiReader::QXmiReader(QScriptEngine *scriptEngine, bool initMetaModel, QObject *parent) :
- QObject(*new QXmiReaderPrivate, parent)
-{
- Q_D(QXmiReader);
- d->scriptEngine = scriptEngine;
- d->initMetaModel = initMetaModel;
- loadPlugins();
-}
-
-QXmiReader::~QXmiReader()
-{
-}
-
-void QXmiReader::loadPlugins()
-{
- Q_D(QXmiReader);
-
- d->metaModelPlugins.clear();
- QMetaModelPlugin *metaModelPlugin = 0;
- foreach (QString pluginPath, QCoreApplication::libraryPaths()) {
- QDir pluginsDir(pluginPath);
- pluginsDir.cd(QString::fromLatin1("metamodels"));
- foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
- QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
- QObject *plugin = loader.instance();
- if (plugin && (metaModelPlugin = qobject_cast<QMetaModelPlugin *>(plugin)))
- d->metaModelPlugins.insert(loader.metaData().value(QString::fromLatin1("MetaData")).toObject().value(QString::fromLatin1("MetaModelNamespaceUri")).toString(), QPair<QMetaModelPlugin *, QJsonObject>(metaModelPlugin, loader.metaData().value(QString::fromLatin1("MetaData")).toObject()));
- }
- }
-}
-
-QList<QWrappedObject *> QXmiReader::readFile(QIODevice *device, QString importedId)
-{
- Q_D(QXmiReader);
-
- if (importedId.isEmpty()) {
- d->idMap.clear();
- d->errors.clear();
- d->xmlNamespaceToImplementationNamespace.clear();
- }
- QXmlStreamReader reader;
- reader.setDevice(device);
- QList<QWrappedObject *> wrappedObjectList;
- QWrappedObject *rootElement = 0;
- bool importedIdFound = false;
- QStack<QString> idStack;
- int insertPosition = 0;
-
- while (!reader.atEnd()) {
- reader.readNext();
-
- if (!importedId.isEmpty() && !importedIdFound && reader.attributes().value(QString::fromLatin1("xmi:id")).toString() != importedId)
- continue;
-
- if (!importedId.isEmpty() && !importedIdFound)
- importedIdFound = true;
-
- if (reader.isStartElement()) {
- idStack.push(reader.name().toString());
- QString elementName = reader.name().toString();
- if (elementName == QString::fromLatin1("importedPackage") || elementName == QString::fromLatin1("importedElement") || elementName == QString::fromLatin1("appliedProfile")) {
- QFile importFile(reader.attributes().value(QString::fromLatin1("href")).toString().split(QString::fromLatin1("#")).first());
- if (!importFile.open(QFile::ReadOnly | QFile::Text))
- d->errors << QString::fromLatin1("Could not open imported file '%1'").arg(importFile.fileName());
- QList<QWrappedObject *> importList = readFile(&importFile, reader.attributes().value(QString::fromLatin1("href")).toString().split(QString::fromLatin1("#")).last());
- if (importList.count() > 0) {
- if (elementName == QString::fromLatin1("importedPackage"))
- importList.first()->setRole(QWrappedObject::ImportedPackageRole);
- else if (elementName == QString::fromLatin1("importedElement"))
- importList.first()->setRole(QWrappedObject::ImportedElementRole);
- else if (elementName == QString::fromLatin1("appliedProfile"))
- importList.first()->setRole(QWrappedObject::AppliedProfileRole);
- }
- foreach (QWrappedObject *importedObject, importList) {
- wrappedObjectList.append(importedObject);
- }
- }
-
- foreach (const QXmlStreamNamespaceDeclaration &namespaceDeclaration, reader.namespaceDeclarations()) {
- QMetaModelPlugin *metaModelPlugin = d->metaModelPlugins.value(namespaceDeclaration.namespaceUri().toString()).first;
- if (metaModelPlugin) {
- if (d->initMetaModel)
- metaModelPlugin->initMetaModel(d->scriptEngine);
- d->xmlNamespaceToImplementationNamespace.insert(namespaceDeclaration.prefix().toString(), d->metaModelPlugins.value(namespaceDeclaration.namespaceUri().toString()).second.value(QString::fromLatin1("MetaModelPrefix")).toString());
- }
- else {
- d->errors << QString::fromLatin1("Could not find metamodel for namespace URI '%1'").arg(namespaceDeclaration.namespaceUri().toString());
- }
- }
- QString xmiType = reader.attributes().value(QString::fromLatin1("xmi:type")).toString();
- if (xmiType.isEmpty() && reader.qualifiedName() != reader.name())
- xmiType = reader.qualifiedName().toString();
- if (xmiType.isEmpty() || d->xmlNamespaceToImplementationNamespace[xmiType.split(':').first()].isEmpty())
- continue;
- xmiType = QString::fromLatin1("%1%2 *").arg(d->xmlNamespaceToImplementationNamespace[xmiType.split(':').first()]).arg(xmiType.split(':').last());
- QString instanceName = reader.attributes().value(QString::fromLatin1("name")).toString();
- if (instanceName.isEmpty())
- instanceName = reader.attributes().value(QString::fromLatin1("xmi:id")).toString();
- QWrappedObject *wrappedObject = createInstance(xmiType, instanceName);
- if (wrappedObject) {
- d->idMap.insert(reader.attributes().value(QString::fromLatin1("xmi:id")).toString(), wrappedObject);
- if (!rootElement) {
- rootElement = wrappedObject;
- wrappedObjectList.insert(insertPosition, rootElement);
- }
- }
- else
- d->errors << QString::fromLatin1("Could not create instance with id '%1' and type '%2'. Corresponding metamodel loaded ?").arg(instanceName).arg(xmiType);
- }
- else if (reader.isEndElement()) {
- idStack.pop();
- if (idStack.isEmpty() && !importedId.isEmpty())
- break;
- if (idStack.count() == 1 && importedId.isEmpty()) {
- rootElement = 0;
- ++insertPosition;
- }
- }
- }
-
- importedIdFound = false;
-
- device->reset();
- reader.clear();
- reader.setDevice(device);
- QStack< QPair<QString, QWrappedObject *> > stack;
-
- while (!reader.atEnd()) {
- reader.readNext();
-
- if (!importedId.isEmpty() && !importedIdFound && reader.attributes().value(QString::fromLatin1("xmi:id")).toString() != importedId)
- continue;
-
- if (!importedId.isEmpty() && !importedIdFound)
- importedIdFound = true;
-
- if (reader.isStartElement()) {
- QString id = reader.attributes().value(QString::fromLatin1("xmi:id")).toString();
- if (id.isEmpty())
- id = reader.attributes().value(QString::fromLatin1("xmi:idref")).toString();
- if (id.isEmpty())
- id = reader.attributes().value(QString::fromLatin1("href")).toString().split(QString::fromLatin1("#")).last();
- if (id.isEmpty() && !stack.isEmpty())
- continue;
-
- QWrappedObject *wrappedObject = d->idMap.value(id);
-
- if (wrappedObject) {
- const QMetaWrappedObject *metaWrappedObject = wrappedObject->metaWrappedObject();
- foreach (QXmlStreamAttribute attribute, reader.attributes()) {
- int propertyIndex;
- if ((propertyIndex = metaWrappedObject->indexOfProperty(attribute.name().toString().toLatin1())) != -1) {
- QMetaPropertyInfo metaPropertyInfo = metaWrappedObject->property(propertyIndex);
- QMetaProperty metaProperty = metaPropertyInfo.metaProperty;
- if (metaProperty.type() == QVariant::Bool) {
- if (!wrappedObject->setProperty(attribute.name().toString().toLatin1(), attribute.value().toString() == QString::fromLatin1("true") ? true:false))
- d->errors << QString::fromLatin1("Error when setting property '%1' of object with id '%2'.").arg(attribute.name().toString()).arg(id);
- }
- else if (metaProperty.isEnumType()) {
- QString enumName = attribute.value().toString();
- enumName = enumName.left(1).toUpper() + enumName.mid(1);
- QString propertyName = QString::fromLatin1(metaProperty.name());
- enumName.prepend(propertyName.left(1).toUpper() + propertyName.mid(1));
- if (!wrappedObject->setProperty(attribute.name().toString().toLatin1(), enumName))
- d->errors << QString::fromLatin1("Error when setting property '%1' of object with id '%2'.").arg(attribute.name().toString()).arg(id);
- }
- else if (metaProperty.type() == QVariant::String) {
- if (!wrappedObject->setProperty(attribute.name().toString().toLatin1(), attribute.value().toString()))
- d->errors << QString::fromLatin1("Error when setting property '%1' of object with id '%2'.").arg(attribute.name().toString()).arg(id);
- }
- else if (metaProperty.type() == QVariant::UserType) {
- QWrappedObject *propertyObject = d->idMap.value(attribute.value().toString());
- if (propertyObject) {
- QString elementName = attribute.name().toString();
- elementName = elementName.left(1).toUpper() + elementName.mid(1);
- int methodCount = wrappedObject->metaObject()->methodCount();
- int i;
- for (i = 0; i < methodCount; ++i) {
- QMetaMethod metaMethod = wrappedObject->metaObject()->method(i);
- if (QString::fromLatin1(metaMethod.name()) == QString::fromLatin1("set%1").arg(elementName)) {
- if (!metaMethod.invoke(wrappedObject, ::Q_ARG(QWrappedObject *, propertyObject)))
- d->errors << QString::fromLatin1("Error when invoking metamethod '%1' on object '%2'.").arg(QString::fromLatin1(metaMethod.name())).arg(propertyObject->objectName());
- break;
- }
- }
- if (i == methodCount)
- d->errors << QString::fromLatin1("Metamethod add/set'%1' not found on object '%2'.").arg(elementName).arg(propertyObject->objectName());
-
- }
- }
- }
- else
- d->errors << QString::fromLatin1("Property '%1' not found in object of type '%2'. Corresponding metamodel loaded ?").arg(attribute.name().toString()).arg(QString::fromLatin1(wrappedObject->metaObject()->className()));
- }
- if (!stack.isEmpty()) {
- QWrappedObject *containerObject = stack.top().second;
- QString elementName = reader.name().toString();
- elementName = elementName.left(1).toUpper() + elementName.mid(1);
- int methodCount = containerObject->metaObject()->methodCount();
- int i;
- for (i = 0; i < methodCount; ++i) {
- QMetaMethod metaMethod = containerObject->metaObject()->method(i);
- if (QString::fromLatin1(metaMethod.name()) == QString::fromLatin1("add%1").arg(elementName) ||
- QString::fromLatin1(metaMethod.name()) == QString::fromLatin1("set%1").arg(elementName)) {
- if (!metaMethod.invoke(containerObject, ::Q_ARG(QWrappedObject *, wrappedObject)))
- d->errors << QString::fromLatin1("Error when invoking metamethod '%1' on object '%2'.").arg(QString::fromLatin1(metaMethod.name())).arg(containerObject->objectName());
- break;
- }
- }
- if (i == methodCount)
- d->errors << QString::fromLatin1("Metamethod add/set'%1' not found on object '%2'.").arg(elementName).arg(containerObject->objectName());
- }
- stack.push(QPair<QString, QWrappedObject *>(reader.name().toString(), wrappedObject));
- }
- else
- d->errors << QString::fromLatin1("Could not cross reference instance with id '%1' in element '%2'. Bad formed XMI file ?").arg(id).arg(reader.name().toString());
- }
- else if (reader.isEndElement() && !stack.isEmpty() && stack.top().first == reader.name()) {
- stack.pop();
- if (stack.isEmpty() && !importedId.isEmpty())
- break;
- }
- }
-
- return wrappedObjectList;
-}
-
-QWrappedObject *QXmiReader::createInstance(QString instanceClass, QString instanceName)
-{
- int type;
- if ((type = QMetaType::type(instanceClass.toLatin1())) != QMetaType::UnknownType) {
- const QMetaObject *metaObject = QMetaType::metaObjectForType(type);
- if (metaObject) {
- QWrappedObject *wrappedObject = dynamic_cast<QWrappedObject *>(metaObject->newInstance());
- if (wrappedObject) {
- qTopLevelWrapper(wrappedObject)->setObjectName(instanceName);
- return wrappedObject;
- }
- }
- }
- return 0;
-}
-
-QStringList QXmiReader::errorStrings() const
-{
- Q_D(const QXmiReader);
-
- return d->errors;
-}
-
-#include "moc_qxmireader.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjects/qxmireader.h b/src/wrappedobjects/qxmireader.h
deleted file mode 100644
index f5e7641e..00000000
--- a/src/wrappedobjects/qxmireader.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QXMIREADER_H
-#define QTWRAPPEDOBJECTS_QXMIREADER_H
-
-#include <QtWrappedObjects/QtWrappedObjectsGlobal>
-
-#include <QtCore/QObject>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class QIODevice;
-class QWrappedObject;
-
-class QScriptEngine;
-class QXmiReaderPrivate;
-
-class Q_WRAPPEDOBJECTS_EXPORT QXmiReader : public QObject
-{
- Q_OBJECT
-
- Q_DISABLE_COPY(QXmiReader)
- Q_DECLARE_PRIVATE(QXmiReader)
-
-public:
- explicit QXmiReader(QScriptEngine *scriptEngine = 0, bool initMetaModel = false, QObject *parent = 0);
- virtual ~QXmiReader();
-
- QList<QWrappedObject *> readFile(QIODevice *device, QString importedId = QString::fromLatin1(""));
- QStringList errorStrings() const;
-
-protected:
- void loadPlugins();
- QWrappedObject *createInstance(QString instanceClass, QString instanceName);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QXMIREADER_H
-
diff --git a/src/wrappedobjects/qxmireader_p.h b/src/wrappedobjects/qxmireader_p.h
deleted file mode 100644
index 9eceeb56..00000000
--- a/src/wrappedobjects/qxmireader_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QXMIREADER_P_H
-#define QTWRAPPEDOBJECTS_QXMIREADER_P_H
-
-#include "qtwrappedobjectsglobal.h"
-#include "private/qobject_p.h"
-
-#include <QtCore/QStringList>
-#include <QtCore/QXmlStreamReader>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class QMetaModelPlugin;
-class QScriptEngine;
-
-class Q_WRAPPEDOBJECTS_EXPORT QXmiReaderPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QXmiReader)
-
-public:
- explicit QXmiReaderPrivate();
- virtual ~QXmiReaderPrivate();
-
- QHash<QString, QWrappedObject *> idMap;
- QHash< QString, QPair<QMetaModelPlugin *, QJsonObject> > metaModelPlugins;
- QHash<QString, QString> xmlNamespaceToImplementationNamespace;
- QStringList errors;
- QScriptEngine *scriptEngine;
- bool initMetaModel;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QXMIREADER_P_H
-
diff --git a/src/wrappedobjects/qxmiwriter.cpp b/src/wrappedobjects/qxmiwriter.cpp
deleted file mode 100644
index ebe498d3..00000000
--- a/src/wrappedobjects/qxmiwriter.cpp
+++ /dev/null
@@ -1,304 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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 "qxmiwriter.h"
-#include "qxmiwriter_p.h"
-#include "qwrappedobject.h"
-#include "qmetamodelplugin.h"
-#include "qmetawrappedobject.h"
-
-#include <QtCore/QSet>
-#include <QtCore/QDir>
-#include <QtCore/QJsonObject>
-#include <QtCore/QPluginLoader>
-#include <QtCore/QCoreApplication>
-#include <QtCore/QRegularExpression>
-
-QT_BEGIN_NAMESPACE
-
-QXmiWriterPrivate::QXmiWriterPrivate(QWrappedObject *wrappedObject)
- : wrappedObject(wrappedObject)
-{
- writer.setAutoFormatting(true);
- writer.setAutoFormattingIndent(2);
-}
-
-QXmiWriterPrivate::~QXmiWriterPrivate()
-{
-}
-
-QXmiWriter::QXmiWriter(QWrappedObject *wrappedObject, QObject *parent) :
- QObject(*new QXmiWriterPrivate(wrappedObject), parent)
-{
- loadPlugins();
-}
-
-QXmiWriter::~QXmiWriter()
-{
-}
-
-void QXmiWriter::loadPlugins()
-{
- Q_D(QXmiWriter);
-
- d->metaModelPlugins.clear();
- QMetaModelPlugin *metaModelPlugin = 0;
- foreach (QString pluginPath, QCoreApplication::libraryPaths()) {
- QDir pluginsDir(pluginPath);
- pluginsDir.cd(QString::fromLatin1("metamodels"));
- foreach (QString fileName, pluginsDir.entryList(QDir::Files)) {
- QPluginLoader loader(pluginsDir.absoluteFilePath(fileName));
- QObject *plugin = loader.instance();
- if (plugin && (metaModelPlugin = qobject_cast<QMetaModelPlugin *>(plugin)))
- d->metaModelPlugins.insert(loader.metaData().value(QString::fromLatin1("MetaData")).toObject().value(QString::fromLatin1("MetaModelNamespaceUri")).toString(), QPair<QMetaModelPlugin *, QJsonObject>(metaModelPlugin, loader.metaData().value(QString::fromLatin1("MetaData")).toObject()));
- }
- }
-}
-
-bool QXmiWriter::writeFile(QIODevice *device)
-{
- Q_D(QXmiWriter);
- d->writer.setDevice(device);
-
- d->writer.writeStartDocument();
- d->writer.writeStartElement(QString::fromLatin1("xmi:XMI"));
- d->writer.writeNamespace(QString::fromLatin1("http://www.omg.org/spec/XMI/20110701"), QString::fromLatin1("xmi"));
-
- QString metaModelClassName = QString::fromLatin1(d->wrappedObject->metaObject()->className());
- int pos = 2;
- while (metaModelClassName[pos] == metaModelClassName[pos].toLower()) pos++;
- QString metaModelImplementationNamespace = metaModelClassName.left(pos);
- typedef QPair<QMetaModelPlugin *, QJsonObject> PluginData;
- foreach (const PluginData &pair, d->metaModelPlugins.values()) {
- if (pair.second.value(QString::fromLatin1("MetaModelPrefix")).toString() == metaModelImplementationNamespace) {
- d->metaModelXmlNamespace = pair.second.value(QString::fromLatin1("MetaModelPrefix")).toString().mid(1).toLower();
- d->writer.writeNamespace(pair.second.value(QString::fromLatin1("MetaModelNamespaceUri")).toString(), d->metaModelXmlNamespace);
- break;
- }
- }
-
- d->idMap.clear();
- d->idStack.clear();
- d->blacklistedOppositeEnds.clear();
-
- d->visitedObjects.clear();
- populateIdMap(d->wrappedObject);
- d->visitedObjects.clear();
- writeWrappedObject(d->wrappedObject);
-
- d->writer.writeEndDocument();
- return true;
-}
-
-void QXmiWriter::populateIdMap(QWrappedObject *wrappedObject, int index)
-{
- Q_D(QXmiWriter);
-
- if (wrappedObject->metaWrappedObject()->indexOfProperty("name") != -1)
- d->idStack << wrappedObject->property("name").toString();
- else
- d->idStack << QString::fromLatin1(wrappedObject->metaObject()->className()).remove(QString::fromLatin1(wrappedObject->metaObject()->classInfo(wrappedObject->metaObject()->indexOfClassInfo("MetaModelPrefix")).value())) +
- QString::fromLatin1((index != -1) ? ".%1":"").arg(index);
- d->idMap.insert(wrappedObject, d->idStack.join(QString::fromLatin1("-")));
- d->visitedObjects.append(wrappedObject);
-
- const QMetaWrappedObject *metaWrappedObject = wrappedObject->metaWrappedObject();
- int propertyCount = metaWrappedObject->propertyCount();
-
- for (int i = 0; i < propertyCount; ++i) {
- QMetaPropertyInfo metaPropertyInfo = metaWrappedObject->property(i);
- QMetaProperty metaProperty = metaPropertyInfo.metaProperty;
- QWrappedObject *propertyWrappedObject = metaPropertyInfo.propertyWrappedObject;
- QString typeName = QString::fromLatin1(metaProperty.typeName());
- QVariant variant = metaProperty.read(propertyWrappedObject);
- QString aggregationRole = wrappedObject->propertyData(QString::fromLatin1(metaPropertyInfo.propertyMetaObject->className()),
- metaProperty,
- QtWrappedObjects::AggregationRole).toString();
-
- if (aggregationRole == QString::fromLatin1("composite"))
- if (!wrappedObject->propertyData(QString::fromLatin1(metaPropertyInfo.propertyMetaObject->className()),
- metaProperty,
- QtWrappedObjects::OppositeEndRole).toString().isEmpty()) {
- d->blacklistedOppositeEnds << wrappedObject->propertyData(QString::fromLatin1(metaPropertyInfo.propertyMetaObject->className()),
- metaProperty,
- QtWrappedObjects::OppositeEndRole).toString();
- }
-
- if (wrappedObject->propertyData(QString::fromLatin1(metaPropertyInfo.propertyMetaObject->className()),
- metaProperty,
- QtWrappedObjects::AggregationRole).toString() != QString::fromLatin1("composite"))
- continue;
-
- if (typeName.endsWith('*') && qvariant_cast<QWrappedObject *>(variant))
- populateIdMap(qTopLevelWrapper(qvariant_cast<QWrappedObject *>(variant)), 0);
- else if (typeName.contains(QString::fromLatin1("QSet")) && variant.isValid()) {
- QSet<QWrappedObject *> elements = *(static_cast<QSet<QWrappedObject *> *>(variant.data()));
- int i = 0;
- foreach (QWrappedObject *objectElement, elements) {
- if (!d->visitedObjects.contains(qTopLevelWrapper(objectElement)))
- populateIdMap(qTopLevelWrapper(objectElement), i++);
- }
- }
- else if (typeName.contains(QString::fromLatin1("QList")) && variant.isValid()) {
- QList<QWrappedObject *> elements = *(static_cast<QList<QWrappedObject *> *>(variant.data()));
- int i = 0;
- foreach (QWrappedObject *objectElement, elements) {
- if (!d->visitedObjects.contains(qTopLevelWrapper(objectElement)))
- populateIdMap(qTopLevelWrapper(objectElement), i++);
- }
- }
- }
-
- d->idStack.removeLast();
-}
-
-void QXmiWriter::writeWrappedObject(QWrappedObject *wrappedObject, QString elementName)
-{
- Q_D(QXmiWriter);
-
- if (d->visitedObjects.contains(wrappedObject))
- return;
-
- d->visitedObjects.append(wrappedObject);
-
- d->writer.writeStartElement(elementName.isEmpty() ? QString::fromLatin1(d->wrappedObject->metaObject()->className()).split(QString::fromLatin1("::")).last().remove(QString::fromLatin1(wrappedObject->metaObject()->classInfo(wrappedObject->metaObject()->indexOfClassInfo("MetaModelPrefix")).value())).prepend(QString::fromLatin1("%1:").arg(d->metaModelXmlNamespace))
- :
- elementName);
- if (!elementName.isEmpty())
- d->writer.writeAttribute(QString::fromLatin1("xmi:type"), QString::fromLatin1(wrappedObject->metaObject()->className()).remove(QString::fromLatin1(wrappedObject->metaObject()->classInfo(wrappedObject->metaObject()->indexOfClassInfo("MetaModelPrefix")).value())).prepend(QString::fromLatin1(wrappedObject->metaObject()->classInfo(wrappedObject->metaObject()->indexOfClassInfo("MetaModelPrefix")).value()).mid(1).toLower().append(QString::fromLatin1(":"))));
-
- const QMetaWrappedObject *metaWrappedObject = wrappedObject->metaWrappedObject();
- int propertyCount = metaWrappedObject->propertyCount();
-
- for (int i = propertyCount - 1; i >= 0; --i) {
- QMetaPropertyInfo metaPropertyInfo = metaWrappedObject->property(i);
- QMetaProperty metaProperty = metaPropertyInfo.metaProperty;
- QWrappedObject *propertyWrappedObject = metaPropertyInfo.propertyWrappedObject;
- QVariant variant = metaProperty.read(propertyWrappedObject);
-
- if (!metaProperty.isStored() || QString::fromLatin1(metaProperty.name()) == QString::fromLatin1("objectName") || QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo.propertyMetaObject->className()),
- metaProperty,
- QtWrappedObjects::IsDerivedUnionRole).toBool())
- continue;
-
- if (metaProperty.type() == QVariant::String) {
- QString value = variant.toString();
- if (!value.isEmpty())
- d->writer.writeAttribute(QString::fromLatin1(metaProperty.name()), value);
- }
- else if (metaProperty.type() == QVariant::Bool) {
- if (!metaProperty.isResettable() || (metaProperty.isResettable() && propertyWrappedObject->isPropertyModified(metaProperty)))
- d->writer.writeAttribute(QString::fromLatin1(metaProperty.name()), QString::fromLatin1(variant.toBool() ? "true":"false"));
- }
- else if (metaProperty.isEnumType()) {
- if (!metaProperty.isResettable() || (metaProperty.isResettable() && propertyWrappedObject->isPropertyModified(metaProperty))) {
- QMetaEnum metaEnum = metaProperty.enumerator();
- if (!QString::fromLatin1(metaEnum.key(variant.toInt())).isEmpty())
- d->writer.writeAttribute(QString::fromLatin1(metaProperty.name()), QString::fromLatin1(metaEnum.key(variant.toInt())).toLower().remove(QString::fromLatin1(metaProperty.name())));
- }
- }
- }
-
- d->writer.writeAttribute(QString::fromLatin1("xmi:id"), d->idMap.value(wrappedObject));
- for (int i = propertyCount - 1; i >= 0; --i) {
- QMetaPropertyInfo metaPropertyInfo = metaWrappedObject->property(i);
- QMetaProperty metaProperty = metaPropertyInfo.metaProperty;
-
- if (d->blacklistedOppositeEnds.contains(QString::fromLatin1("%1::%2").arg(QString::fromLatin1(metaPropertyInfo.propertyMetaObject->className())).arg(QString::fromLatin1(metaProperty.name()).remove(QRegularExpression(QString::fromLatin1("_$"))))))
- continue;
-
- QWrappedObject *propertyWrappedObject = metaPropertyInfo.propertyWrappedObject;
- QString typeName = QString::fromLatin1(metaProperty.typeName());
- QVariant variant = metaProperty.read(propertyWrappedObject);
- QString aggregationRole = wrappedObject->propertyData(QString::fromLatin1(metaPropertyInfo.propertyMetaObject->className()),
- metaProperty,
- QtWrappedObjects::AggregationRole).toString();
- QString modifiedPropertyName = QString::fromLatin1(metaProperty.name()).remove(QRegularExpression(QString::fromLatin1("_$"))).remove(QRegularExpression(QString::fromLatin1("s$"))).replace(QRegularExpression(QString::fromLatin1("ie$")), QString::fromLatin1("y")).replace(QRegularExpression(QString::fromLatin1("sse$")), QString::fromLatin1("ss")).replace(QRegularExpression(QString::fromLatin1("ice$")), QString::fromLatin1("ex")).replace(QRegularExpression(QString::fromLatin1("ce$")), QString::fromLatin1("x"));
-
- if (!metaProperty.isStored() || QWrappedObject::propertyData(QString::fromLatin1(metaPropertyInfo.propertyMetaObject->className()), metaProperty, QtWrappedObjects::IsDerivedUnionRole).toBool())
- continue;
-
- if (typeName.endsWith('*') && qvariant_cast<QWrappedObject *>(variant)) {
- if (aggregationRole == QString::fromLatin1("composite")) {
- writeWrappedObject(qTopLevelWrapper(qvariant_cast<QWrappedObject *>(variant)), modifiedPropertyName);
- }
- else {
- d->writer.writeStartElement(QString::fromLatin1(metaProperty.name()));
- d->writer.writeAttribute(QString::fromLatin1("xmi:idref"), d->idMap.value(qTopLevelWrapper(qvariant_cast<QWrappedObject *>(variant))));
- d->writer.writeEndElement();
- }
- }
- else if (typeName.contains(QString::fromLatin1("QSet")) && variant.isValid()) {
- QSet<QWrappedObject *> elements = *(static_cast<QSet<QWrappedObject *> *>(variant.data()));
- if (aggregationRole == QString::fromLatin1("composite")) {
- foreach (QWrappedObject *objectElement, elements)
- writeWrappedObject(qTopLevelWrapper(objectElement), modifiedPropertyName);
- }
- else {
- foreach (QWrappedObject *objectElement, elements) {
- d->writer.writeStartElement(QString::fromLatin1(metaProperty.name()));
- d->writer.writeAttribute(QString::fromLatin1("xmi:idref"), d->idMap.value(qTopLevelWrapper(objectElement)));
- d->writer.writeEndElement();
- }
- }
- }
- else if (typeName.contains(QString::fromLatin1("QList")) && variant.isValid()) {
- QList<QWrappedObject *> elements = *(static_cast<QList<QWrappedObject *> *>(variant.data()));
- if (aggregationRole == QString::fromLatin1("composite")) {
- foreach (QWrappedObject *objectElement, elements)
- writeWrappedObject(qTopLevelWrapper(objectElement), modifiedPropertyName);
- }
- else {
- foreach (QWrappedObject *objectElement, elements) {
- d->writer.writeStartElement(QString::fromLatin1(metaProperty.name()));
- d->writer.writeAttribute(QString::fromLatin1("xmi:idref"), d->idMap.value(qTopLevelWrapper(objectElement)));
- d->writer.writeEndElement();
- }
- }
- }
- }
-
- d->writer.writeEndElement();
-}
-
-#include "moc_qxmiwriter.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/wrappedobjects/qxmiwriter.h b/src/wrappedobjects/qxmiwriter.h
deleted file mode 100644
index 0d56927f..00000000
--- a/src/wrappedobjects/qxmiwriter.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QXMIWRITER_H
-#define QTWRAPPEDOBJECTS_QXMIWRITER_H
-
-#include <QtWrappedObjects/QtWrappedObjectsGlobal>
-
-#include <QtCore/QObject>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class QIODevice;
-class QWrappedObject;
-
-class QXmiWriterPrivate;
-
-class Q_WRAPPEDOBJECTS_EXPORT QXmiWriter : public QObject
-{
- Q_OBJECT
-
- Q_DISABLE_COPY(QXmiWriter)
- Q_DECLARE_PRIVATE(QXmiWriter)
-
-public:
- explicit QXmiWriter(QWrappedObject *wrappedObject, QObject *parent = 0);
- virtual ~QXmiWriter();
-
- bool writeFile(QIODevice *device);
-
-protected:
- void loadPlugins();
- void populateIdMap(QWrappedObject *wrappedObject, int index = -1);
- void writeWrappedObject(QWrappedObject *wrappedObject, QString elementName = QString::fromLatin1(""));
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QXMIWRITER_H
-
diff --git a/src/wrappedobjects/qxmiwriter_p.h b/src/wrappedobjects/qxmiwriter_p.h
deleted file mode 100644
index fc75da93..00000000
--- a/src/wrappedobjects/qxmiwriter_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org>
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the QtWrappedObjects 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$
-**
-****************************************************************************/
-#ifndef QTWRAPPEDOBJECTS_QXMIWRITER_P_H
-#define QTWRAPPEDOBJECTS_QXMIWRITER_P_H
-
-#include "qtwrappedobjectsglobal.h"
-#include "private/qobject_p.h"
-
-#include <QtCore/QStringList>
-#include <QtCore/QXmlStreamWriter>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(QtWrappedObjects)
-
-class QMetaModelPlugin;
-
-class Q_WRAPPEDOBJECTS_EXPORT QXmiWriterPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QXmiWriter)
-
-public:
- explicit QXmiWriterPrivate(QWrappedObject *wrappedObject);
- virtual ~QXmiWriterPrivate();
-
- QWrappedObject *wrappedObject;
- QXmlStreamWriter writer;
- QHash< QString, QPair<QMetaModelPlugin *, QJsonObject> > metaModelPlugins;
- QList<QWrappedObject *> visitedObjects;
- QHash<QWrappedObject *, QString> idMap;
- QStringList idStack;
- QString metaModelXmlNamespace;
- QStringList blacklistedOppositeEnds;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QTWRAPPEDOBJECTS_QXMIWRITER_P_H
-
diff --git a/src/wrappedobjects/wrappedobjects.pro b/src/wrappedobjects/wrappedobjects.pro
deleted file mode 100644
index 57768843..00000000
--- a/src/wrappedobjects/wrappedobjects.pro
+++ /dev/null
@@ -1,34 +0,0 @@
-load(qt_build_config)
-
-TARGET = QtWrappedObjects
-QT = core-private script
-
-QMAKE_DOCS = $$PWD/doc/qtwrappedobjects.qdocconf
-
-load(qt_module)
-
-PUBLIC_HEADERS += \
- qxmiwriter.h \
- qxmireader.h \
- qwrappedobject.h \
- qmetamodelplugin.h \
- qmetawrappedobject.h \
- qwrappedobjectpointer.h \
- qtwrappedobjectsglobal.h \
- qtwrappedobjectsnamespace.h
-
-PRIVATE_HEADERS += \
- qxmiwriter_p.h \
- qxmireader_p.h \
- qwrappedobject_p.h \
- qmetawrappedobject_p.h
-
-SOURCES += \
- qxmiwriter.cpp \
- qxmireader.cpp \
- qwrappedobject.cpp \
- qmetamodelplugin.cpp \
- qmetawrappedobject.cpp \
- qtwrappedobjectsnamespace.cpp
-
-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS