diff options
Diffstat (limited to 'examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend')
10 files changed, 0 insertions, 898 deletions
diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend.json b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend.json deleted file mode 100644 index 1952997f..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Category": "Architecture Recovery", - "Vendor": "Qt Project", - "Version": "1.0", - "DependencyList": [ - "ArchitectureRecoveryCorePlugin" - ] -} diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend.pro b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend.pro deleted file mode 100644 index 9c4cf0ab..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend.pro +++ /dev/null @@ -1,22 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2013-11-03T17:38:51 -# -#------------------------------------------------- - -include(../../duse-mt-plugin.pri) - -QT += widgets gui - -DEFINES += GCCXMLARCHITECTURERECOVERYBACKEND_LIBRARY - -HEADERS += gccxmlarchitecturerecoverybackend_export.h \ - gccxmlarchitecturerecoverybackendplugin.h \ - xmlfilemanager.h \ - xmlfilereader.h - -SOURCES += gccxmlarchitecturerecoverybackendplugin.cpp \ - xmlfilemanager.cpp \ - xmlfilereader.cpp - -OTHER_FILES += gccxmlarchitecturerecoverybackend.json diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend_dependencies.pri b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend_dependencies.pri deleted file mode 100644 index 2762fc82..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend_dependencies.pri +++ /dev/null @@ -1,4 +0,0 @@ -DUSEMT_PLUGIN_NAME = GccXmlArchitectureRecoveryBackend - -DUSEMT_PLUGIN_DEPENDS += \ - architecturerecoverycore diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend_export.h b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend_export.h deleted file mode 100644 index e96b5845..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackend_export.h +++ /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 QtUml 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 GCCXMLARCHITECTURERECOVERYBACKEND_EXPORT_H -#define GCCXMLARCHITECTURERECOVERYBACKEND_EXPORT_H - -#include <qglobal.h> - -#if defined(GCCXMLARCHITECTURERECOVERYBACKEND_LIBRARY) -# define GCCXMLARCHITECTURERECOVERYBACKEND_EXPORT Q_DECL_EXPORT -#else -# define GCCXMLARCHITECTURERECOVERYBACKEND_EXPORT Q_DECL_IMPORT -#endif - -#endif // GCCXMLARCHITECTURERECOVERYBACKEND_EXPORT_H diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.cpp b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.cpp deleted file mode 100644 index 220bf417..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.cpp +++ /dev/null @@ -1,302 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org> -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtUml 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 "gccxmlarchitecturerecoverybackendplugin.h" - -#include <QtWidgets/QAction> -#include <QtWidgets/QFileDialog> -#include <QtWidgets/QMessageBox> - -#include <QtCore/QDebug> -#include <QtCore/QProcess> -#include <QtCore/QXmlStreamReader> - -#include <duseinterfaces/iuicontroller.h> - -namespace DuSE -{ - -GccXmlArchitectureRecoveryBackendPlugin::GccXmlArchitectureRecoveryBackendPlugin(QObject *parent) : - IPlugin(parent) -{ - _name = "C++ (GCC-XML)"; - qRegisterMetaType<DependencyRelations>("DependencyRelations"); -} - -bool GccXmlArchitectureRecoveryBackendPlugin::initialize() -{ - return true; -} - - -QObjectList GccXmlArchitectureRecoveryBackendPlugin::components() -{ - QObjectList components; - - QObject *componentsDependencyRelations = new QObject; - componentsDependencyRelations->setProperty("components", QVariant::fromValue(_dependencyRelations)); - componentsDependencyRelations->setProperty("systemDirectory", QVariant::fromValue(_rootProjectDirectoryString)); - components.append(componentsDependencyRelations); - - return components; -} - -QObjectList GccXmlArchitectureRecoveryBackendPlugin::connectors() -{ - QObjectList connectors; - - return connectors; -} - -void GccXmlArchitectureRecoveryBackendPlugin::run() -{ - runGccXml(); - recoverDependencyRelations(); -} - -void GccXmlArchitectureRecoveryBackendPlugin::runGccXml() -{ - _rootProjectDirectoryString = QFileDialog::getExistingDirectory(0, "Escolha o diretório raíz do projeto", QDir::currentPath()); - - if (_rootProjectDirectoryString.isEmpty()) { - QMessageBox errorMessage; - errorMessage.setInformativeText("Diretório inválido."); - errorMessage.show(); - } else { - _rootProjectDirectory = QDir(_rootProjectDirectoryString); - _xmlFilesList = _xmlFileManager->generateXmlFiles(_rootProjectDirectory); - _xmlCount = _xmlFilesList.count(); - } -} - -void GccXmlArchitectureRecoveryBackendPlugin::recoverDependencyRelations() -{ - QString fileName; - - for (int i = 0; i < _xmlCount; ++i) { - fileName = _xmlFilesList.at(i).toLocal8Bit().constData(); - - _reader = new XmlFileReader(_rootProjectDirectory.absolutePath(), fileName); - - _reader->fillTagContainers(); - - _fileClasses.insert(fileName, _reader->fileClasses()); - _fileFields.insert(fileName, _reader->fileFields()); - _filePointers.insert(fileName, _reader->filePointers()); - _fileBases.insert(fileName, _reader->fileBases()); - _fileArguments.insert(fileName, _reader->fileArguments()); - - fieldAdjacencies(); - baseAdjacencies(); - argumentsAdjacencies(); - - qDebug() << "Tamanho de dependencyRelations: " << _dependencyRelations.count(); - } -} - -void GccXmlArchitectureRecoveryBackendPlugin::fieldAdjacencies() -{ - QString fileName; - - for (int i = 0; i < _xmlCount; ++i) { - - fileName = _xmlFilesList.at(i).toLocal8Bit().constData(); - - QMap<QString, QString> classes = _fileClasses.value(fileName); - QList<QPair<QString, QString> > fields = _fileFields.value(fileName); - QMap<QString, QString> pointers = _filePointers.value(fileName); - - QString dependent; - QString dependency; - - QStringList classIds = classes.keys(); - foreach (QString classId, classIds) { - dependent = classes.value(classId); - for (int i = 0; i < fields.size(); ++i) { - QPair<QString, QString> field = fields.at(i); - if (classId == field.first) { - if (classes.value(field.second).isEmpty()) { - QStringList pointersId = pointers.keys(); - foreach (QString pointerId, pointersId) { - if (field.second == pointerId) { - if (!classes.value(pointers.value(pointerId)).isEmpty()) { - dependency = classes.value(pointers.value(pointerId)); - } - } - } - } else { - dependency = classes.value(field.second); - } - } - - if (!_dependencyRelations.keys().contains(dependent)) { - if (!dependent.isEmpty() && !dependency.isEmpty()) { - _dependencyRelations.insert(dependent, dependency); - } - } else { - bool isNewDependencie = false; - QStringList dependencies = _dependencyRelations.values(dependent); - foreach (QString d, dependencies) { - if (dependency == d) { - isNewDependencie = true; - } - } - if (isNewDependencie == false) { - if (!dependent.isEmpty() && !dependency.isEmpty()) { - _dependencyRelations.insert(dependent, dependency); - } - } - } - - dependency = ""; - } - } - } -} - -void GccXmlArchitectureRecoveryBackendPlugin::baseAdjacencies() -{ - QString fileName; - - for (int i = 0; i < _xmlCount; ++i) { - - fileName = _xmlFilesList.at(i).toLocal8Bit().constData(); - - QMap<QString, QString> classes = _fileClasses.value(fileName); - QList<QPair<QString, QString> > bases = _fileBases.value(fileName); - - QString dependent; - QString dependency; - - QStringList classIds = classes.keys(); - foreach (QString classId, classIds) { - dependent = classes.value(classId); - for (int i = 0; i < bases.size(); ++i) { - QPair<QString, QString> base = bases.at(i); - if (classId == base.first) { - dependency = classes.value(base.second); - } - } - - if (!_dependencyRelations.keys().contains(dependent)) { - if (!dependent.isEmpty() && !dependency.isEmpty()) { - _dependencyRelations.insert(dependent, dependency); - } - } else { - bool isNewDependencie = false; - QStringList dependencies = _dependencyRelations.values(dependent); - foreach (QString d, dependencies) { - if (dependency == d) { - isNewDependencie = true; - } - } - if (isNewDependencie == false) { - if (!dependent.isEmpty() && !dependency.isEmpty()) { - _dependencyRelations.insert(dependent, dependency); - } - } - } - - dependency = ""; - } - } -} - -void GccXmlArchitectureRecoveryBackendPlugin::argumentsAdjacencies() -{ - QString fileName; - - for (int i = 0; i < _xmlCount; ++i) { - - fileName = _xmlFilesList.at(i).toLocal8Bit().constData(); - - QMap<QString, QString> classes = _fileClasses.value(fileName); - QList<QPair<QString, QString> > arguments = _fileArguments.value(fileName); - QMap<QString, QString> pointers = _filePointers.value(fileName); - - QString dependent; - QString dependency; - - QStringList classIds = classes.keys(); - foreach (QString classId, classIds) { - dependent = classes.value(classId); - for (int i = 0; i < arguments.size(); ++i) { - QPair<QString, QString> argument = arguments.at(i); - if (classId == argument.first) { - if (classes.value(argument.second).isEmpty()) { - QStringList pointersId = pointers.keys(); - foreach (QString pointerId, pointersId) { - if (argument.second == pointerId) { - if (!classes.value(pointers.value(pointerId)).isEmpty()) { - dependency = classes.value(pointers.value(pointerId)); - } - } - } - } else { - dependency = classes.value(argument.second); - } - } - } - - if (!_dependencyRelations.keys().contains(dependent)) { - if (!dependent.isEmpty() && !dependency.isEmpty()) { - _dependencyRelations.insert(dependent, dependency); - } - } else { - bool isNewDependencie = false; - QStringList dependencies = _dependencyRelations.values(dependent); - foreach (QString d, dependencies) { - if (dependency == d) { - isNewDependencie = true; - } - } - if (isNewDependencie == false) { - if (!dependent.isEmpty() && !dependency.isEmpty()) { - _dependencyRelations.insert(dependent, dependency); - } - } - } - - dependency = ""; - } - } -} - -} diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.h b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.h deleted file mode 100644 index e83efce8..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/gccxmlarchitecturerecoverybackendplugin.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 QtUml 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 GCCXMLARCHITECTURERECOVERYBACKENDPLUGIN_H -#define GCCXMLARCHITECTURERECOVERYBACKENDPLUGIN_H - -#include <duseinterfaces/iplugin.h> -#include <architecturerecoverycore/iarchitecturerecoverybackend.h> - -#include <QtCore/QDir> -#include <QtCore/QHash> -#include <QtCore/QObjectList> -#include <QtCore/QObject> -#include <QtCore/QStringList> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> - -#include "xmlfilemanager.h" -#include "xmlfilereader.h" - -#include "gccxmlarchitecturerecoverybackend_export.h" - -QT_BEGIN_NAMESPACE -class QXmlStreamReader; -QT_END_NAMESPACE - -namespace DuSE -{ - -class GCCXMLARCHITECTURERECOVERYBACKEND_EXPORT GccXmlArchitectureRecoveryBackendPlugin : public IPlugin, public IArchitectureRecoveryBackend -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.liveblue.DuSE.IPlugin" FILE "gccxmlarchitecturerecoverybackend.json") - -public: - GccXmlArchitectureRecoveryBackendPlugin(QObject *parent = 0); - - virtual bool initialize(); - - virtual QObjectList components(); - virtual QObjectList connectors(); - void run(); - void runGccXml(); - void recoverDependencyRelations(); - void fieldAdjacencies(); - void baseAdjacencies(); - void argumentsAdjacencies(); - -private Q_SLOTS: - -private: - int _xmlCount; - QDir _rootProjectDirectory; - QString _rootProjectDirectoryString; - QStringList _xmlFilesList; - XmlFileManager *_xmlFileManager; - XmlFileReader *_reader; - QMap<QString, QMap<QString, QString> > _fileClasses; - QMap<QString, QList<QPair<QString, QString> > > _fileFields; - QMap<QString, QMap<QString, QString> > _filePointers; - QMap<QString, QList<QPair<QString, QString> > > _fileBases; - QMap<QString, QList<QPair<QString, QString> > > _fileArguments; - QMultiMap<QString, QString> _dependencyRelations; -}; - -typedef QMultiMap<QString, QString> DependencyRelations; - -#endif // GCCXMLARCHITECTURERECOVERYBACKENDPLUGIN - -} - -Q_DECLARE_METATYPE(DuSE::DependencyRelations); diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilemanager.cpp b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilemanager.cpp deleted file mode 100644 index fee7f8d5..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilemanager.cpp +++ /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 QtUml 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 "xmlfilemanager.h" - -#include <QtCore/QDir> -#include <QtCore/QProcess> -#include <QtCore/QXmlStreamReader> - -namespace DuSE -{ - -XmlFileManager::XmlFileManager() -{ -} - -QStringList XmlFileManager::generateXmlFiles(const QDir &rootProjectDir) const -{ - QStringList headers = rootProjectDir.entryList(QStringList("*.h"), QDir::Files | QDir::NoSymLinks); - - int codeFilesSize = headers.size(); - - for (int i = 0; i < codeFilesSize; ++i) { - QString file = headers.at(i).toLocal8Bit().constData(); - QString fileDir = rootProjectDir.absolutePath() + "/" + file; - QString xmlFileDir = rootProjectDir.absolutePath() + "/" + file.replace(".h", ".xml"); - - QProcess process; - process.start("gccxml " + fileDir + " -fxml=" + xmlFileDir); - process.waitForFinished(); - } - - return rootProjectDir.entryList(QStringList("*.xml"), QDir::Files | QDir::NoSymLinks); -} - -QXmlStreamReader *XmlFileManager::openXmlFile(const QString &filePath) -{ - _xmlFile.setFileName(filePath); - _xmlReader = new QXmlStreamReader(&_xmlFile); - - if (!_xmlFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - return new QXmlStreamReader; - } - - return _xmlReader; -} - -void XmlFileManager::closeXmlFile() -{ - if (_xmlFile.isOpen()) { - _xmlFile.close(); - } -} - -} diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilemanager.h b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilemanager.h deleted file mode 100644 index cad93994..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilemanager.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 QtUml 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 XMLFILEMANAGER_H -#define XMLFILEMANAGER_H - -#include <QtCore/QFile> -#include <QtCore/QStringList> - -QT_BEGIN_NAMESPACE -class QDir; -class QXmlStreamReader; -QT_END_NAMESPACE - -namespace DuSE -{ - -class XmlFileManager -{ -public: - XmlFileManager(); - - ~XmlFileManager(); - - QStringList generateXmlFiles(const QDir &rootProjectDir) const; - QXmlStreamReader* openXmlFile(const QString &filePath); - void closeXmlFile(); - -private: - QFile _xmlFile; - QXmlStreamReader *_xmlReader; -}; - -} - -#endif // XMLFILEMANAGER_H diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilereader.cpp b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilereader.cpp deleted file mode 100644 index 79ce4297..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilereader.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org> -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtUml 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 "xmlfilereader.h" - -#include <QXmlStreamAttributes> - -namespace DuSE -{ - -XmlFileReader::XmlFileReader(QString rootDirectory, QString fileName) - : _rootProjectDir(rootDirectory), _fileName(fileName) -{ - _xmlFileManager = new XmlFileManager; -} - -void XmlFileReader::fillTagContainers() -{ - _xmlReader = _xmlFileManager->openXmlFile(_rootProjectDir + "/" + _fileName); - - while (!_xmlReader->atEnd() & !_xmlReader->hasError()) { - QXmlStreamReader::TokenType token = _xmlReader->readNext(); - QPair<QString, QString> auxPair; - - if (token == QXmlStreamReader::StartElement) { - QXmlStreamAttributes attributes; - - if (_xmlReader->name() == "Class") { - attributes = _xmlReader->attributes(); - QString classId = attributes.value("id").toString(); - QString className = attributes.value("name").toString(); - if (!_fileClasses.values().contains(className)) { - _fileClasses.insert(classId, className); - } - - do { - if (_xmlReader->readNextStartElement()) { - if (_xmlReader->name() == "Base") { - attributes = _xmlReader->attributes(); - QString baseType = attributes.value("type").toString(); - auxPair.first = classId; - auxPair.second = baseType; - _fileBases.append(auxPair); - } - } - } while (_xmlReader->name() == "Base"); - } - - if (_xmlReader->name() == "Field") { - attributes = _xmlReader->attributes(); - QString fieldContext = attributes.value("context").toString(); - QString fieldType = attributes.value("type").toString(); - auxPair.first = fieldContext; - auxPair.second = fieldType; - _fileFields.append(auxPair); - } - - if (_xmlReader->name() == "PointerType") { - attributes = _xmlReader->attributes(); - QString pointerId = attributes.value("id").toString(); - QString pointerType = attributes.value("type").toString(); - auxPair.first = pointerId; - auxPair.second = pointerType; - _filePointers.insert(pointerId, pointerType); - } - - - if (_xmlReader->name() == "Method") { - attributes = _xmlReader->attributes(); - QString methodContext = attributes.value("context").toString(); - - do { - if (_xmlReader->readNextStartElement()) { - if (_xmlReader->name() == "Argument") { - attributes = _xmlReader->attributes(); - QString argumentType = attributes.value("type").toString(); - auxPair.first = methodContext; - auxPair.second = argumentType; - _fileArguments.append(auxPair); - } - } - } while (_xmlReader->name() == "Argument"); - } - } - } _xmlFileManager->closeXmlFile(); -} - -QMap<QString, QString> XmlFileReader::fileClasses() -{ - return _fileClasses; -} - -QList<QPair<QString, QString> > XmlFileReader::fileFields() -{ - return _fileFields; -} - -QMap<QString, QString> XmlFileReader::filePointers() -{ - return _filePointers; -} - -QList<QPair<QString, QString> > XmlFileReader::fileBases() -{ - return _fileBases; -} - -QList<QPair<QString, QString> > XmlFileReader::fileArguments() -{ - return _fileArguments; -} - -} diff --git a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilereader.h b/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilereader.h deleted file mode 100644 index 6059c8f5..00000000 --- a/examples/uml/duse-mt/src/plugins/gccxmlarchitecturerecoverybackend/xmlfilereader.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Sandro S. Andrade <sandroandrade@kde.org> -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtUml 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 XMLFILEREADER_H -#define XMLFILEREADER_H - -#include <QHash> -#include <QList> -#include <QMultiMap> -#include <QtCore/QStringList> - -QT_BEGIN_NAMESPACE -class QXmlStreamReader; -QT_END_NAMESPACE - -#include "xmlfilemanager.h" - -namespace DuSE -{ - -class XmlFileReader -{ -public: - XmlFileReader(QString rootDirectory, QString fileName); - ~XmlFileReader(); - - void fillTagContainers(); - QMap<QString, QString> fileClasses(); - QList<QPair<QString, QString> > fileFields(); - QMap<QString, QString> filePointers(); - QList<QPair<QString, QString> > fileBases(); - QList<QPair<QString, QString> > fileArguments(); - -private: - QString _rootProjectDir; - QString _fileName; - QXmlStreamReader *_xmlReader; - XmlFileManager *_xmlFileManager; - QMap<QString, QString> _fileClasses; - QList<QPair<QString, QString> > _fileFields; - QMap<QString, QString> _filePointers; - QList<QPair<QString, QString> > _fileBases; - QList<QPair<QString, QString> > _fileArguments; -}; - -} - -#endif // XMLFILEREADER_H |