Commit d6d0bf96 authored by Ralf Habacker's avatar Ralf Habacker
Browse files

Add class member m_doc to CppTree2Uml and use it instead of the long pointer hierachy

parent dbf7c7ee
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
CppTree2Uml::CppTree2Uml(const QString& fileName, CodeImpThread* thread) CppTree2Uml::CppTree2Uml(const QString& fileName, CodeImpThread* thread)
: m_thread(thread), : m_thread(thread),
m_rootFolder(0) m_rootFolder(0),
m_doc(UMLApp::app()->document())
{ {
clear(); clear();
QDir dir(fileName); QDir dir(fileName);
...@@ -72,8 +73,7 @@ void CppTree2Uml::setRootPath(const QString &rootPath) ...@@ -72,8 +73,7 @@ void CppTree2Uml::setRootPath(const QString &rootPath)
m_rootPath = rootPath; m_rootPath = rootPath;
if (Settings::optionState().codeImportState.createArtifacts) { if (Settings::optionState().codeImportState.createArtifacts) {
if (!m_rootFolder) { if (!m_rootFolder) {
UMLDoc *umldoc = UMLApp::app()->document(); UMLFolder *componentView = m_doc->rootFolder(Uml::ModelType::Component);
UMLFolder *componentView = umldoc->rootFolder(Uml::ModelType::Component);
if (!m_rootPath.isEmpty()) { if (!m_rootPath.isEmpty()) {
UMLFolder *root = Import_Utils::createSubDir(m_rootPath, componentView); UMLFolder *root = Import_Utils::createSubDir(m_rootPath, componentView);
m_rootFolder = root; m_rootFolder = root;
...@@ -121,9 +121,9 @@ void CppTree2Uml::parseNamespace(NamespaceAST* ast) ...@@ -121,9 +121,9 @@ void CppTree2Uml::parseNamespace(NamespaceAST* ast)
if (m_thread) { if (m_thread) {
m_thread->emitMessageToLog(QString(), QLatin1String("namespace ") + nsName); m_thread->emitMessageToLog(QString(), QLatin1String("namespace ") + nsName);
} }
UMLObject *o = UMLApp::app()->document()->findUMLObject(nsName, UMLObject::ot_Package, m_currentNamespace[m_nsCnt]); UMLObject *o = m_doc->findUMLObject(nsName, UMLObject::ot_Package, m_currentNamespace[m_nsCnt]);
if (!o) if (!o)
o = UMLApp::app()->document()->findUMLObject(nsName, UMLObject::ot_Class, m_currentNamespace[m_nsCnt]); o = m_doc->findUMLObject(nsName, UMLObject::ot_Class, m_currentNamespace[m_nsCnt]);
if (o && o->stereotype() == QLatin1String("class-or-package")) { if (o && o->stereotype() == QLatin1String("class-or-package")) {
o->setStereotype(QString()); o->setStereotype(QString());
o->setBaseType(UMLObject::ot_Package); o->setBaseType(UMLObject::ot_Package);
...@@ -403,9 +403,9 @@ void CppTree2Uml::parseClassSpecifier(ClassSpecifierAST* ast) ...@@ -403,9 +403,9 @@ void CppTree2Uml::parseClassSpecifier(ClassSpecifierAST* ast)
className = QLatin1String("anon_") + QString::number(m_anon); className = QLatin1String("anon_") + QString::number(m_anon);
m_anon++; m_anon++;
} }
UMLObject *o = UMLApp::app()->document()->findUMLObject(className, UMLObject::ot_Class, m_currentNamespace[m_nsCnt]); UMLObject *o = m_doc->findUMLObject(className, UMLObject::ot_Class, m_currentNamespace[m_nsCnt]);
if (!o) if (!o)
o = UMLApp::app()->document()->findUMLObject(className, UMLObject::ot_Datatype, m_currentNamespace[m_nsCnt]); o = m_doc->findUMLObject(className, UMLObject::ot_Datatype, m_currentNamespace[m_nsCnt]);
if (o && o->stereotype() == QLatin1String("class-or-package")) { if (o && o->stereotype() == QLatin1String("class-or-package")) {
o->setStereotype(QString()); o->setStereotype(QString());
o->setBaseType(UMLObject::ot_Class); o->setBaseType(UMLObject::ot_Class);
......
...@@ -93,6 +93,7 @@ private: ...@@ -93,6 +93,7 @@ private:
CodeImpThread* m_thread; CodeImpThread* m_thread;
QString m_rootPath; ///< root path of project QString m_rootPath; ///< root path of project
UMLFolder *m_rootFolder; UMLFolder *m_rootFolder;
UMLDoc *m_doc;
private: private:
CppTree2Uml(const CppTree2Uml& source); CppTree2Uml(const CppTree2Uml& source);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment