diff --git a/src/plugins/analyzerbase/analyzerutils.cpp b/src/plugins/analyzerbase/analyzerutils.cpp index c26d4fa8ecabbeef4a420c792af8660259a966af..b9a22bb4153319f1314321f5c906d1b7626ee570 100644 --- a/src/plugins/analyzerbase/analyzerutils.cpp +++ b/src/plugins/analyzerbase/analyzerutils.cpp @@ -31,14 +31,14 @@ #include "analyzerconstants.h" -#include +#include #include #include #include #include -#include +#include #include @@ -72,7 +72,7 @@ CPlusPlus::Symbol *AnalyzerUtils::findSymbolUnderCursor() const int pos = tc.position(); editor->convertPosition(pos, &line, &column); - const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManagerInterface::instance()->snapshot(); + const CPlusPlus::Snapshot &snapshot = CppTools::CppModelManager::instance()->snapshot(); CPlusPlus::Document::Ptr doc = snapshot.document(editor->document()->filePath()); QTC_ASSERT(doc, return 0); diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index 91ddbdde669c15c1775cb3b0dea0a6a958a0c05d..059327c2a5fae59df753be1b9a457c0add189951 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #include @@ -400,8 +400,8 @@ QList AutotoolsProject::nodes(FolderNode *parent) const void AutotoolsProject::updateCppCodeModel() { - CppTools::CppModelManagerInterface *modelManager = - CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *modelManager = + CppTools::CppModelManager::instance(); if (!modelManager) return; diff --git a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp index 40ed8725c9b660e840d37de3a4c9107ad9715c6c..cf2f962128576b2cca99605992296c65d8e1f3e4 100644 --- a/src/plugins/clangcodemodel/clangcodemodelplugin.cpp +++ b/src/plugins/clangcodemodel/clangcodemodelplugin.cpp @@ -67,18 +67,18 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err #ifdef CLANG_INDEXING m_indexer.reset(new ClangIndexer); - CppTools::CppModelManagerInterface::instance()->setIndexingSupport(m_indexer->indexingSupport()); + CppTools::CppModelManager::instance()->setIndexingSupport(m_indexer->indexingSupport()); #endif // CLANG_INDEXING // wire up the pch manager QObject *session = ProjectExplorer::SessionManager::instance(); connect(session, SIGNAL(aboutToRemoveProject(ProjectExplorer::Project*)), pchManager, SLOT(onAboutToRemoveProject(ProjectExplorer::Project*))); - connect(CppTools::CppModelManagerInterface::instance(), SIGNAL(projectPartsUpdated(ProjectExplorer::Project*)), + connect(CppTools::CppModelManager::instance(), SIGNAL(projectPartsUpdated(ProjectExplorer::Project*)), pchManager, SLOT(onProjectPartsUpdated(ProjectExplorer::Project*))); m_modelManagerSupport.reset(new ModelManagerSupport); - CppTools::CppModelManagerInterface::instance()->addModelManagerSupport( + CppTools::CppModelManager::instance()->addModelManagerSupport( m_modelManagerSupport.data()); return true; diff --git a/src/plugins/clangcodemodel/clangcompletion.cpp b/src/plugins/clangcodemodel/clangcompletion.cpp index 1958c16de7ccb122358f62c0ce82ea8856aee0fa..ec7855b0ac692d1e1704037b020ea3687cff45e6 100644 --- a/src/plugins/clangcodemodel/clangcompletion.cpp +++ b/src/plugins/clangcodemodel/clangcompletion.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include @@ -208,7 +208,7 @@ AssistInterface *ClangCompletionAssistProvider::createAssistInterface( { Q_UNUSED(isObjCEnabled); - CppModelManagerInterface *modelManager = CppModelManagerInterface::instance(); + CppModelManager *modelManager = CppModelManager::instance(); QList parts = modelManager->projectPart(filePath); if (parts.isEmpty()) parts += modelManager->fallbackProjectPart(); @@ -558,7 +558,7 @@ ClangCompletionAssistInterface::ClangCompletionAssistInterface(ClangCompleter::P { Q_ASSERT(!clangWrapper.isNull()); - CppModelManagerInterface *mmi = CppModelManagerInterface::instance(); + CppModelManager *mmi = CppModelManager::instance(); Q_ASSERT(mmi); m_unsavedFiles = Utils::createUnsavedFiles(mmi->workingCopy()); } diff --git a/src/plugins/clangcodemodel/clangcompletion.h b/src/plugins/clangcodemodel/clangcompletion.h index 0f9ada9efd55f6014215a0daa5122e046e0d4350..6ecb262f6009ad25a0347e8a5710788a432b34c9 100644 --- a/src/plugins/clangcodemodel/clangcompletion.h +++ b/src/plugins/clangcodemodel/clangcompletion.h @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/clangcodemodel/clangeditordocumentparser.cpp b/src/plugins/clangcodemodel/clangeditordocumentparser.cpp index f5e40bf6e2843a2b31331c21249637f5fc7dadf1..4c0a0c48d160a12ad8d016e462f016b69ce70e48 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentparser.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentparser.cpp @@ -32,7 +32,7 @@ #include "pchinfo.h" #include "pchmanager.h" -#include +#include #include #include diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp index 8ef76bf630b9474284d78a8056650c4ed4f75887..f485bffd5ace930bc99d8e6c09ed493cad1fe7e3 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp @@ -126,7 +126,7 @@ void ClangEditorDocumentProcessor::run() { // Run clang parser const CppTools::WorkingCopy workingCopy - = CppTools::CppModelManagerInterface::instance()->workingCopy(); + = CppTools::CppModelManager::instance()->workingCopy(); disconnect(&m_parserWatcher, &QFutureWatcher::finished, this, &ClangEditorDocumentProcessor::onParserFinished); diff --git a/src/plugins/clangcodemodel/clangindexer.cpp b/src/plugins/clangcodemodel/clangindexer.cpp index 160636b2df7b644e0a308a7b16546b1f74a530d8..f0e5f0228659ffa53ab426146d291f9f01bffa5d 100644 --- a/src/plugins/clangcodemodel/clangindexer.cpp +++ b/src/plugins/clangcodemodel/clangindexer.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include @@ -94,7 +94,7 @@ CppTools::CppIndexingSupport *ClangIndexer::indexingSupport() QFuture ClangIndexer::refreshSourceFiles(const QStringList &sourceFiles) { typedef CppTools::ProjectPart ProjectPart; - CppTools::CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *mmi = CppTools::CppModelManager::instance(); LiveUnitsManager *lum = LiveUnitsManager::instance(); if (m_clangIndexer->isBusy()) @@ -149,7 +149,7 @@ void ClangIndexer::indexNow(Unit::Ptr unit) typedef CppTools::ProjectPart ProjectPart; QString file = unit->fileName(); - CppTools::CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *mmi = CppTools::CppModelManager::instance(); const QList &parts = mmi->projectPart(file); ProjectPart::Ptr part; if (!parts.isEmpty()) diff --git a/src/plugins/clangcodemodel/clangutils.h b/src/plugins/clangcodemodel/clangutils.h index 132b03da904c7ed5bf36c08158821aed729f5e26..85f5f9e7bae96b65cce8b2d58acef35cb23cddf6 100644 --- a/src/plugins/clangcodemodel/clangutils.h +++ b/src/plugins/clangcodemodel/clangutils.h @@ -32,7 +32,7 @@ #include "utils.h" -#include +#include namespace ClangCodeModel { namespace Utils { diff --git a/src/plugins/clangcodemodel/indexer.h b/src/plugins/clangcodemodel/indexer.h index 9b6e8c1297b00af8f01b0b2a53d92c205b01fd79..d67523948ba1034cae153b118de50e580c25100a 100644 --- a/src/plugins/clangcodemodel/indexer.h +++ b/src/plugins/clangcodemodel/indexer.h @@ -34,7 +34,7 @@ #include "symbol.h" #include "unit.h" -#include +#include #include #include diff --git a/src/plugins/clangcodemodel/pchmanager.cpp b/src/plugins/clangcodemodel/pchmanager.cpp index 2f2e95b9341d69376c243970d6f3c58d5a4572d6..444c05563306c36fe174350f49e311f7903677e3 100644 --- a/src/plugins/clangcodemodel/pchmanager.cpp +++ b/src/plugins/clangcodemodel/pchmanager.cpp @@ -142,7 +142,7 @@ void PchManager::onProjectPartsUpdated(ProjectExplorer::Project *project) ClangProjectSettings *cps = settingsForProject(project); Q_ASSERT(cps); - CppTools::CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *mmi = CppTools::CppModelManager::instance(); const QList projectParts = mmi->projectInfo( cps->project()).projectParts(); updatePchInfo(cps, projectParts); @@ -435,7 +435,7 @@ void PchManager::updateActivePchFiles() QMutexLocker locker(&m_mutex); QSet activeParts; - CppTools::CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *mmi = CppTools::CppModelManager::instance(); foreach (const CppTools::ProjectInfo &pi, mmi->projectInfos()) activeParts.unite(QSet::fromList(pi.projectParts())); QList partsWithPCHFiles = m_activePchFiles.keys(); diff --git a/src/plugins/clangcodemodel/pchmanager.h b/src/plugins/clangcodemodel/pchmanager.h index dafca695dbf13a19bd334e8b35fbdfb83561e018..846ee8f75b684e795bf2d91f2675280507926162 100644 --- a/src/plugins/clangcodemodel/pchmanager.h +++ b/src/plugins/clangcodemodel/pchmanager.h @@ -33,7 +33,7 @@ #include "clangprojectsettings.h" #include "pchinfo.h" -#include +#include #include #include diff --git a/src/plugins/classview/classviewmanager.cpp b/src/plugins/classview/classviewmanager.cpp index 09d77966487060b0f703af176cc3b416285b7926..564d6140637e572f171b9b2ab684464eb0c45d79 100644 --- a/src/plugins/classview/classviewmanager.cpp +++ b/src/plugins/classview/classviewmanager.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -269,8 +269,8 @@ void Manager::initialize() &d->parser, SLOT(setFlatMode(bool)), Qt::QueuedConnection); // connect to the cpp model manager for signals about document updates - CppTools::CppModelManagerInterface *codeModelManager - = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *codeModelManager + = CppTools::CppModelManager::instance(); // when code manager signals that document is updated - handle it by ourselves connect(codeModelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), diff --git a/src/plugins/classview/classviewparser.cpp b/src/plugins/classview/classviewparser.cpp index 828e42d6c40fd38a6a424ac434c8ac37971caa81..66a295f0c8d591d256f063ea92c46484b8137719 100644 --- a/src/plugins/classview/classviewparser.cpp +++ b/src/plugins/classview/classviewparser.cpp @@ -38,7 +38,7 @@ #include // other -#include +#include #include #include #include @@ -666,7 +666,7 @@ void Parser::resetData(const CPlusPlus::Snapshot &snapshot) void Parser::resetDataToCurrentState() { // get latest data - CppTools::CppModelManagerInterface *codeModel = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *codeModel = CppTools::CppModelManager::instance(); if (codeModel) resetData(codeModel->snapshot()); } diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 4816f2123681b04f991f96a4a2303e1275c36cd9..416ae5fb4781dc15fd404e36bcd470bc39d123d0 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -53,7 +53,7 @@ #include #include #include -#include +#include #include #include #include @@ -326,8 +326,8 @@ bool CMakeProject::parseCMakeLists() return true; } - CppTools::CppModelManagerInterface *modelmanager = - CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *modelmanager = + CppTools::CppModelManager::instance(); if (modelmanager) { CppTools::ProjectInfo pinfo = modelmanager->projectInfo(this); pinfo.clearProjectParts(); diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp index b6c19c6dbc83a9c2093944569481fb12f70aa831..9ea746247dee8540549a1a3832127b1307a5966c 100644 --- a/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp +++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.cpp @@ -1339,7 +1339,7 @@ void CppCodeModelInspectorDialog::onWorkingCopyDocumentSelected(const QModelInde void CppCodeModelInspectorDialog::refresh() { - CppTools::CppModelManagerInterface *cmmi = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *cmmi = CppTools::CppModelManager::instance(); const int oldSnapshotIndex = m_ui->snapshotSelector->currentIndex(); const bool selectEditorRelevant diff --git a/src/plugins/cppeditor/cppcodemodelinspectordialog.h b/src/plugins/cppeditor/cppcodemodelinspectordialog.h index 569453c001356cf4d47884dfd35b7fa4c88fec9a..0acf938979c1c998bc838662f911739cc47201b6 100644 --- a/src/plugins/cppeditor/cppcodemodelinspectordialog.h +++ b/src/plugins/cppeditor/cppcodemodelinspectordialog.h @@ -30,7 +30,7 @@ #ifndef CPPCODEMODELINSPECTORDIALOG_H #define CPPCODEMODELINSPECTORDIALOG_H -#include +#include #include diff --git a/src/plugins/cppeditor/cppdoxygen_test.cpp b/src/plugins/cppeditor/cppdoxygen_test.cpp index e967ba053f9dd6d1e73e1e628e506efa375c7802..6d17d7fa4b34b9df2fe028b29dd90bf7687a9866 100644 --- a/src/plugins/cppeditor/cppdoxygen_test.cpp +++ b/src/plugins/cppeditor/cppdoxygen_test.cpp @@ -31,7 +31,7 @@ #include "cppeditortestcase.h" #include -#include +#include #include #include diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index d2f21507d02fd34f74cc9a0d54888983e02de933..36c24fd5144cfd1bcd74cb8b0c46cb7e85435608 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -50,7 +50,7 @@ #include #include #include -#include +#include #include #include #include @@ -102,7 +102,7 @@ public: CppEditorWidgetPrivate(CppEditorWidget *q); public: - QPointer m_modelManager; + QPointer m_modelManager; CppEditorDocument *m_cppEditorDocument; CppEditorOutline *m_cppEditorOutline; @@ -126,7 +126,7 @@ public: }; CppEditorWidgetPrivate::CppEditorWidgetPrivate(CppEditorWidget *q) - : m_modelManager(CppModelManagerInterface::instance()) + : m_modelManager(CppModelManager::instance()) , m_cppEditorDocument(qobject_cast(q->textDocument())) , m_cppEditorOutline(new CppEditorOutline(q)) , m_cppDocumentationCommentHelper(q) @@ -302,7 +302,7 @@ void CppEditorWidget::findUsages() return; SemanticInfo info = d->m_lastSemanticInfo; - info.snapshot = CppModelManagerInterface::instance()->snapshot(); + info.snapshot = CppModelManager::instance()->snapshot(); info.snapshot.insert(info.doc); if (const Macro *macro = CppTools::findCanonicalMacro(textCursor(), info.doc)) { @@ -321,7 +321,7 @@ void CppEditorWidget::renameUsages(const QString &replacement) return; SemanticInfo info = d->m_lastSemanticInfo; - info.snapshot = CppModelManagerInterface::instance()->snapshot(); + info.snapshot = CppModelManager::instance()->snapshot(); info.snapshot.insert(info.doc); if (const Macro *macro = CppTools::findCanonicalMacro(textCursor(), info.doc)) { @@ -694,7 +694,7 @@ void CppEditorWidget::updateFunctionDeclDefLinkNow() if (!isSemanticInfoValidExceptLocalUses()) return; - Snapshot snapshot = CppModelManagerInterface::instance()->snapshot(); + Snapshot snapshot = CppModelManager::instance()->snapshot(); snapshot.insert(semanticDoc); d->m_declDefLinkFinder->startFindLinkAt(textCursor(), semanticDoc, snapshot); diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp index b2472fecb37502c2d724979f6c5288c4253d2bc7..559b38768f8b42058296418769a584bc0819cdb9 100644 --- a/src/plugins/cppeditor/cppeditordocument.cpp +++ b/src/plugins/cppeditor/cppeditordocument.cpp @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -50,9 +50,9 @@ namespace { -CppTools::CppModelManagerInterface *mm() +CppTools::CppModelManager *mm() { - return CppTools::CppModelManagerInterface::instance(); + return CppTools::CppModelManager::instance(); } } // anonymous namespace diff --git a/src/plugins/cppeditor/cppeditordocument.h b/src/plugins/cppeditor/cppeditordocument.h index 7f1534844e3cfe5b80e70263a2bdc820edcd2068..13bfd66fc3e22e937f43d5ecfaae47f943359f46 100644 --- a/src/plugins/cppeditor/cppeditordocument.h +++ b/src/plugins/cppeditor/cppeditordocument.h @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include diff --git a/src/plugins/cppeditor/cppeditoroutline.cpp b/src/plugins/cppeditor/cppeditoroutline.cpp index 969108a50e731d2c6e508dc7044419bbc62b0de9..52ff50b82965e7cec4f3ecb8a7e0ec6a97e35bac 100644 --- a/src/plugins/cppeditor/cppeditoroutline.cpp +++ b/src/plugins/cppeditor/cppeditoroutline.cpp @@ -32,7 +32,7 @@ #include "cppeditor.h" #include "cppeditorplugin.h" -#include +#include #include #include @@ -189,7 +189,7 @@ QWidget *CppEditorOutline::widget() const void CppEditorOutline::updateNow() { - CppTools::CppModelManagerInterface *cmmi = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *cmmi = CppTools::CppModelManager::instance(); if (!cmmi) return; diff --git a/src/plugins/cppeditor/cppeditorplugin.cpp b/src/plugins/cppeditor/cppeditorplugin.cpp index cb00366018af943b8cd648e391d5e347dbf9b638..6b4e5caf310aa6f74ea2d40a1056fc6cb2d16d45 100644 --- a/src/plugins/cppeditor/cppeditorplugin.cpp +++ b/src/plugins/cppeditor/cppeditorplugin.cpp @@ -288,7 +288,7 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err cppToolsMenu->addSeparator(globalContext); m_reparseExternallyChangedFiles = new QAction(tr("Reparse Externally Changed Files"), this); cmd = ActionManager::registerAction(m_reparseExternallyChangedFiles, Constants::UPDATE_CODEMODEL, globalContext); - CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *cppModelManager = CppTools::CppModelManager::instance(); connect(m_reparseExternallyChangedFiles, SIGNAL(triggered()), cppModelManager, SLOT(updateModifiedSourceFiles())); cppToolsMenu->addAction(cmd); diff --git a/src/plugins/cppeditor/cppelementevaluator.cpp b/src/plugins/cppeditor/cppelementevaluator.cpp index f833d2e387b07730deea34fe5b3c4cde7141c8ab..859fb5aa5b50df45461ea430921a9f8315d81360 100644 --- a/src/plugins/cppeditor/cppelementevaluator.cpp +++ b/src/plugins/cppeditor/cppelementevaluator.cpp @@ -63,7 +63,7 @@ static QStringList stripName(const QString &name) CppElementEvaluator::CppElementEvaluator(TextEditor::BaseTextEditorWidget *editor) : m_editor(editor), - m_modelManager(CppTools::CppModelManagerInterface::instance()), + m_modelManager(CppTools::CppModelManager::instance()), m_tc(editor->textCursor()), m_lookupBaseClasses(false), m_lookupDerivedClasses(false) diff --git a/src/plugins/cppeditor/cppelementevaluator.h b/src/plugins/cppeditor/cppelementevaluator.h index 1a8050a8541f2bda5c2c5a5ca69472dc8345bdca..1eede15a812a7cc949e31c71da70e1c4d30f7043 100644 --- a/src/plugins/cppeditor/cppelementevaluator.h +++ b/src/plugins/cppeditor/cppelementevaluator.h @@ -45,7 +45,7 @@ class LookupItem; class LookupContext; } -namespace CppTools { class CppModelManagerInterface; } +namespace CppTools { class CppModelManager; } namespace CppEditor { namespace Internal { @@ -79,7 +79,7 @@ private: const CPlusPlus::Scope *scope); TextEditor::BaseTextEditorWidget *m_editor; - CppTools::CppModelManagerInterface *m_modelManager; + CppTools::CppModelManager *m_modelManager; QTextCursor m_tc; bool m_lookupBaseClasses; bool m_lookupDerivedClasses; diff --git a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp index e5edad749c55e32847bb5428a033aad3b98d58bb..3ab538124b3a5d590c844e3068d5ae5469db466e 100644 --- a/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp +++ b/src/plugins/cppeditor/cppfollowsymbolundercursor.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -236,7 +236,7 @@ Link findMacroLink(const QByteArray &name, const Document::Ptr &doc) { if (!name.isEmpty()) { if (doc) { - const Snapshot snapshot = CppModelManagerInterface::instance()->snapshot(); + const Snapshot snapshot = CppModelManager::instance()->snapshot(); QSet processed; return findMacroLink_helper(name, doc, snapshot, &processed); } @@ -597,9 +597,9 @@ BaseTextEditorWidget::Link FollowSymbolUnderCursor::findLink(const QTextCursor & return link; //already on definition! } else if (const Document::MacroUse *use = doc->findMacroUseAt(endOfToken - 1)) { const QString fileName = use->macro().fileName(); - if (fileName == CppModelManagerInterface::editorConfigurationFileName()) { + if (fileName == CppModelManager::editorConfigurationFileName()) { m_widget->showPreProcessorWidget(); - } else if (fileName != CppModelManagerInterface::configurationFileName()) { + } else if (fileName != CppModelManager::configurationFileName()) { const Macro ¯o = use->macro(); link.targetFileName = macro.fileName(); link.targetLine = macro.line(); diff --git a/src/plugins/cppeditor/cppincludehierarchy_test.cpp b/src/plugins/cppeditor/cppincludehierarchy_test.cpp index 8eaba08c0a854467b64ad1f5eeeadcc148dc7cae..6eb4b78c0578f5aae0e01c731cb0abfb0c78a4c8 100644 --- a/src/plugins/cppeditor/cppincludehierarchy_test.cpp +++ b/src/plugins/cppeditor/cppincludehierarchy_test.cpp @@ -32,7 +32,7 @@ #include "cppincludehierarchymodel.h" #include -#include +#include #include #include diff --git a/src/plugins/cppeditor/cppincludehierarchymodel.cpp b/src/plugins/cppeditor/cppincludehierarchymodel.cpp index 0dfde59238d549a27ef2ecbb4938f023cf70737a..12299f8628e3455fdc248de9e4e9b280a0ded9fa 100644 --- a/src/plugins/cppeditor/cppincludehierarchymodel.cpp +++ b/src/plugins/cppeditor/cppincludehierarchymodel.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include @@ -48,7 +48,7 @@ namespace { Snapshot globalSnapshot() { - return CppTools::CppModelManagerInterface::instance()->snapshot(); + return CppTools::CppModelManager::instance()->snapshot(); } } // anonymous namespace diff --git a/src/plugins/cppeditor/cpppreprocessordialog.h b/src/plugins/cppeditor/cpppreprocessordialog.h index bdb46d86f3679c3aca71f68daa09a33e8a147006..c24cefc3d0478ba2c58437529a32a473e0114ac5 100644 --- a/src/plugins/cppeditor/cpppreprocessordialog.h +++ b/src/plugins/cppeditor/cpppreprocessordialog.h @@ -30,7 +30,7 @@ #ifndef CPPPREPROCESSORDIALOG_H #define CPPPREPROCESSORDIALOG_H -#include +#include #include diff --git a/src/plugins/cppeditor/cppquickfixassistant.cpp b/src/plugins/cppeditor/cppquickfixassistant.cpp index 9331023dc13ed9188a951ea3cd77334a89a253a7..a0d1a148a3ad69c6c6494fa6cd978f68a6cda994 100644 --- a/src/plugins/cppeditor/cppquickfixassistant.cpp +++ b/src/plugins/cppeditor/cppquickfixassistant.cpp @@ -91,7 +91,7 @@ CppQuickFixAssistInterface::CppQuickFixAssistInterface(CppEditorWidget *editor, editor->textDocument()->filePath(), reason) , m_editor(editor) , m_semanticInfo(editor->semanticInfo()) - , m_snapshot(CppTools::CppModelManagerInterface::instance()->snapshot()) + , m_snapshot(CppTools::CppModelManager::instance()->snapshot()) , m_currentFile(CppRefactoringChanges::file(editor, m_semanticInfo.doc)) , m_context(m_semanticInfo.doc, m_snapshot) { diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index a4913b1bab556f89963cc1dabaa3e454380f845c..28c52f0b47f2158936f0824b6d6c77155124df29 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -1901,7 +1901,7 @@ void AddIncludeForUndefinedIdentifier::match(const CppQuickFixInterface &interfa // find the include paths ProjectPart::HeaderPaths headerPaths; - CppModelManagerInterface *modelManager = CppModelManagerInterface::instance(); + CppModelManager *modelManager = CppModelManager::instance(); QList projectInfos = modelManager->projectInfos(); bool inProject = false; foreach (const ProjectInfo &info, projectInfos) { diff --git a/src/plugins/cppeditor/cppuseselectionsupdater.cpp b/src/plugins/cppeditor/cppuseselectionsupdater.cpp index cfc8bce80715453214076406c8f72c2febb6e38b..a6ba70d05cc6424166be6d29b82a8f41801da6af 100644 --- a/src/plugins/cppeditor/cppuseselectionsupdater.cpp +++ b/src/plugins/cppeditor/cppuseselectionsupdater.cpp @@ -33,7 +33,7 @@ #include "cppeditor.h" #include -#include +#include #include #include #include @@ -204,7 +204,7 @@ QList findReferences(const Params &p) using CppEditor::Internal::CanonicalSymbol; if (Symbol *s = CanonicalSymbol::canonicalSymbol(p.scope, p.expression, typeOfExpression)) { - CppTools::CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *mmi = CppTools::CppModelManager::instance(); result = mmi->references(s, typeOfExpression.context()); } diff --git a/src/plugins/cppeditor/fileandtokenactions_test.cpp b/src/plugins/cppeditor/fileandtokenactions_test.cpp index 8422664826d2983dfec245391999ebf4c18a225a..2bfccaead70fd46c3104acf68fb4a2e01bc796bc 100644 --- a/src/plugins/cppeditor/fileandtokenactions_test.cpp +++ b/src/plugins/cppeditor/fileandtokenactions_test.cpp @@ -36,7 +36,7 @@ #include "cppinsertvirtualmethods.h" #include -#include +#include #include #include #include diff --git a/src/plugins/cpptools/abstracteditorsupport.cpp b/src/plugins/cpptools/abstracteditorsupport.cpp index d1abe0ff79e3e6ecad4e81e5fdf7cc0b1db5b6eb..3151513073f793ae81a735427596131ed432ec17 100644 --- a/src/plugins/cpptools/abstracteditorsupport.cpp +++ b/src/plugins/cpptools/abstracteditorsupport.cpp @@ -30,14 +30,14 @@ #include "abstracteditorsupport.h" #include "cppfilesettingspage.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include #include namespace CppTools { -AbstractEditorSupport::AbstractEditorSupport(CppModelManagerInterface *modelmanager) : +AbstractEditorSupport::AbstractEditorSupport(CppModelManager *modelmanager) : m_modelmanager(modelmanager), m_revision(1) { } @@ -52,7 +52,7 @@ void AbstractEditorSupport::updateDocument() m_modelmanager->updateSourceFiles(QSet() << fileName()); } -QString AbstractEditorSupport::functionAt(const CppModelManagerInterface *modelManager, +QString AbstractEditorSupport::functionAt(const CppModelManager *modelManager, const QString &fileName, int line, int column) { diff --git a/src/plugins/cpptools/abstracteditorsupport.h b/src/plugins/cpptools/abstracteditorsupport.h index a8afc450d6bb1e9d949314834214c5fe3b6c2ba6..06089824ffe5a332ee54edbb4b31ef9535964591 100644 --- a/src/plugins/cpptools/abstracteditorsupport.h +++ b/src/plugins/cpptools/abstracteditorsupport.h @@ -36,13 +36,13 @@ #include namespace CppTools { -class CppModelManagerInterface; +class CppModelManager; class CPPTOOLS_EXPORT AbstractEditorSupport : public QObject { Q_OBJECT public: - explicit AbstractEditorSupport(CppModelManagerInterface *modelmanager); + explicit AbstractEditorSupport(CppModelManager *modelmanager); virtual ~AbstractEditorSupport(); /// \returns the contents, encoded as UTF-8 @@ -53,14 +53,14 @@ public: unsigned revision() const { return m_revision; } // TODO: find a better place for common utility functions - static QString functionAt(const CppModelManagerInterface *mm, + static QString functionAt(const CppModelManager *mm, const QString &fileName, int line, int column); static QString licenseTemplate(const QString &file = QString(), const QString &className = QString()); private: - CppModelManagerInterface *m_modelmanager; + CppModelManager *m_modelmanager; unsigned m_revision; }; diff --git a/src/plugins/cpptools/baseeditordocumentparser.cpp b/src/plugins/cpptools/baseeditordocumentparser.cpp index bcf740741589d8af04b35975813b15b8fa1fae42..31d65da69b3ef16c1f8c11070a7f96aac657390a 100644 --- a/src/plugins/cpptools/baseeditordocumentparser.cpp +++ b/src/plugins/cpptools/baseeditordocumentparser.cpp @@ -105,7 +105,7 @@ void BaseEditorDocumentParser::setEditorDefines(const QByteArray &editorDefines) BaseEditorDocumentParser *BaseEditorDocumentParser::get(const QString &filePath) { - CppModelManagerInterface *cmmi = CppModelManagerInterface::instance(); + CppModelManager *cmmi = CppModelManager::instance(); if (EditorDocumentHandle *editorDocument = cmmi->editorDocument(filePath)) { if (BaseEditorDocumentProcessor *processor = editorDocument->processor()) return processor->parser(); @@ -120,7 +120,7 @@ void BaseEditorDocumentParser::updateProjectPart() return; } - CppModelManagerInterface *cmm = CppModelManagerInterface::instance(); + CppModelManager *cmm = CppModelManager::instance(); QList projectParts = cmm->projectPart(m_filePath); if (projectParts.isEmpty()) { if (m_projectPart) diff --git a/src/plugins/cpptools/baseeditordocumentparser.h b/src/plugins/cpptools/baseeditordocumentparser.h index d33b88a8ab5c4d66db9f7a878827165409ba4f16..328ecd123d1c8a5bfd5dbe3e7b6ab9b3e5776c38 100644 --- a/src/plugins/cpptools/baseeditordocumentparser.h +++ b/src/plugins/cpptools/baseeditordocumentparser.h @@ -30,7 +30,7 @@ #ifndef BASEEDITORDOCUMENTPARSER_H #define BASEEDITORDOCUMENTPARSER_H -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include "cpptools_global.h" #include diff --git a/src/plugins/cpptools/baseeditordocumentprocessor.cpp b/src/plugins/cpptools/baseeditordocumentprocessor.cpp index f8353707fbe7b9b233fbde9a4e4350062939a0df..bde9d5183a59e38e0cc0740b3d3cdbbdec5a76f6 100644 --- a/src/plugins/cpptools/baseeditordocumentprocessor.cpp +++ b/src/plugins/cpptools/baseeditordocumentprocessor.cpp @@ -64,7 +64,7 @@ TextEditor::BaseTextDocument *BaseEditorDocumentProcessor::baseTextDocument() co BaseEditorDocumentProcessor *BaseEditorDocumentProcessor::get(const QString &filePath) { - CppModelManagerInterface *cmmi = CppModelManagerInterface::instance(); + CppModelManager *cmmi = CppModelManager::instance(); if (EditorDocumentHandle *editorDocument = cmmi->editorDocument(filePath)) return editorDocument->processor(); return 0; @@ -126,7 +126,7 @@ void BaseEditorDocumentProcessor::runParser(QFutureInterface &future, } parser->update(workingCopy); - CppModelManagerInterface::instance() + CppModelManager::instance() ->finishedRefreshingSourceFiles(QSet() << parser->filePath()); future.setProgressValue(1); diff --git a/src/plugins/cpptools/builtineditordocumentparser.cpp b/src/plugins/cpptools/builtineditordocumentparser.cpp index e6b5fd3c75fe84b522ba31ceb5aa765737a318a4..a251c59c3dad051c97020f203d8a6723f8e174db 100644 --- a/src/plugins/cpptools/builtineditordocumentparser.cpp +++ b/src/plugins/cpptools/builtineditordocumentparser.cpp @@ -54,8 +54,7 @@ void BuiltinEditorDocumentParser::update(WorkingCopy workingCopy) bool invalidateSnapshot = false, invalidateConfig = false, editorDefinesChanged_ = false; - CppModelManager *modelManager - = dynamic_cast(CppModelManagerInterface::instance()); + CppModelManager *modelManager = CppModelManager::instance(); QByteArray configFile = modelManager->codeModelConfiguration(); ProjectPart::HeaderPaths headerPaths; QStringList precompiledHeaders; @@ -146,7 +145,7 @@ void BuiltinEditorDocumentParser::update(WorkingCopy workingCopy) m_snapshot.remove(filePath()); static const QString editorDefinesFileName - = CppModelManagerInterface::editorConfigurationFileName(); + = CppModelManager::editorConfigurationFileName(); if (editorDefinesChanged_) { m_snapshot.remove(editorDefinesFileName); workingCopy.insert(editorDefinesFileName, editorDefines()); diff --git a/src/plugins/cpptools/builtineditordocumentprocessor.cpp b/src/plugins/cpptools/builtineditordocumentprocessor.cpp index d2f8a2652ecaf2cd5542d5b8b94712b0f58630ad..74c8d26cc6822930bf36c28ecfc9a9bcbbc2f8f8 100644 --- a/src/plugins/cpptools/builtineditordocumentprocessor.cpp +++ b/src/plugins/cpptools/builtineditordocumentprocessor.cpp @@ -49,11 +49,6 @@ enum { debug = 0 }; namespace { -CppTools::Internal::CppModelManager *cmm() -{ - return CppTools::Internal::CppModelManager::instance(); -} - QFuture runHighlighter(const CPlusPlus::Document::Ptr &doc, const CPlusPlus::Snapshot &snapshot, QTextDocument *textDocument) @@ -164,7 +159,7 @@ BuiltinEditorDocumentProcessor::~BuiltinEditorDocumentProcessor() void BuiltinEditorDocumentProcessor::run() { - m_parserFuture = QtConcurrent::run(&runParser, parser(), cmm()->workingCopy()); + m_parserFuture = QtConcurrent::run(&runParser, parser(), CppTools::CppModelManager::instance()->workingCopy()); } BaseEditorDocumentParser *BuiltinEditorDocumentProcessor::parser() @@ -237,7 +232,7 @@ void BuiltinEditorDocumentProcessor::onSemanticInfoUpdated(const SemanticInfo se SemanticInfo::Source BuiltinEditorDocumentProcessor::createSemanticInfoSource(bool force) const { - const WorkingCopy workingCopy = cmm()->workingCopy(); + const WorkingCopy workingCopy = CppTools::CppModelManager::instance()->workingCopy(); const QString path = filePath(); return SemanticInfo::Source(path, workingCopy.source(path), diff --git a/src/plugins/cpptools/builtinindexingsupport.cpp b/src/plugins/cpptools/builtinindexingsupport.cpp index 295afead9c4f803d2a7641624c6d0f62e8f7e500..689a08df85f0af2fb11826fced401e24f33a2235 100644 --- a/src/plugins/cpptools/builtinindexingsupport.cpp +++ b/src/plugins/cpptools/builtinindexingsupport.cpp @@ -209,7 +209,7 @@ void index(QFutureInterface &future, const ParseParams params) sourceProcessor->setTodo(files.toSet()); - const QString conf = CppModelManagerInterface::configurationFileName(); + const QString conf = CppModelManager::configurationFileName(); bool processingHeaders = false; CppModelManager *cmm = CppModelManager::instance(); @@ -354,7 +354,7 @@ BuiltinIndexingSupport::~BuiltinIndexingSupport() {} QFuture BuiltinIndexingSupport::refreshSourceFiles(const QSet &sourceFiles, - CppModelManagerInterface::ProgressNotificationMode mode) + CppModelManager::ProgressNotificationMode mode) { CppModelManager *mgr = CppModelManager::instance(); @@ -379,7 +379,7 @@ QFuture BuiltinIndexingSupport::refreshSourceFiles(const QSet &so m_synchronizer.addFuture(result); - if (mode == CppModelManagerInterface::ForcedProgressNotification || sourceFiles.count() > 1) { + if (mode == CppModelManager::ForcedProgressNotification || sourceFiles.count() > 1) { Core::ProgressManager::addTask(result, QCoreApplication::translate("CppTools::Internal::BuiltinIndexingSupport", "Parsing C/C++ Files"), CppTools::Constants::TASK_INDEX); } diff --git a/src/plugins/cpptools/builtinindexingsupport.h b/src/plugins/cpptools/builtinindexingsupport.h index a9a5d31d68d2979554aa625b2cfc6b76fbd36cad..f921729ac717867ff3204e1a722f527830b16276 100644 --- a/src/plugins/cpptools/builtinindexingsupport.h +++ b/src/plugins/cpptools/builtinindexingsupport.h @@ -31,7 +31,7 @@ #define BUILTININDEXINGSUPPORT_H #include "cppindexingsupport.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include @@ -44,7 +44,7 @@ public: ~BuiltinIndexingSupport(); virtual QFuture refreshSourceFiles(const QSet &sourceFiles, - CppModelManagerInterface::ProgressNotificationMode mode); + CppModelManager::ProgressNotificationMode mode); virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet fileNames); diff --git a/src/plugins/cpptools/cppcodemodelinspectordumper.cpp b/src/plugins/cpptools/cppcodemodelinspectordumper.cpp index 7f0d03932b5832f582fbef3716e111ebfa308981..858f9bd4090135e2030fe15febed8e17879adade 100644 --- a/src/plugins/cpptools/cppcodemodelinspectordumper.cpp +++ b/src/plugins/cpptools/cppcodemodelinspectordumper.cpp @@ -384,7 +384,7 @@ QString Utils::toString(CPlusPlus::Kind kind) QString Utils::partsForFile(const QString &fileName) { const QList parts - = CppModelManagerInterface::instance()->projectPart(fileName); + = CppModelManager::instance()->projectPart(fileName); QString result; foreach (const ProjectPart::Ptr &part, parts) result += part->displayName + QLatin1Char(','); diff --git a/src/plugins/cpptools/cppcodemodelinspectordumper.h b/src/plugins/cpptools/cppcodemodelinspectordumper.h index 0226ef5de506f3073c8ce50ef6cc7311ed66e172..972d479ecaf3fcb6279ebbc42b3e99db84dea766 100644 --- a/src/plugins/cpptools/cppcodemodelinspectordumper.h +++ b/src/plugins/cpptools/cppcodemodelinspectordumper.h @@ -32,7 +32,7 @@ #include "cpptools_global.h" -#include +#include #include #include diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp index c45f159d66d1f9216863abd54a49a246f023b079..703a3aaff58a0567262ba0f2655ba8d331041b5c 100644 --- a/src/plugins/cpptools/cppcompletionassist.cpp +++ b/src/plugins/cpptools/cppcompletionassist.cpp @@ -32,7 +32,7 @@ #include "builtineditordocumentparser.h" #include "cppdoxygen.h" #include "cppmodelmanager.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include "cpptoolsconstants.h" #include "cpptoolsreuse.h" #include "editordocumenthandle.h" @@ -422,7 +422,7 @@ AssistInterface *InternalCompletionAssistProvider::createAssistInterface( { QTC_ASSERT(document, return 0); - CppModelManagerInterface *modelManager = CppModelManagerInterface::instance(); + CppModelManager *modelManager = CppModelManager::instance(); return new CppTools::Internal::CppCompletionAssistInterface(filePath, document, isObjCEnabled, position, reason, modelManager->workingCopy()); @@ -1383,7 +1383,7 @@ void CppCompletionAssistProcessor::globalCompletion(CPlusPlus::Scope *currentSco completeNamespace(b); addKeywords(); - addMacros(CppModelManagerInterface::configurationFileName(), context.snapshot()); + addMacros(CppModelManager::configurationFileName(), context.snapshot()); addMacros(context.thisDocument()->fileName(), context.snapshot()); addSnippets(); } diff --git a/src/plugins/cpptools/cppcompletionassist.h b/src/plugins/cpptools/cppcompletionassist.h index 1eff1bd59f87de079eb9c8eba7302f88dd0cc9a9..5254acd7ef4e29255d37af142cc6422fbb8192f2 100644 --- a/src/plugins/cpptools/cppcompletionassist.h +++ b/src/plugins/cpptools/cppcompletionassist.h @@ -31,7 +31,7 @@ #define CPPCOMPLETIONASSIST_H #include "cppcompletionassistprovider.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include "cppworkingcopy.h" #include diff --git a/src/plugins/cpptools/cppcurrentdocumentfilter.h b/src/plugins/cpptools/cppcurrentdocumentfilter.h index 06b9633d715e8a73f4c925efd2dc3dca449ea5c7..9f2a729d4e8217bae03072cfc32d002f32ccf3d6 100644 --- a/src/plugins/cpptools/cppcurrentdocumentfilter.h +++ b/src/plugins/cpptools/cppcurrentdocumentfilter.h @@ -36,10 +36,11 @@ namespace Core { class IEditor; } namespace CppTools { -namespace Internal { class CppModelManager; +namespace Internal { + class CppCurrentDocumentFilter : public Core::ILocatorFilter { Q_OBJECT diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp index ad8ec3f0d1165f9bc20ef79039d54b2496360325..ccde50baef8033d35668fb2222cb8be805f3539a 100644 --- a/src/plugins/cpptools/cppfindreferences.cpp +++ b/src/plugins/cpptools/cppfindreferences.cpp @@ -30,7 +30,7 @@ #include "cppfindreferences.h" #include "cpptoolsconstants.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include "cppworkingcopy.h" #include @@ -246,7 +246,7 @@ public: } // end of anonymous namespace -CppFindReferences::CppFindReferences(CppModelManagerInterface *modelManager) +CppFindReferences::CppFindReferences(CppModelManager *modelManager) : QObject(modelManager), m_modelManager(modelManager) { @@ -391,7 +391,7 @@ void CppFindReferences::searchAgain() { Core::SearchResult *search = qobject_cast(sender()); CppFindReferencesParameters parameters = search->userData().value(); - Snapshot snapshot = CppModelManagerInterface::instance()->snapshot(); + Snapshot snapshot = CppModelManager::instance()->snapshot(); search->restart(); LookupContext context; Symbol *symbol = findSymbol(parameters, snapshot, &context); diff --git a/src/plugins/cpptools/cppfindreferences.h b/src/plugins/cpptools/cppfindreferences.h index 07e43f2430835af9a4463efcdab3cc9e4b914664..26edcfcaf4dae30ec12b0b8f3096556f1d6ee14a 100644 --- a/src/plugins/cpptools/cppfindreferences.h +++ b/src/plugins/cpptools/cppfindreferences.h @@ -46,7 +46,7 @@ class SearchResult; } // namespace Core namespace CppTools { -class CppModelManagerInterface; +class CppModelManager; namespace Internal { @@ -62,7 +62,7 @@ class CppFindReferences: public QObject Q_OBJECT public: - CppFindReferences(CppModelManagerInterface *modelManager); + CppFindReferences(CppModelManager *modelManager); virtual ~CppFindReferences(); QList references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) const; @@ -96,7 +96,7 @@ private: const CPlusPlus::Snapshot &snapshot, CPlusPlus::LookupContext *context); private: - QPointer m_modelManager; + QPointer m_modelManager; QMap *, QPointer > m_watchers; }; diff --git a/src/plugins/cpptools/cppindexingsupport.h b/src/plugins/cpptools/cppindexingsupport.h index b31e5072a2701a209e9603cd01ade89214f6cc5c..f9422e3c48012ef38f0babbdf4e50eeb6b07c885 100644 --- a/src/plugins/cpptools/cppindexingsupport.h +++ b/src/plugins/cpptools/cppindexingsupport.h @@ -32,7 +32,7 @@ #include "cpptools_global.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include #include @@ -83,7 +83,7 @@ public: virtual ~CppIndexingSupport() = 0; virtual QFuture refreshSourceFiles(const QSet &sourceFiles, - CppModelManagerInterface::ProgressNotificationMode mode) = 0; + CppModelManager::ProgressNotificationMode mode) = 0; virtual SymbolSearcher *createSymbolSearcher(SymbolSearcher::Parameters parameters, QSet fileNames) = 0; }; diff --git a/src/plugins/cpptools/cpplocatorfilter.h b/src/plugins/cpptools/cpplocatorfilter.h index dbf7eed6f041f5380a0b6d2c261ff10c7d1b3ba4..7b96bd93b67b3991af33861ca774f0fb235136a3 100644 --- a/src/plugins/cpptools/cpplocatorfilter.h +++ b/src/plugins/cpptools/cpplocatorfilter.h @@ -38,8 +38,6 @@ namespace CppTools { namespace Internal { -class CppModelManager; - class CppLocatorFilter : public Core::ILocatorFilter { Q_OBJECT diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 801686746bcc4ae830d281a43cd2aeb7b838668e..4ac45b831e469bd67c98f3a1f08f19c6805276ef 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -110,7 +110,53 @@ protected: #endif // QTCREATOR_WITH_DUMP_AST -static const char pp_configuration[] = +namespace CppTools { +namespace Internal { + +static QMutex m_instanceMutex; +static CppModelManager *m_instance; + +class CppModelManagerPrivate +{ +public: + // Snapshot + mutable QMutex m_snapshotMutex; + CPlusPlus::Snapshot m_snapshot; + + // Project integration + mutable QMutex m_projectMutex; + QMap m_projectToProjectsInfo; + QMap > m_fileToProjectParts; + QMap m_projectFileToProjectPart; + // The members below are cached/(re)calculated from the projects and/or their project parts + bool m_dirty; + QStringList m_projectFiles; + ProjectPart::HeaderPaths m_headerPaths; + QByteArray m_definedMacros; + + // Editor integration + mutable QMutex m_cppEditorsMutex; + QMap m_cppEditors; + QSet m_extraEditorSupports; + + // Completion & highlighting + QHash m_idTocodeModelSupporter; + QScopedPointer m_modelManagerSupportFallback; + + // Indexing + CppIndexingSupport *m_indexingSupporter; + CppIndexingSupport *m_internalIndexingSupport; + bool m_indexerEnabled; + + CppFindReferences *m_findReferences; + + bool m_enableGC; + QTimer m_delayedGcTimer; +}; + +} // namespace Internal + +const char pp_configuration[] = "# 1 \"\"\n" "#define Q_CREATOR_RUN 1\n" "#define __cplusplus 1\n" @@ -179,6 +225,16 @@ CppSourceProcessor *CppModelManager::createSourceProcessor() }); } +QString CppModelManager::editorConfigurationFileName() +{ + return QLatin1String(""); +} + +QString CppModelManager::configurationFileName() +{ + return CPlusPlus::Preprocessor::configurationFileName; +} + void CppModelManager::updateModifiedSourceFiles() { const Snapshot snapshot = this->snapshot(); @@ -201,9 +257,6 @@ void CppModelManager::updateModifiedSourceFiles() * Files are garbage collected */ -QMutex CppModelManager::m_instanceMutex; -CppModelManager *CppModelManager::m_instance = 0; - CppModelManager *CppModelManager::instance() { if (m_instance) @@ -217,23 +270,23 @@ CppModelManager *CppModelManager::instance() } CppModelManager::CppModelManager(QObject *parent) - : CppModelManagerInterface(parent) - , m_indexingSupporter(0) - , m_enableGC(true) + : CppModelManagerBase(parent), d(new CppModelManagerPrivate) { + d->m_indexingSupporter = 0; + d->m_enableGC = true; + qRegisterMetaType >(); connect(this, SIGNAL(sourceFilesRefreshed(QSet)), this, SLOT(onSourceFilesRefreshed())); - m_findReferences = new CppFindReferences(this); - m_indexerEnabled = qgetenv("QTC_NO_CODE_INDEXER") != "1"; + d->m_findReferences = new CppFindReferences(this); + d->m_indexerEnabled = qgetenv("QTC_NO_CODE_INDEXER") != "1"; - m_dirty = true; + d->m_dirty = true; - m_delayedGcTimer = new QTimer(this); - m_delayedGcTimer->setObjectName(QLatin1String("CppModelManager::m_delayedGcTimer")); - m_delayedGcTimer->setSingleShot(true); - connect(m_delayedGcTimer, SIGNAL(timeout()), this, SLOT(GC())); + d->m_delayedGcTimer.setObjectName(QLatin1String("CppModelManager::m_delayedGcTimer")); + d->m_delayedGcTimer.setSingleShot(true); + connect(&d->m_delayedGcTimer, SIGNAL(timeout()), this, SLOT(GC())); QObject *sessionManager = ProjectExplorer::SessionManager::instance(); connect(sessionManager, SIGNAL(projectAdded(ProjectExplorer::Project*)), @@ -250,29 +303,30 @@ CppModelManager::CppModelManager(QObject *parent) qRegisterMetaType("CPlusPlus::Document::Ptr"); - m_modelManagerSupportFallback.reset(new ModelManagerSupportInternal); + d->m_modelManagerSupportFallback.reset(new ModelManagerSupportInternal); CppToolsPlugin::instance()->codeModelSettings()->setDefaultId( - m_modelManagerSupportFallback->id()); - addModelManagerSupport(m_modelManagerSupportFallback.data()); + d->m_modelManagerSupportFallback->id()); + addModelManagerSupport(d->m_modelManagerSupportFallback.data()); - m_internalIndexingSupport = new BuiltinIndexingSupport; + d->m_internalIndexingSupport = new BuiltinIndexingSupport; } CppModelManager::~CppModelManager() { - delete m_internalIndexingSupport; + delete d; + delete d->m_internalIndexingSupport; } Snapshot CppModelManager::snapshot() const { - QMutexLocker locker(&m_snapshotMutex); - return m_snapshot; + QMutexLocker locker(&d->m_snapshotMutex); + return d->m_snapshot; } Document::Ptr CppModelManager::document(const QString &fileName) const { - QMutexLocker locker(&m_snapshotMutex); - return m_snapshot.document(fileName); + QMutexLocker locker(&d->m_snapshotMutex); + return d->m_snapshot.document(fileName); } /// Replace the document in the snapshot. @@ -280,33 +334,33 @@ Document::Ptr CppModelManager::document(const QString &fileName) const /// \returns true if successful, false if the new document is out-dated. bool CppModelManager::replaceDocument(Document::Ptr newDoc) { - QMutexLocker locker(&m_snapshotMutex); + QMutexLocker locker(&d->m_snapshotMutex); - Document::Ptr previous = m_snapshot.document(newDoc->fileName()); + Document::Ptr previous = d->m_snapshot.document(newDoc->fileName()); if (previous && (newDoc->revision() != 0 && newDoc->revision() < previous->revision())) // the new document is outdated return false; - m_snapshot.insert(newDoc); + d->m_snapshot.insert(newDoc); return true; } void CppModelManager::ensureUpdated() { - QMutexLocker locker(&m_projectMutex); - if (!m_dirty) + QMutexLocker locker(&d->m_projectMutex); + if (!d->m_dirty) return; - m_projectFiles = internalProjectFiles(); - m_headerPaths = internalHeaderPaths(); - m_definedMacros = internalDefinedMacros(); - m_dirty = false; + d->m_projectFiles = internalProjectFiles(); + d->m_headerPaths = internalHeaderPaths(); + d->m_definedMacros = internalDefinedMacros(); + d->m_dirty = false; } QStringList CppModelManager::internalProjectFiles() const { QStringList files; - QMapIterator it(m_projectToProjectsInfo); + QMapIterator it(d->m_projectToProjectsInfo); while (it.hasNext()) { it.next(); const ProjectInfo pinfo = it.value(); @@ -322,7 +376,7 @@ QStringList CppModelManager::internalProjectFiles() const ProjectPart::HeaderPaths CppModelManager::internalHeaderPaths() const { ProjectPart::HeaderPaths headerPaths; - QMapIterator it(m_projectToProjectsInfo); + QMapIterator it(d->m_projectToProjectsInfo); while (it.hasNext()) { it.next(); const ProjectInfo pinfo = it.value(); @@ -358,7 +412,7 @@ QByteArray CppModelManager::internalDefinedMacros() const { QByteArray macros; QSet alreadyIn; - QMapIterator it(m_projectToProjectsInfo); + QMapIterator it(d->m_projectToProjectsInfo); while (it.hasNext()) { it.next(); const ProjectInfo pinfo = it.value(); @@ -384,25 +438,25 @@ void CppModelManager::dumpModelManagerConfiguration(const QString &logFileId) dumper.dumpSnapshot(globalSnapshot, globalSnapshotTitle, /*isGlobalSnapshot=*/ true); dumper.dumpWorkingCopy(workingCopy()); ensureUpdated(); - dumper.dumpMergedEntities(m_headerPaths, m_definedMacros); + dumper.dumpMergedEntities(d->m_headerPaths, d->m_definedMacros); } void CppModelManager::addExtraEditorSupport(AbstractEditorSupport *editorSupport) { - m_extraEditorSupports.insert(editorSupport); + d->m_extraEditorSupports.insert(editorSupport); } void CppModelManager::removeExtraEditorSupport(AbstractEditorSupport *editorSupport) { - m_extraEditorSupports.remove(editorSupport); + d->m_extraEditorSupports.remove(editorSupport); } EditorDocumentHandle *CppModelManager::editorDocument(const QString &filePath) { QTC_ASSERT(!filePath.isEmpty(), return 0); - QMutexLocker locker(&m_cppEditorsMutex); - return m_cppEditors.value(filePath, 0); + QMutexLocker locker(&d->m_cppEditorsMutex); + return d->m_cppEditors.value(filePath, 0); } void CppModelManager::registerEditorDocument(EditorDocumentHandle *editorDocument) @@ -411,9 +465,9 @@ void CppModelManager::registerEditorDocument(EditorDocumentHandle *editorDocumen const QString filePath = editorDocument->filePath(); QTC_ASSERT(!filePath.isEmpty(), return); - QMutexLocker locker(&m_cppEditorsMutex); - QTC_ASSERT(m_cppEditors.value(filePath, 0) == 0, return); - m_cppEditors.insert(filePath, editorDocument); + QMutexLocker locker(&d->m_cppEditorsMutex); + QTC_ASSERT(d->m_cppEditors.value(filePath, 0) == 0, return); + d->m_cppEditors.insert(filePath, editorDocument); } void CppModelManager::unregisterEditorDocument(const QString &filePath) @@ -424,10 +478,10 @@ void CppModelManager::unregisterEditorDocument(const QString &filePath) int openCppDocuments = 0; { - QMutexLocker locker(&m_cppEditorsMutex); - QTC_ASSERT(m_cppEditors.value(filePath, 0), return); - QTC_CHECK(m_cppEditors.remove(filePath) == 1); - openCppDocuments = m_cppEditors.size(); + QMutexLocker locker(&d->m_cppEditorsMutex); + QTC_ASSERT(d->m_cppEditors.value(filePath, 0), return); + QTC_CHECK(d->m_cppEditors.remove(filePath) == 1); + openCppDocuments = d->m_cppEditors.size(); } ++closedCppDocuments; @@ -439,13 +493,13 @@ void CppModelManager::unregisterEditorDocument(const QString &filePath) QList CppModelManager::references(CPlusPlus::Symbol *symbol, const LookupContext &context) { - return m_findReferences->references(symbol, context); + return d->m_findReferences->references(symbol, context); } void CppModelManager::findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) { if (symbol->identifier()) - m_findReferences->findUsages(symbol, context); + d->m_findReferences->findUsages(symbol, context); } void CppModelManager::renameUsages(CPlusPlus::Symbol *symbol, @@ -453,23 +507,23 @@ void CppModelManager::renameUsages(CPlusPlus::Symbol *symbol, const QString &replacement) { if (symbol->identifier()) - m_findReferences->renameUsages(symbol, context, replacement); + d->m_findReferences->renameUsages(symbol, context, replacement); } void CppModelManager::findMacroUsages(const CPlusPlus::Macro ¯o) { - m_findReferences->findMacroUses(macro); + d->m_findReferences->findMacroUses(macro); } void CppModelManager::renameMacroUsages(const CPlusPlus::Macro ¯o, const QString &replacement) { - m_findReferences->renameMacroUses(macro, replacement); + d->m_findReferences->renameMacroUses(macro, replacement); } void CppModelManager::replaceSnapshot(const CPlusPlus::Snapshot &newSnapshot) { - QMutexLocker snapshotLocker(&m_snapshotMutex); - m_snapshot = newSnapshot; + QMutexLocker snapshotLocker(&d->m_snapshotMutex); + d->m_snapshot = newSnapshot; } WorkingCopy CppModelManager::buildWorkingCopyList() @@ -479,7 +533,7 @@ WorkingCopy CppModelManager::buildWorkingCopyList() foreach (const EditorDocumentHandle *cppEditor, cppEditors()) workingCopy.insert(cppEditor->filePath(), cppEditor->contents(), cppEditor->revision()); - QSetIterator it(m_extraEditorSupports); + QSetIterator it(d->m_extraEditorSupports); while (it.hasNext()) { AbstractEditorSupport *es = it.next(); workingCopy.insert(es->fileName(), es->contents(), es->revision()); @@ -506,24 +560,24 @@ QByteArray CppModelManager::codeModelConfiguration() const QFuture CppModelManager::updateSourceFiles(const QSet &sourceFiles, ProgressNotificationMode mode) { - if (sourceFiles.isEmpty() || !m_indexerEnabled) + if (sourceFiles.isEmpty() || !d->m_indexerEnabled) return QFuture(); - if (m_indexingSupporter) - m_indexingSupporter->refreshSourceFiles(sourceFiles, mode); - return m_internalIndexingSupport->refreshSourceFiles(sourceFiles, mode); + if (d->m_indexingSupporter) + d->m_indexingSupporter->refreshSourceFiles(sourceFiles, mode); + return d->m_internalIndexingSupport->refreshSourceFiles(sourceFiles, mode); } QList CppModelManager::projectInfos() const { - QMutexLocker locker(&m_projectMutex); - return m_projectToProjectsInfo.values(); + QMutexLocker locker(&d->m_projectMutex); + return d->m_projectToProjectsInfo.values(); } ProjectInfo CppModelManager::projectInfo(ProjectExplorer::Project *project) const { - QMutexLocker locker(&m_projectMutex); - return m_projectToProjectsInfo.value(project, ProjectInfo(project)); + QMutexLocker locker(&d->m_projectMutex); + return d->m_projectToProjectsInfo.value(project, ProjectInfo(project)); } /// \brief Remove all files and their includes (recursively) of given ProjectInfo from the snapshot. @@ -532,29 +586,29 @@ void CppModelManager::removeProjectInfoFilesAndIncludesFromSnapshot(const Projec if (!projectInfo.isValid()) return; - QMutexLocker snapshotLocker(&m_snapshotMutex); + QMutexLocker snapshotLocker(&d->m_snapshotMutex); foreach (const ProjectPart::Ptr &projectPart, projectInfo.projectParts()) { foreach (const ProjectFile &cxxFile, projectPart->files) { - foreach (const QString &fileName, m_snapshot.allIncludesForDocument(cxxFile.path)) - m_snapshot.remove(fileName); - m_snapshot.remove(cxxFile.path); + foreach (const QString &fileName, d->m_snapshot.allIncludesForDocument(cxxFile.path)) + d->m_snapshot.remove(fileName); + d->m_snapshot.remove(cxxFile.path); } } } QList CppModelManager::cppEditors() const { - QMutexLocker locker(&m_cppEditorsMutex); - return m_cppEditors.values(); + QMutexLocker locker(&d->m_cppEditorsMutex); + return d->m_cppEditors.values(); } /// \brief Remove all given files from the snapshot. void CppModelManager::removeFilesFromSnapshot(const QSet &filesToRemove) { - QMutexLocker snapshotLocker(&m_snapshotMutex); + QMutexLocker snapshotLocker(&d->m_snapshotMutex); QSetIterator i(filesToRemove); while (i.hasNext()) - m_snapshot.remove(i.next()); + d->m_snapshot.remove(i.next()); } class ProjectInfoComparer @@ -626,13 +680,13 @@ private: /// Make sure that m_projectMutex is locked when calling this. void CppModelManager::recalculateFileToProjectParts() { - m_projectFileToProjectPart.clear(); - m_fileToProjectParts.clear(); - foreach (const ProjectInfo &projectInfo, m_projectToProjectsInfo) { + d->m_projectFileToProjectPart.clear(); + d->m_fileToProjectParts.clear(); + foreach (const ProjectInfo &projectInfo, d->m_projectToProjectsInfo) { foreach (const ProjectPart::Ptr &projectPart, projectInfo.projectParts()) { - m_projectFileToProjectPart[projectPart->projectFile] = projectPart; + d->m_projectFileToProjectPart[projectPart->projectFile] = projectPart; foreach (const ProjectFile &cxxFile, projectPart->files) - m_fileToProjectParts[cxxFile.path].append(projectPart); + d->m_fileToProjectParts[cxxFile.path].append(projectPart); } } @@ -647,13 +701,13 @@ QFuture CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn bool filesRemoved = false; { // Only hold the mutex for a limited scope, so the dumping afterwards does not deadlock. - QMutexLocker projectLocker(&m_projectMutex); + QMutexLocker projectLocker(&d->m_projectMutex); ProjectExplorer::Project *project = newProjectInfo.project().data(); const QSet newSourceFiles = newProjectInfo.sourceFiles(); // Check if we can avoid a full reindexing - ProjectInfo oldProjectInfo = m_projectToProjectsInfo.value(project); + ProjectInfo oldProjectInfo = d->m_projectToProjectsInfo.value(project); if (oldProjectInfo.isValid()) { ProjectInfoComparer comparer(oldProjectInfo, newProjectInfo); if (comparer.nothingChanged()) @@ -666,8 +720,8 @@ QFuture CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn // The "configuration file" includes all defines and therefore should be updated if (comparer.definesChanged()) { - QMutexLocker snapshotLocker(&m_snapshotMutex); - m_snapshot.remove(configurationFileName()); + QMutexLocker snapshotLocker(&d->m_snapshotMutex); + d->m_snapshot.remove(configurationFileName()); } // Otherwise check for added and modified files @@ -693,8 +747,8 @@ QFuture CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn } // Update Project/ProjectInfo and File/ProjectPart table - m_dirty = true; - m_projectToProjectsInfo.insert(project, newProjectInfo); + d->m_dirty = true; + d->m_projectToProjectsInfo.insert(project, newProjectInfo); recalculateFileToProjectParts(); } // Mutex scope @@ -715,13 +769,13 @@ QFuture CppModelManager::updateProjectInfo(const ProjectInfo &newProjectIn ProjectPart::Ptr CppModelManager::projectPartForProjectFile(const QString &projectFile) const { - return m_projectFileToProjectPart.value(projectFile); + return d->m_projectFileToProjectPart.value(projectFile); } QList CppModelManager::projectPart(const QString &fileName) const { - QMutexLocker locker(&m_projectMutex); - return m_fileToProjectParts.value(fileName); + QMutexLocker locker(&d->m_projectMutex); + return d->m_fileToProjectParts.value(fileName); } QList CppModelManager::projectPartFromDependencies(const QString &fileName) const @@ -729,7 +783,7 @@ QList CppModelManager::projectPartFromDependencies(const QStri QSet parts; const QStringList deps = snapshot().filesDependingOn(fileName); foreach (const QString &dep, deps) - parts.unite(QSet::fromList(m_fileToProjectParts.value(dep))); + parts.unite(QSet::fromList(d->m_fileToProjectParts.value(dep))); return parts.values(); } @@ -738,8 +792,8 @@ ProjectPart::Ptr CppModelManager::fallbackProjectPart() const { ProjectPart::Ptr part(new ProjectPart); - part->projectDefines = m_definedMacros; - part->headerPaths = m_headerPaths; + part->projectDefines = d->m_definedMacros; + part->headerPaths = d->m_headerPaths; part->languageVersion = ProjectPart::CXX14; part->languageExtensions = ProjectPart::AllExtensions; part->qtVersion = ProjectPart::Qt5; @@ -760,22 +814,22 @@ void CppModelManager::emitDocumentUpdated(Document::Ptr doc) void CppModelManager::onProjectAdded(ProjectExplorer::Project *) { - QMutexLocker locker(&m_projectMutex); - m_dirty = true; + QMutexLocker locker(&d->m_projectMutex); + d->m_dirty = true; } void CppModelManager::delayedGC() { - if (m_enableGC) - m_delayedGcTimer->start(500); + if (d->m_enableGC) + d->m_delayedGcTimer.start(500); } void CppModelManager::onAboutToRemoveProject(ProjectExplorer::Project *project) { do { - QMutexLocker locker(&m_projectMutex); - m_dirty = true; - m_projectToProjectsInfo.remove(project); + QMutexLocker locker(&d->m_projectMutex); + d->m_dirty = true; + d->m_projectToProjectsInfo.remove(project); recalculateFileToProjectParts(); } while (0); @@ -792,8 +846,8 @@ void CppModelManager::onSourceFilesRefreshed() const void CppModelManager::onAboutToLoadSession() { - if (m_delayedGcTimer->isActive()) - m_delayedGcTimer->stop(); + if (d->m_delayedGcTimer.isActive()) + d->m_delayedGcTimer.stop(); GC(); } @@ -801,21 +855,21 @@ void CppModelManager::onAboutToUnloadSession() { Core::ProgressManager::cancelTasks(CppTools::Constants::TASK_INDEX); do { - QMutexLocker locker(&m_projectMutex); - m_projectToProjectsInfo.clear(); + QMutexLocker locker(&d->m_projectMutex); + d->m_projectToProjectsInfo.clear(); recalculateFileToProjectParts(); - m_dirty = true; + d->m_dirty = true; } while (0); } void CppModelManager::onCoreAboutToClose() { - m_enableGC = false; + d->m_enableGC = false; } void CppModelManager::GC() { - if (!m_enableGC) + if (!d->m_enableGC) return; // Collect files of CppEditorSupport and AbstractEditorSupport. @@ -823,7 +877,7 @@ void CppModelManager::GC() foreach (const EditorDocumentHandle *cppEditor, cppEditors()) filesInEditorSupports << cppEditor->filePath(); - QSetIterator jt(m_extraEditorSupports); + QSetIterator jt(d->m_extraEditorSupports); while (jt.hasNext()) { AbstractEditorSupport *abstractEditorSupport = jt.next(); filesInEditorSupports << abstractEditorSupport->fileName(); @@ -875,16 +929,16 @@ void CppModelManager::finishedRefreshingSourceFiles(const QSet &files) void CppModelManager::addModelManagerSupport(ModelManagerSupport *modelManagerSupport) { Q_ASSERT(modelManagerSupport); - m_idTocodeModelSupporter[modelManagerSupport->id()] = modelManagerSupport; + d->m_idTocodeModelSupporter[modelManagerSupport->id()] = modelManagerSupport; QSharedPointer cms = CppToolsPlugin::instance()->codeModelSettings(); - cms->setModelManagerSupports(m_idTocodeModelSupporter.values()); + cms->setModelManagerSupports(d->m_idTocodeModelSupporter.values()); } ModelManagerSupport *CppModelManager::modelManagerSupportForMimeType(const QString &mimeType) const { QSharedPointer cms = CppToolsPlugin::instance()->codeModelSettings(); const QString &id = cms->modelManagerSupportId(mimeType); - return m_idTocodeModelSupporter.value(id, m_modelManagerSupportFallback.data()); + return d->m_idTocodeModelSupporter.value(id, d->m_modelManagerSupportFallback.data()); } CppCompletionAssistProvider *CppModelManager::completionAssistProvider(const QString &mimeType) const @@ -909,34 +963,41 @@ BaseEditorDocumentProcessor *CppModelManager::editorDocumentProcessor( void CppModelManager::setIndexingSupport(CppIndexingSupport *indexingSupport) { if (indexingSupport) - m_indexingSupporter = indexingSupport; + d->m_indexingSupporter = indexingSupport; } CppIndexingSupport *CppModelManager::indexingSupport() { - return m_indexingSupporter ? m_indexingSupporter : m_internalIndexingSupport; + return d->m_indexingSupporter ? d->m_indexingSupporter : d->m_internalIndexingSupport; } QStringList CppModelManager::projectFiles() { ensureUpdated(); - return m_projectFiles; + return d->m_projectFiles; } ProjectPart::HeaderPaths CppModelManager::headerPaths() { ensureUpdated(); - return m_headerPaths; + return d->m_headerPaths; +} + +void CppModelManager::setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths) +{ + d->m_headerPaths = headerPaths; } QByteArray CppModelManager::definedMacros() { ensureUpdated(); - return m_definedMacros; + return d->m_definedMacros; } void CppModelManager::enableGarbageCollector(bool enable) { - m_delayedGcTimer->stop(); - m_enableGC = enable; + d->m_delayedGcTimer.stop(); + d->m_enableGC = enable; } + +} // namespace CppTools diff --git a/src/plugins/cpptools/cppmodelmanager.h b/src/plugins/cpptools/cppmodelmanager.h index 8b766a3887df7625ff06035cc9cb5068a897b022..2b680ea8e7004e1c652b21c92aa1864c7d80f829 100644 --- a/src/plugins/cpptools/cppmodelmanager.h +++ b/src/plugins/cpptools/cppmodelmanager.h @@ -30,26 +30,41 @@ #ifndef CPPMODELMANAGER_H #define CPPMODELMANAGER_H -#include "cppmodelmanagerinterface.h" +#include "cpptools_global.h" + +#include "cppprojects.h" #include #include -#include -#include -#include +#include +#include + +#include +#include +#include namespace Core { class IEditor; } -namespace TextEditor { class BaseTextEditorWidget; } +namespace CPlusPlus { class LookupContext; } +namespace ProjectExplorer { class Project; } +namespace TextEditor { class BaseTextDocument; } namespace CppTools { -namespace Internal { +class AbstractEditorSupport; +class BaseEditorDocumentProcessor; +class CppCompletionAssistProvider; +class EditorDocumentHandle; +class CppIndexingSupport; +class ModelManagerSupport; +class WorkingCopy; -class CppFindReferences; +namespace Internal { class CppSourceProcessor; +class CppModelManagerPrivate; +} -class CppModelManager : public CppTools::CppModelManagerInterface +class CPPTOOLS_EXPORT CppModelManager : public CPlusPlus::CppModelManagerBase { Q_OBJECT @@ -58,74 +73,77 @@ public: public: CppModelManager(QObject *parent = 0); - virtual ~CppModelManager(); + ~CppModelManager(); static CppModelManager *instance(); - virtual QFuture updateSourceFiles(const QSet &sourceFiles, + // Documented in source file. + enum ProgressNotificationMode { + ForcedProgressNotification, + ReservedProgressNotification + }; + + QFuture updateSourceFiles(const QSet &sourceFiles, ProgressNotificationMode mode = ReservedProgressNotification); - virtual WorkingCopy workingCopy() const; - virtual QByteArray codeModelConfiguration() const; + WorkingCopy workingCopy() const; + QByteArray codeModelConfiguration() const; - virtual QList projectInfos() const; - virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const; - virtual QFuture updateProjectInfo(const ProjectInfo &newProjectInfo); + QList projectInfos() const; + ProjectInfo projectInfo(ProjectExplorer::Project *project) const; + QFuture updateProjectInfo(const ProjectInfo &newProjectInfo); /// \return The project part with the given project file - virtual ProjectPart::Ptr projectPartForProjectFile(const QString &projectFile) const; + ProjectPart::Ptr projectPartForProjectFile(const QString &projectFile) const; /// \return All project parts that mention the given file name as one of the sources/headers. - virtual QList projectPart(const QString &fileName) const; + QList projectPart(const QString &fileName) const; /// This is a fall-back function: find all files that includes the file directly or indirectly, /// and return its \c ProjectPart list for use with this file. - virtual QList projectPartFromDependencies(const QString &fileName) const; + QList projectPartFromDependencies(const QString &fileName) const; /// \return A synthetic \c ProjectPart which consists of all defines/includes/frameworks from /// all loaded projects. - virtual ProjectPart::Ptr fallbackProjectPart() const; + ProjectPart::Ptr fallbackProjectPart() const; - virtual CPlusPlus::Snapshot snapshot() const; - virtual Document::Ptr document(const QString &fileName) const; + CPlusPlus::Snapshot snapshot() const; + Document::Ptr document(const QString &fileName) const; bool replaceDocument(Document::Ptr newDoc); void emitDocumentUpdated(CPlusPlus::Document::Ptr doc); - virtual bool isCppEditor(Core::IEditor *editor) const; + bool isCppEditor(Core::IEditor *editor) const; - virtual void addExtraEditorSupport(AbstractEditorSupport *editorSupport); - virtual void removeExtraEditorSupport(AbstractEditorSupport *editorSupport); + void addExtraEditorSupport(AbstractEditorSupport *editorSupport); + void removeExtraEditorSupport(AbstractEditorSupport *editorSupport); - virtual EditorDocumentHandle *editorDocument(const QString &filePath); - virtual void registerEditorDocument(EditorDocumentHandle *editorDocument); - virtual void unregisterEditorDocument(const QString &filePath); + EditorDocumentHandle *editorDocument(const QString &filePath); + void registerEditorDocument(EditorDocumentHandle *editorDocument); + void unregisterEditorDocument(const QString &filePath); - virtual QList references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context); + QList references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context); - virtual void renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context, - const QString &replacement = QString()); - virtual void findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context); + void renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context, + const QString &replacement = QString()); + void findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context); - virtual void findMacroUsages(const CPlusPlus::Macro ¯o); - virtual void renameMacroUsages(const CPlusPlus::Macro ¯o, const QString &replacement); + void findMacroUsages(const CPlusPlus::Macro ¯o); + void renameMacroUsages(const CPlusPlus::Macro ¯o, const QString &replacement); - virtual void finishedRefreshingSourceFiles(const QSet &files); + void finishedRefreshingSourceFiles(const QSet &files); - virtual void addModelManagerSupport(ModelManagerSupport *modelManagerSupport); - virtual ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const; - virtual CppCompletionAssistProvider *completionAssistProvider(const QString &mimeType) const; - virtual BaseEditorDocumentProcessor *editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument) const; + void addModelManagerSupport(ModelManagerSupport *modelManagerSupport); + ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const; + CppCompletionAssistProvider *completionAssistProvider(const QString &mimeType) const; + BaseEditorDocumentProcessor *editorDocumentProcessor( + TextEditor::BaseTextDocument *baseTextDocument) const; - virtual void setIndexingSupport(CppIndexingSupport *indexingSupport); - virtual CppIndexingSupport *indexingSupport(); + void setIndexingSupport(CppIndexingSupport *indexingSupport); + CppIndexingSupport *indexingSupport(); QStringList projectFiles(); ProjectPart::HeaderPaths headerPaths(); // Use this *only* for auto tests - void setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths) - { - m_headerPaths = headerPaths; - } + void setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths); QByteArray definedMacros(); @@ -133,9 +151,24 @@ public: static QSet timeStampModifiedFiles(const QList &documentsToCheck); - static CppSourceProcessor *createSourceProcessor(); + static Internal::CppSourceProcessor *createSourceProcessor(); + static QString configurationFileName(); + static QString editorConfigurationFileName(); signals: + /// Project data might be locked while this is emitted. + void aboutToRemoveFiles(const QStringList &files); + + void documentUpdated(CPlusPlus::Document::Ptr doc); + void sourceFilesRefreshed(const QSet &files); + + /// \brief Emitted after updateProjectInfo function is called on the model-manager. + /// + /// Other classes can use this to get notified when the \c ProjectExplorer has updated the parts. + void projectPartsUpdated(ProjectExplorer::Project *project); + + void globalSnapshotChanged(); + void gcFinished(); // Needed for tests. public slots: @@ -171,46 +204,9 @@ private: void dumpModelManagerConfiguration(const QString &logFileId); private: - static QMutex m_instanceMutex; - static CppModelManager *m_instance; - -private: - // Snapshot - mutable QMutex m_snapshotMutex; - CPlusPlus::Snapshot m_snapshot; - - // Project integration - mutable QMutex m_projectMutex; - QMap m_projectToProjectsInfo; - QMap > m_fileToProjectParts; - QMap m_projectFileToProjectPart; - // The members below are cached/(re)calculated from the projects and/or their project parts - bool m_dirty; - QStringList m_projectFiles; - ProjectPart::HeaderPaths m_headerPaths; - QByteArray m_definedMacros; - - // Editor integration - mutable QMutex m_cppEditorsMutex; - QMap m_cppEditors; - QSet m_extraEditorSupports; - - // Completion & highlighting - QHash m_idTocodeModelSupporter; - QScopedPointer m_modelManagerSupportFallback; - - // Indexing - CppIndexingSupport *m_indexingSupporter; - CppIndexingSupport *m_internalIndexingSupport; - bool m_indexerEnabled; - - CppFindReferences *m_findReferences; - - bool m_enableGC; - QTimer *m_delayedGcTimer; + Internal::CppModelManagerPrivate *d; }; -} // namespace Internal } // namespace CppTools #endif // CPPMODELMANAGER_H diff --git a/src/plugins/cpptools/cppmodelmanager_test.cpp b/src/plugins/cpptools/cppmodelmanager_test.cpp index 32c5e5c0bff2b7184f6d2d751f883e2a6a13c72e..1d30e04c0ab94031d41bf838df6219f5eb0c5816 100644 --- a/src/plugins/cpptools/cppmodelmanager_test.cpp +++ b/src/plugins/cpptools/cppmodelmanager_test.cpp @@ -48,11 +48,9 @@ using namespace CppTools::Internal; using namespace ProjectExplorer; +using namespace CppTools; typedef CPlusPlus::Document Document; -typedef CppTools::ProjectInfo ProjectInfo; -typedef CppTools::ProjectPart ProjectPart; -typedef CppTools::ProjectFile ProjectFile; Q_DECLARE_METATYPE(QList) @@ -679,7 +677,7 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles() // Check working copy. // An AbstractEditorSupport object should have been added for the ui_* file. - CppModelManagerInterface *mm = CppModelManagerInterface::instance(); + CppModelManager *mm = CppModelManager::instance(); WorkingCopy workingCopy = mm->workingCopy(); QCOMPARE(workingCopy.size(), 2); // mm->configurationFileName() and "ui_*.h" diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.cpp b/src/plugins/cpptools/cppmodelmanagerinterface.cpp deleted file mode 100644 index a7b501136715f8e8f5b5b4e3665f268095adf4b3..0000000000000000000000000000000000000000 --- a/src/plugins/cpptools/cppmodelmanagerinterface.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** 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. -** -****************************************************************************/ - -#include "cppmodelmanagerinterface.h" - -#include - -using namespace CppTools; - -/*! - \enum CppTools::CppModelManagerInterface::ProgressNotificationMode - - This enum type specifies whether a progress bar notification should be - shown if more than one file is requested to update via - CppModelManagerInterface::updateSourceFiles(). - - \value ForcedProgressNotification - Notify regardless of the number of files requested for update. - \value ReservedProgressNotification - Notify only if more than one file is requested for update. -*/ - -/*! - \enum CppTools::CppModelManagerInterface::QtVersion - - Allows C++ parser engine to inject headers or change inner settings as - needed to parse Qt language extensions for concrete major Qt version - - \value UnknownQt - Parser may choose any policy - \value NoQt - Parser must not use special tricks, because it parses non-qt project - \value Qt4 - Parser may enable tricks for Qt v4.x - \value Qt5 - Parser may enable tricks for Qt v5.x -*/ - -/*! - \fn virtual QFuture updateProjectInfo(const ProjectInfo &pinfo) = 0; - \param pinfo Updated ProjectInfo. - \return A future that reports progress and allows to cancel the reparsing operation. - - This function is expected to be called by the project managers to update the - code model with new project information. - - In particular, the function should be called in case: - 1. A new project is opened/created - 2. The project configuration changed. This includes - 2.1 Changes of defines, includes, framework paths - 2.2 Addition/Removal of project files - - \sa CppTools::CppModelManagerInterface::updateSourceFiles() -*/ - -/*! - \fn virtual QFuture updateSourceFiles(const QStringList &sourceFiles, ProgressNotificationMode mode = ReservedProgressNotification) = 0; - \param sourceFiles List of source file to update. The items are absolute paths. - \param mode The progress modification mode. - \return A future that reports progress and allows to cancel the reparsing operation. - - Trigger an asynchronous reparsing of the given source files. - - This function is not meant to be called by the project managers. - - \sa CppTools::CppModelManagerInterface::ProgressNotificationMode - \sa CppTools::CppModelManagerInterface::updateProjectInfo() -*/ - -const QString CppModelManagerInterface::configurationFileName() -{ return CPlusPlus::Preprocessor::configurationFileName; } - -const QString CppModelManagerInterface::editorConfigurationFileName() -{ - return QLatin1String(""); -} - -CppModelManagerInterface::CppModelManagerInterface(QObject *parent) - : CPlusPlus::CppModelManagerBase(parent) -{ } - -CppModelManagerInterface::~CppModelManagerInterface() -{ } - -CppModelManagerInterface *CppModelManagerInterface::instance() -{ - return qobject_cast(CPlusPlus::CppModelManagerBase::instance()); -} diff --git a/src/plugins/cpptools/cppmodelmanagerinterface.h b/src/plugins/cpptools/cppmodelmanagerinterface.h deleted file mode 100644 index 4217dd3f0c360e0889d0dc73e8967f70563f0994..0000000000000000000000000000000000000000 --- a/src/plugins/cpptools/cppmodelmanagerinterface.h +++ /dev/null @@ -1,153 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of Qt Creator. -** -** 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. -** -****************************************************************************/ - -#ifndef CPPMODELMANAGERINTERFACE_H -#define CPPMODELMANAGERINTERFACE_H - -#include "cpptools_global.h" - -#include "cppprojects.h" - -#include -#include - -#include -#include -#include -#include -#include - -namespace Core { class IEditor; } -namespace CPlusPlus { class LookupContext; } -namespace ProjectExplorer { class Project; } -namespace TextEditor { class BaseTextEditor; class BaseTextDocument; class BlockRange; } -namespace Utils { class FileName; } - -namespace CppTools { - -class AbstractEditorSupport; -class BaseEditorDocumentProcessor; -class CppCompletionAssistProvider; -class EditorDocumentHandle; -class CppIndexingSupport; -class ModelManagerSupport; -class WorkingCopy; - -class CPPTOOLS_EXPORT CppModelManagerInterface : public CPlusPlus::CppModelManagerBase -{ - Q_OBJECT - -public: - // Documented in source file. - enum ProgressNotificationMode { - ForcedProgressNotification, - ReservedProgressNotification - }; - -public: - static const QString configurationFileName(); - static const QString editorConfigurationFileName(); - -public: - CppModelManagerInterface(QObject *parent = 0); - virtual ~CppModelManagerInterface(); - - static CppModelManagerInterface *instance(); - - virtual bool isCppEditor(Core::IEditor *editor) const = 0; - - virtual WorkingCopy workingCopy() const = 0; - virtual QByteArray codeModelConfiguration() const = 0; - - virtual QList projectInfos() const = 0; - virtual ProjectInfo projectInfo(ProjectExplorer::Project *project) const = 0; - virtual QFuture updateProjectInfo(const ProjectInfo &pinfo) = 0; - virtual ProjectPart::Ptr projectPartForProjectFile(const QString &projectFile) const = 0; - virtual QList projectPart(const QString &fileName) const = 0; - virtual QList projectPartFromDependencies(const QString &fileName) const = 0; - virtual ProjectPart::Ptr fallbackProjectPart() const = 0; - - virtual void addExtraEditorSupport(CppTools::AbstractEditorSupport *editorSupport) = 0; - virtual void removeExtraEditorSupport(CppTools::AbstractEditorSupport *editorSupport) = 0; - - virtual EditorDocumentHandle *editorDocument(const QString &filePath) = 0; - virtual void registerEditorDocument(EditorDocumentHandle *editorDocument) = 0; - virtual void unregisterEditorDocument(const QString &filePath) = 0; - - virtual QList references(CPlusPlus::Symbol *symbol, - const CPlusPlus::LookupContext &context) = 0; - - virtual void renameUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context, - const QString &replacement = QString()) = 0; - virtual void findUsages(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context) = 0; - - virtual void renameMacroUsages(const CPlusPlus::Macro ¯o, const QString &replacement = QString()) = 0; - virtual void findMacroUsages(const CPlusPlus::Macro ¯o) = 0; - - virtual void finishedRefreshingSourceFiles(const QSet &files) = 0; - - virtual void addModelManagerSupport(ModelManagerSupport *modelManagerSupport) = 0; - virtual ModelManagerSupport *modelManagerSupportForMimeType(const QString &mimeType) const = 0; - virtual CppCompletionAssistProvider *completionAssistProvider(const QString &mimeType) const = 0; - virtual BaseEditorDocumentProcessor *editorDocumentProcessor( - TextEditor::BaseTextDocument *baseTextDocument) const = 0; - - virtual void setIndexingSupport(CppTools::CppIndexingSupport *indexingSupport) = 0; - virtual CppIndexingSupport *indexingSupport() = 0; - - virtual void setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths) = 0; - virtual void enableGarbageCollector(bool enable) = 0; - - virtual ProjectPart::HeaderPaths headerPaths() = 0; - virtual QByteArray definedMacros() = 0; - -signals: - /// Project data might be locked while this is emitted. - void aboutToRemoveFiles(const QStringList &files); - - void documentUpdated(CPlusPlus::Document::Ptr doc); - void sourceFilesRefreshed(const QSet &files); - - /// \brief Emitted after updateProjectInfo function is called on the model-manager. - /// - /// Other classes can use this to get notified when the \c ProjectExplorer has updated the parts. - void projectPartsUpdated(ProjectExplorer::Project *project); - -public slots: - // Documented in source file. - virtual QFuture updateSourceFiles(const QSet &sourceFiles, - ProgressNotificationMode mode = ReservedProgressNotification) = 0; - - virtual void updateModifiedSourceFiles() = 0; - virtual void GC() = 0; -}; - -} // namespace CppTools - -#endif // CPPMODELMANAGERINTERFACE_H diff --git a/src/plugins/cpptools/cpprefactoringchanges.cpp b/src/plugins/cpptools/cpprefactoringchanges.cpp index 3a1f06465a09b426a4f6f408e5c0bcc2daf0cec9..057522c776ac52bded1c492bc8eab83e3c522124 100644 --- a/src/plugins/cpptools/cpprefactoringchanges.cpp +++ b/src/plugins/cpptools/cpprefactoringchanges.cpp @@ -46,7 +46,7 @@ class CppTools::CppRefactoringChangesData : public TextEditor::RefactoringChange public: CppRefactoringChangesData(const Snapshot &snapshot) : m_snapshot(snapshot) - , m_modelManager(Internal::CppModelManager::instance()) + , m_modelManager(CppModelManager::instance()) , m_workingCopy(m_modelManager->workingCopy()) {} @@ -78,7 +78,7 @@ public: } Snapshot m_snapshot; - CppModelManagerInterface *m_modelManager; + CppModelManager *m_modelManager; WorkingCopy m_workingCopy; }; diff --git a/src/plugins/cpptools/cpprefactoringchanges.h b/src/plugins/cpptools/cpprefactoringchanges.h index 3fb96ed72b7f7774c0924a60cf2ae9efb3fbc5e5..286988929c1a909df89b7b56f0c0a3341c6e630e 100644 --- a/src/plugins/cpptools/cpprefactoringchanges.h +++ b/src/plugins/cpptools/cpprefactoringchanges.h @@ -31,7 +31,7 @@ #define CPPREFACTORINGCHANGES_H #include "cpptools_global.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include diff --git a/src/plugins/cpptools/cppsourceprocessor.h b/src/plugins/cpptools/cppsourceprocessor.h index e503bd5b16ddeaad95bde554a26f9145690987ae..1843a8894d77bc2f0ee4bc034eb84f4c2c12f61c 100644 --- a/src/plugins/cpptools/cppsourceprocessor.h +++ b/src/plugins/cpptools/cppsourceprocessor.h @@ -30,7 +30,7 @@ #ifndef CPPSOURCEPROCESSOR_H #define CPPSOURCEPROCESSOR_H -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include "cppworkingcopy.h" #include diff --git a/src/plugins/cpptools/cpptools.pro b/src/plugins/cpptools/cpptools.pro index 83322a1dced9ec62bf9a91370f91d165c66e54af..4408a94714bd6776a56f2dea7870cb0b47e7df45 100644 --- a/src/plugins/cpptools/cpptools.pro +++ b/src/plugins/cpptools/cpptools.pro @@ -33,7 +33,6 @@ HEADERS += \ cpplocatordata.h \ cpplocatorfilter.h \ cppmodelmanager.h \ - cppmodelmanagerinterface.h \ cppmodelmanagersupport.h \ cppmodelmanagersupportinternal.h \ cpppointerdeclarationformatter.h \ @@ -95,7 +94,6 @@ SOURCES += \ cpplocatordata.cpp \ cpplocatorfilter.cpp \ cppmodelmanager.cpp \ - cppmodelmanagerinterface.cpp \ cppmodelmanagersupport.cpp \ cppmodelmanagersupportinternal.cpp \ cpppointerdeclarationformatter.cpp \ diff --git a/src/plugins/cpptools/cpptools.qbs b/src/plugins/cpptools/cpptools.qbs index 16996bc0606568159e5382ebff605bab56d1bde3..d4656891fd96cd29b2ffd6d8e253435cacb5b7be 100644 --- a/src/plugins/cpptools/cpptools.qbs +++ b/src/plugins/cpptools/cpptools.qbs @@ -53,7 +53,6 @@ QtcPlugin { "cpplocatordata.cpp", "cpplocatordata.h", "cpplocatorfilter.cpp", "cpplocatorfilter.h", "cppmodelmanager.cpp", "cppmodelmanager.h", - "cppmodelmanagerinterface.cpp", "cppmodelmanagerinterface.h", "cppmodelmanagersupport.cpp", "cppmodelmanagersupport.h", "cppmodelmanagersupportinternal.cpp", "cppmodelmanagersupportinternal.h", "cpppointerdeclarationformatter.cpp", "cpppointerdeclarationformatter.h", diff --git a/src/plugins/cpptools/cpptoolsplugin.h b/src/plugins/cpptools/cpptoolsplugin.h index 27de8d0ba4c84a3c64f62e72ad0a3791263e58f8..b3b883eb44a54c1f6c7255d74700791292ff604c 100644 --- a/src/plugins/cpptools/cpptoolsplugin.h +++ b/src/plugins/cpptools/cpptoolsplugin.h @@ -50,7 +50,6 @@ class CppToolsSettings; namespace Internal { -class CppModelManager; struct CppFileSettings; class CppCodeModelSettings; diff --git a/src/plugins/cpptools/cpptoolstestcase.cpp b/src/plugins/cpptools/cpptoolstestcase.cpp index c91451d179b93a4254a9ce9a3804734929d9e1f8..d76ee4818e84a003b2153d0b29a2c3acfc513431 100644 --- a/src/plugins/cpptools/cpptoolstestcase.cpp +++ b/src/plugins/cpptools/cpptoolstestcase.cpp @@ -39,9 +39,9 @@ static bool closeEditorsWithoutGarbageCollectorInvocation(const QList &editors) { - CppTools::CppModelManagerInterface::instance()->enableGarbageCollector(false); + CppTools::CppModelManager::instance()->enableGarbageCollector(false); const bool closeEditorsSucceeded = Core::EditorManager::closeEditors(editors, false); - CppTools::CppModelManagerInterface::instance()->enableGarbageCollector(true); + CppTools::CppModelManager::instance()->enableGarbageCollector(true); return closeEditorsSucceeded; } @@ -79,7 +79,7 @@ bool TestDocument::writeToDisk() const } TestCase::TestCase(bool runGarbageCollector) - : m_modelManager(CppModelManagerInterface::instance()) + : m_modelManager(CppModelManager::instance()) , m_succeededSoFar(false) , m_runGarbageCollector(runGarbageCollector) { @@ -116,18 +116,18 @@ bool TestCase::openBaseTextEditor(const QString &fileName, TextEditor::BaseTextE CPlusPlus::Snapshot TestCase::globalSnapshot() { - return CppModelManagerInterface::instance()->snapshot(); + return CppModelManager::instance()->snapshot(); } bool TestCase::garbageCollectGlobalSnapshot() { - CppModelManagerInterface::instance()->GC(); + CppModelManager::instance()->GC(); return globalSnapshot().isEmpty(); } bool TestCase::parseFiles(const QSet &filePaths) { - CppModelManagerInterface::instance()->updateSourceFiles(filePaths).waitForFinished(); + CppModelManager::instance()->updateSourceFiles(filePaths).waitForFinished(); QCoreApplication::processEvents(); const CPlusPlus::Snapshot snapshot = globalSnapshot(); if (snapshot.isEmpty()) { diff --git a/src/plugins/cpptools/cpptoolstestcase.h b/src/plugins/cpptools/cpptoolstestcase.h index c222aa506c8c0587ce16c4a41eba51e6bdc0170e..321e957bc4b2e21790f56b9f1f9e94f4f4a9ef33 100644 --- a/src/plugins/cpptools/cpptoolstestcase.h +++ b/src/plugins/cpptools/cpptoolstestcase.h @@ -30,7 +30,7 @@ #ifndef CPPTOOLSTESTCASE_H #define CPPTOOLSTESTCASE_H -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include "cpptools_global.h" #include @@ -88,7 +88,7 @@ public: static bool writeFile(const QString &filePath, const QByteArray &contents); protected: - CppModelManagerInterface *m_modelManager; + CppModelManager *m_modelManager; bool m_succeededSoFar; private: diff --git a/src/plugins/cpptools/symbolsfindfilter.h b/src/plugins/cpptools/symbolsfindfilter.h index 4c5c15b2471e9aa85ce3d9a1822d6fb77871076f..6f325b1ba5fa59c4d38b136bbf921259143fcce9 100644 --- a/src/plugins/cpptools/symbolsfindfilter.h +++ b/src/plugins/cpptools/symbolsfindfilter.h @@ -41,10 +41,11 @@ #include namespace CppTools { -namespace Internal { class CppModelManager; +namespace Internal { + class SymbolsFindFilter : public Core::IFindFilter { Q_OBJECT diff --git a/src/plugins/cpptools/typehierarchybuilder.h b/src/plugins/cpptools/typehierarchybuilder.h index fa40ffeefaafbb47c3ed2fa0d31edc2b2b71ca06..64a0edc93e7aba30f0c1f35f656e5059f0d2e285 100644 --- a/src/plugins/cpptools/typehierarchybuilder.h +++ b/src/plugins/cpptools/typehierarchybuilder.h @@ -31,7 +31,7 @@ #define CPPTOOLS_TYPEHIERARCHYBUILDER_H #include "cpptools_global.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include diff --git a/src/plugins/cpptools/typehierarchybuilder_test.cpp b/src/plugins/cpptools/typehierarchybuilder_test.cpp index 0a933dd8b99aa29cd7de2c77f95bbfa4debcc2d4..8627b83b185a4d06b26590ddf3d1e5347f8462ff 100644 --- a/src/plugins/cpptools/typehierarchybuilder_test.cpp +++ b/src/plugins/cpptools/typehierarchybuilder_test.cpp @@ -29,7 +29,7 @@ #include "cpptoolsplugin.h" -#include "cppmodelmanagerinterface.h" +#include "cppmodelmanager.h" #include "cpptoolstestcase.h" #include "typehierarchybuilder.h" diff --git a/src/plugins/debugger/cdb/cdbengine.cpp b/src/plugins/debugger/cdb/cdbengine.cpp index 56f278fb961887a9a86c41b0c984f76039893771..1c14b987afb20dd174ea943d90716797dec5e82a 100644 --- a/src/plugins/debugger/cdb/cdbengine.cpp +++ b/src/plugins/debugger/cdb/cdbengine.cpp @@ -67,7 +67,7 @@ #include #include -#include +#include #include #include @@ -2914,7 +2914,7 @@ void CdbEngine::attemptBreakpointSynchronization() && boolSetting(CdbBreakPointCorrection)) { if (lineCorrection.isNull()) lineCorrection.reset(new BreakpointCorrectionContext(debuggerCore()->cppCodeModelSnapshot(), - CppTools::CppModelManagerInterface::instance()->workingCopy())); + CppTools::CppModelManager::instance()->workingCopy())); response.lineNumber = lineCorrection->fixLineNumber(parameters.fileName, parameters.lineNumber); postBuiltinCommand( cdbAddBreakpointCommand(response, m_sourcePathMappings, id, false), 0, diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 222cf0501830b7a099adc0486759502e4b489d67..95ba90f53db97aae294f98ca87a768759867e84a 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -82,7 +82,7 @@ #include #include -#include +#include #include @@ -2515,7 +2515,7 @@ void DebuggerPluginPrivate::coreShutdown() const CPlusPlus::Snapshot &DebuggerPluginPrivate::cppCodeModelSnapshot() const { if (m_codeModelSnapshot.isEmpty() && action(UseCodeModel)->isChecked()) - m_codeModelSnapshot = CppTools::CppModelManagerInterface::instance()->snapshot(); + m_codeModelSnapshot = CppTools::CppModelManager::instance()->snapshot(); return m_codeModelSnapshot; } diff --git a/src/plugins/debugger/sourceutils.cpp b/src/plugins/debugger/sourceutils.cpp index 6b5308419176fe231ae607c9fff121da8b0cb077..1fb0b50ea15ef45c261ea19c2a8f6375b0f0acd2 100644 --- a/src/plugins/debugger/sourceutils.cpp +++ b/src/plugins/debugger/sourceutils.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include @@ -337,7 +337,7 @@ QString cppExpressionAt(TextEditor::BaseTextEditor *editor, int pos, QTextCursor tc = plaintext->textCursor(); QString expr = tc.selectedText(); - CppModelManagerInterface *modelManager = CppModelManagerInterface::instance(); + CppModelManager *modelManager = CppModelManager::instance(); if (expr.isEmpty() && modelManager) { QTextDocument *doc = plaintext->document(); QTC_ASSERT(doc, return QString()); @@ -394,7 +394,7 @@ QString cppFunctionAt(const QString &fileName, int line) { using namespace CppTools; using namespace CPlusPlus; - CppModelManagerInterface *modelManager = CppModelManagerInterface::instance(); + CppModelManager *modelManager = CppModelManager::instance(); return AbstractEditorSupport::functionAt(modelManager, fileName, line, 1); } diff --git a/src/plugins/designer/codemodelhelpers.cpp b/src/plugins/designer/codemodelhelpers.cpp index 5834a203fcc54bf00b5140732462a7f22b1d7577..8e29788ccb4601dea8d4fe33f66ef956af9b02fb 100644 --- a/src/plugins/designer/codemodelhelpers.cpp +++ b/src/plugins/designer/codemodelhelpers.cpp @@ -29,7 +29,7 @@ #include "codemodelhelpers.h" -#include +#include #include #include @@ -118,7 +118,7 @@ bool navigateToSlot(const QString &uiFileName, *errorMessage = QCoreApplication::translate("Designer", "The generated header of the form \"%1\" could not be found.\nRebuilding the project might help.").arg(uiFileName); return false; } - const CPlusPlus::Snapshot snapshot = CppTools::CppModelManagerInterface::instance()->snapshot(); + const CPlusPlus::Snapshot snapshot = CppTools::CppModelManager::instance()->snapshot(); const DocumentPtr generatedHeaderDoc = snapshot.document(generatedHeaderFile); if (!generatedHeaderDoc) { *errorMessage = QCoreApplication::translate("Designer", "The generated header \"%1\" could not be found in the code model.\nRebuilding the project might help.").arg(generatedHeaderFile); diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index 3699fff1b1d566fdfac3e2c91e1ec010eaad9f35..ff5b6b977328f2132e9b66ce4bcc77d37dffd76b 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -34,7 +34,7 @@ #include #include -#include +#include #include #include #include @@ -248,7 +248,7 @@ static Function *findDeclaration(const Class *cl, const QString &functionName) // TODO: remove me, this is taken from cppeditor.cpp. Find some common place for this function static Document::Ptr findDefinition(Function *functionDeclaration, int *line) { - if (CppTools::CppModelManagerInterface *cppModelManager = CppTools::CppModelManagerInterface::instance()) { + if (CppTools::CppModelManager *cppModelManager = CppTools::CppModelManager::instance()) { const Snapshot snapshot = cppModelManager->snapshot(); CppTools::SymbolFinder symbolFinder; if (Function *fun = symbolFinder.findMatchingDefinition(functionDeclaration, snapshot)) { @@ -523,7 +523,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, const QString uicedName = QLatin1String("ui_") + fi.completeBaseName() + QLatin1String(".h"); // Retrieve code model snapshot restricted to project of ui file or the working copy. - Snapshot docTable = CppTools::CppModelManagerInterface::instance()->snapshot(); + Snapshot docTable = CppTools::CppModelManager::instance()->snapshot(); Snapshot newDocTable; const Project *uiProject = SessionManager::projectForFile(currentUiFile); if (uiProject) { @@ -535,12 +535,12 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, } } else { const CppTools::WorkingCopy workingCopy = - CppTools::CppModelManagerInterface::instance()->workingCopy(); + CppTools::CppModelManager::instance()->workingCopy(); QHashIterator > it = workingCopy.iterator(); while (it.hasNext()) { it.next(); const QString fileName = it.key(); - if (fileName != CppTools::CppModelManagerInterface::configurationFileName()) + if (fileName != CppTools::CppModelManager::configurationFileName()) newDocTable.insert(docTable.document(fileName)); } } @@ -613,7 +613,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, } else { // add function declaration to cl CppTools::WorkingCopy workingCopy = - CppTools::CppModelManagerInterface::instance()->workingCopy(); + CppTools::CppModelManager::instance()->workingCopy(); const QString fileName = doc->fileName(); getParsedDocument(fileName, workingCopy, docTable); addDeclaration(docTable, fileName, cl, functionNameWithParameterNames); diff --git a/src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp b/src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp index aad699a56b4396017e94d06ef641a78e92a06504..07e146f4648a188bf313613d5ce08611a36c4ba0 100644 --- a/src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp +++ b/src/plugins/genericprojectmanager/cppmodelmanagerhelper.cpp @@ -44,9 +44,9 @@ CppModelManagerHelper::CppModelManagerHelper(QObject *parent) this, SLOT(onSourceFilesRefreshed(const QSet &))); } -CppModelManagerInterface *CppModelManagerHelper::cppModelManager() +CppModelManager *CppModelManagerHelper::cppModelManager() { - return CppModelManagerInterface::instance(); + return CppModelManager::instance(); } void CppModelManagerHelper::waitForSourceFilesRefreshed(const QString &file, int timeOut) diff --git a/src/plugins/genericprojectmanager/cppmodelmanagerhelper.h b/src/plugins/genericprojectmanager/cppmodelmanagerhelper.h index 30b98929be3537c76075200e49016a3a15b8bdd5..18e7c1d85eb81177cdc9a1abbd6097b9c44f8182 100644 --- a/src/plugins/genericprojectmanager/cppmodelmanagerhelper.h +++ b/src/plugins/genericprojectmanager/cppmodelmanagerhelper.h @@ -30,7 +30,7 @@ #ifndef CPPMODELMANAGERHELPER_H #define CPPMODELMANAGERHELPER_H -#include +#include #include #include @@ -45,7 +45,7 @@ class CppModelManagerHelper : public QObject public: explicit CppModelManagerHelper(QObject *parent = 0); - static CppTools::CppModelManagerInterface *cppModelManager(); + static CppTools::CppModelManager *cppModelManager(); enum { defaultTimeOut = 30 * 1000 }; // 30 secs void waitForSourceFilesRefreshed(const QString &file = QString(), int timeOut = defaultTimeOut); diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index 51dcdbd2364411d4e74ae1a711dc3821bb637c0d..bcdbc7aa2509dd7ce7130c697e43411578c46493 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include #include #include @@ -326,8 +326,8 @@ QStringList GenericProject::processEntries(const QStringList &paths, void GenericProject::refreshCppCodeModel() { - CppTools::CppModelManagerInterface *modelManager = - CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *modelManager = + CppTools::CppModelManager::instance(); if (!modelManager) return; diff --git a/src/plugins/genericprojectmanager/genericprojectplugin_test.cpp b/src/plugins/genericprojectmanager/genericprojectplugin_test.cpp index ec1770887ab3e2ed34bb792a176d700e933dde4a..127ab1c0c962e5a0c8b99590dc6a5f9117ece903 100644 --- a/src/plugins/genericprojectmanager/genericprojectplugin_test.cpp +++ b/src/plugins/genericprojectmanager/genericprojectplugin_test.cpp @@ -98,7 +98,7 @@ static ProjectInfo setupProject(const QByteArray &projectFile, const QByteArray // retrieve them for inspection. cppHelper.waitForSourceFilesRefreshed(projectFilePath(_(mainFile))); - CppModelManagerInterface *mm = cppHelper.cppModelManager(); + CppModelManager *mm = cppHelper.cppModelManager(); return mm->projectInfo(project); } diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index ff7cadbe452c68cd3e80a046f07f537d62def3e5..a1bcf2f1c153456cb87f0ab5fd11ba98f8cf1786 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include @@ -648,8 +648,8 @@ void QbsProject::updateCppCodeModel(const qbs::ProjectData &prj) QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(activeTarget()->kit()); - CppTools::CppModelManagerInterface *modelmanager = - CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *modelmanager = + CppTools::CppModelManager::instance(); if (!modelmanager) return; diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index ea85bf269f76b35946a0c53e7d0e5fc8ec9a634e..1daf1eeddb7c5148ed6ba11b18438dc3e49561c9 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -53,7 +53,7 @@ #include -#include +#include #include #include diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 639f86706e0749a4e66b35ed2952feb8af7776f2..49d1bba9419bde93726961822a967c5d632529c1 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include @@ -458,9 +458,9 @@ bool QmakeProject::equalFileList(const QStringList &a, const QStringList &b) QStringList::const_iterator bend = b.constEnd(); while (ait != aend && bit != bend) { - if (*ait == CppTools::CppModelManagerInterface::configurationFileName()) + if (*ait == CppTools::CppModelManager::configurationFileName()) ++ait; - else if (*bit == CppTools::CppModelManagerInterface::configurationFileName()) + else if (*bit == CppTools::CppModelManager::configurationFileName()) ++bit; else if (*ait == *bit) ++ait, ++bit; @@ -495,8 +495,8 @@ void QmakeProject::updateCppCodeModel() k = KitManager::defaultKit(); qtVersion = QtSupport::QtKitInformation::qtVersion(k); - CppTools::CppModelManagerInterface *modelmanager = - CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *modelmanager = + CppTools::CppModelManager::instance(); if (!modelmanager) return; @@ -575,7 +575,7 @@ void QmakeProject::updateCppCodeModel() } uiCodeModelData.unite(uiData); - cppPart->files.prepend(ProjectFile(CppTools::CppModelManagerInterface::configurationFileName(), + cppPart->files.prepend(ProjectFile(CppTools::CppModelManager::configurationFileName(), ProjectFile::CXXSource)); const QStringList cxxflags = pro->variableValue(CppFlagsVar); cppPart->evaluateToolchain(ToolChainKitInformation::toolChain(k), diff --git a/src/plugins/qmljstools/qmljsmodelmanager.cpp b/src/plugins/qmljstools/qmljsmodelmanager.cpp index c4d21bef9767f108bb8d872a0f5b7820375462bd..886d1f068539a2f76d35649da5470a45c0852541 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.cpp +++ b/src/plugins/qmljstools/qmljsmodelmanager.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -209,8 +209,8 @@ ModelManager::~ModelManager() void ModelManager::delayedInitialization() { - CppTools::CppModelManagerInterface *cppModelManager = - CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *cppModelManager = + CppTools::CppModelManager::instance(); if (cppModelManager) { // It's important to have a direct connection here so we can prevent // the source and AST of the cpp document being cleaned away. diff --git a/src/plugins/qmljstools/qmljsmodelmanager.h b/src/plugins/qmljstools/qmljsmodelmanager.h index ca0b2504a11b4f3102bd514deaf754986b63ce72..64a41ee04281b1cb94f86fc8c0a1dac930af84f4 100644 --- a/src/plugins/qmljstools/qmljsmodelmanager.h +++ b/src/plugins/qmljstools/qmljsmodelmanager.h @@ -48,16 +48,9 @@ QT_FORWARD_DECLARE_CLASS(QLocale) namespace Core { class MimeType; } -namespace CPlusPlus { class CppModelManagerInterface; } - -namespace QmlJS { class QrcParser; } - namespace QmlJSTools { - namespace Internal { -class PluginDumper; - class QMLJSTOOLS_EXPORT ModelManager: public QmlJS::ModelManagerInterface { Q_OBJECT diff --git a/src/plugins/qtsupport/uicodemodelsupport.cpp b/src/plugins/qtsupport/uicodemodelsupport.cpp index 4c297a5f28f8cd53b2deb58de51cf7782380e92e..3128280d862af9d811337e35d547e5a86a3c2f9f 100644 --- a/src/plugins/qtsupport/uicodemodelsupport.cpp +++ b/src/plugins/qtsupport/uicodemodelsupport.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include #include @@ -67,7 +67,7 @@ static inline QString formWindowEditorContents(const QObject *editor) namespace QtSupport { -UiCodeModelSupport::UiCodeModelSupport(CppTools::CppModelManagerInterface *modelmanager, +UiCodeModelSupport::UiCodeModelSupport(CppTools::CppModelManager *modelmanager, ProjectExplorer::Project *project, const QString &uiFile, const QString &uiHeaderFile) @@ -339,7 +339,7 @@ static UiCodeModelSupport *findUiFile(const QList &range, void UiCodeModelManager::update(ProjectExplorer::Project *project, QHash uiHeaders) { - CppTools::CppModelManagerInterface *mm = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *mm = CppTools::CppModelManager::instance(); // Find support to add/update: QList oldSupport = m_instance->m_projectUiSupport.value(project); @@ -391,7 +391,7 @@ void UiCodeModelManager::buildStateHasChanged(Project *project) void UiCodeModelManager::projectWasRemoved(Project *project) { - CppTools::CppModelManagerInterface *mm = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *mm = CppTools::CppModelManager::instance(); QList projectSupport = m_projectUiSupport.value(project); foreach (UiCodeModelSupport *const i, projectSupport) { diff --git a/src/plugins/qtsupport/uicodemodelsupport.h b/src/plugins/qtsupport/uicodemodelsupport.h index f71030a8f2db171119a5e817bd40e48c1fc6548d..fa57e046c7ec19a94618251755599ec4f211a806 100644 --- a/src/plugins/qtsupport/uicodemodelsupport.h +++ b/src/plugins/qtsupport/uicodemodelsupport.h @@ -40,7 +40,7 @@ #include namespace Core { class IEditor; } -namespace CPlusPlus { class CppModelManagerInterface; } +namespace CPlusPlus { class CppModelManager; } namespace ProjectExplorer { class Project; } namespace QtSupport { @@ -52,7 +52,7 @@ class UiCodeModelSupport : public CppTools::AbstractEditorSupport Q_OBJECT public: - UiCodeModelSupport(CppTools::CppModelManagerInterface *modelmanager, + UiCodeModelSupport(CppTools::CppModelManager *modelmanager, ProjectExplorer::Project *project, const QString &sourceFile, const QString &uiHeaderFile); diff --git a/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp b/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp index a209a94ab4a3e71e8204733ae024daf9fc251eb8..2b30651b22c6eeef6d716de0f71ef0409dee2e6e 100644 --- a/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp +++ b/src/plugins/texteditor/codeassist/keywordscompletionassist.cpp @@ -82,8 +82,8 @@ QStringList Keywords::argsForFunction(const QString &function) const // -------------------------- // KeywordsAssistProposalItem // -------------------------- -KeywordsAssistProposalItem::KeywordsAssistProposalItem(Keywords keywords) - : m_keywords(keywords) +KeywordsAssistProposalItem::KeywordsAssistProposalItem(bool isFunction) + : m_isFunction(isFunction) { } @@ -93,9 +93,7 @@ KeywordsAssistProposalItem::~KeywordsAssistProposalItem() bool KeywordsAssistProposalItem::prematurelyApplies(const QChar &c) const { // only '(' in case of a function - if (c == QLatin1Char('(') && m_keywords.isFunction(text())) - return true; - return false; + return c == QLatin1Char('(') && m_isFunction; } void KeywordsAssistProposalItem::applyContextualContent(BaseTextEditorWidget *editorWidget, @@ -106,7 +104,7 @@ void KeywordsAssistProposalItem::applyContextualContent(BaseTextEditorWidget *ed int replaceLength = editorWidget->position() - basePosition; QString toInsert = text(); int cursorOffset = 0; - if (m_keywords.isFunction(toInsert) && settings.m_autoInsertBrackets) { + if (m_isFunction && settings.m_autoInsertBrackets) { if (settings.m_spaceAfterFunctionName) { if (editorWidget->textAt(editorWidget->position(), 2) == QLatin1String(" (")) { cursorOffset = 2; @@ -263,7 +261,7 @@ void KeywordsCompletionAssistProcessor::addWordsToProposalList(QListsetText(words.at(i)); item->setIcon(icon); items->append(item); diff --git a/src/plugins/texteditor/codeassist/keywordscompletionassist.h b/src/plugins/texteditor/codeassist/keywordscompletionassist.h index 7a68c16fc824dbad6cda6f11faa37591db0061a6..6803d02c2ae0b5c0e918157e27fefda263d7379c 100644 --- a/src/plugins/texteditor/codeassist/keywordscompletionassist.h +++ b/src/plugins/texteditor/codeassist/keywordscompletionassist.h @@ -59,13 +59,13 @@ private: class TEXTEDITOR_EXPORT KeywordsAssistProposalItem : public AssistProposalItem { public: - KeywordsAssistProposalItem(Keywords keywords); + KeywordsAssistProposalItem(bool isFunction); ~KeywordsAssistProposalItem(); bool prematurelyApplies(const QChar &c) const QTC_OVERRIDE; void applyContextualContent(BaseTextEditorWidget *editorWidget, int basePosition) const QTC_OVERRIDE; private: - Keywords m_keywords; + bool m_isFunction; }; class TEXTEDITOR_EXPORT KeywordsFunctionHintModel : public IFunctionHintProposalModel diff --git a/src/plugins/todo/cpptodoitemsscanner.cpp b/src/plugins/todo/cpptodoitemsscanner.cpp index c60622251868ac9a99408dd1c8c8a172907ac573..0a949170d59f53cc2317de345bd55e8e0c807f7f 100644 --- a/src/plugins/todo/cpptodoitemsscanner.cpp +++ b/src/plugins/todo/cpptodoitemsscanner.cpp @@ -41,7 +41,7 @@ namespace Internal { CppTodoItemsScanner::CppTodoItemsScanner(const KeywordList &keywordList, QObject *parent) : TodoItemsScanner(keywordList, parent) { - CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance(); connect(modelManager, SIGNAL(documentUpdated(CPlusPlus::Document::Ptr)), this, SLOT(documentUpdated(CPlusPlus::Document::Ptr)), Qt::DirectConnection); @@ -52,7 +52,7 @@ void CppTodoItemsScanner::keywordListChanged() // We need to rescan everything known to the code model // TODO: It would be nice to only tokenize the source files, not update the code model entirely. - CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance(); QSet filesToBeUpdated; foreach (const CppTools::ProjectInfo &info, modelManager->projectInfos()) @@ -63,7 +63,7 @@ void CppTodoItemsScanner::keywordListChanged() void CppTodoItemsScanner::documentUpdated(CPlusPlus::Document::Ptr doc) { - CppTools::CppModelManagerInterface *modelManager = CppTools::CppModelManagerInterface::instance(); + CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance(); if (!modelManager->projectPart(doc->fileName()).isEmpty()) processDocument(doc); } diff --git a/src/plugins/todo/cpptodoitemsscanner.h b/src/plugins/todo/cpptodoitemsscanner.h index 78a7d9158d06a01477b9d8cb910362d5c16c7fb8..d542af3038b34175867fb80a19fd05b3830d4a03 100644 --- a/src/plugins/todo/cpptodoitemsscanner.h +++ b/src/plugins/todo/cpptodoitemsscanner.h @@ -33,7 +33,7 @@ #include "todoitemsscanner.h" -#include +#include namespace Todo { namespace Internal { diff --git a/src/plugins/todo/todoitemsprovider.cpp b/src/plugins/todo/todoitemsprovider.cpp index e2d260b8a1994bd13fdfd7be5319be9734f4a5ae..4c97291d58c414d26bf29032c22f3c544f762771 100644 --- a/src/plugins/todo/todoitemsprovider.cpp +++ b/src/plugins/todo/todoitemsprovider.cpp @@ -94,7 +94,7 @@ void TodoItemsProvider::createScanners() { qRegisterMetaType >("QList"); - if (CppTools::CppModelManagerInterface::instance()) + if (CppTools::CppModelManager::instance()) m_scanners << new CppTodoItemsScanner(m_settings.keywords, this); if (QmlJS::ModelManagerInterface::instance()) diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 8c08d5812120357d7476ce5f009c9df0846c13ae..ee8f49497c1b05719d352d9ca2fa2427be07fec7 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -39,7 +39,7 @@ #include "vcsplugin.h" #include -#include +#include #include #include #include @@ -438,7 +438,7 @@ void VcsBaseSubmitEditor::setFileModel(SubmitFileModel *model, const QString &re d->m_widget->setFileModel(model); QSet uniqueSymbols; - const CPlusPlus::Snapshot cppSnapShot = CppTools::CppModelManagerInterface::instance()->snapshot(); + const CPlusPlus::Snapshot cppSnapShot = CppTools::CppModelManager::instance()->snapshot(); // Iterate over the files and get interesting symbols for (int row = 0; row < model->rowCount(); ++row) {