Commit b26a17f3 authored by hjk's avatar hjk Committed by Nikolai Kosjar
Browse files

CppTools: Change CppModelManager implementation pattern



Replace the CppModelManagerInterface/derived CppModelManager
combo by a more common CppModelManager/CppModelManagerPrivate
pimpl pattern.

Change-Id: Ia4582845ed94d5ef60b8571bab9b2260c6290287
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@digia.com>
parent e5e86931
......@@ -31,14 +31,14 @@
#include "analyzerconstants.h"
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <texteditor/basetexteditor.h>
#include <utils/qtcassert.h>
#include <cplusplus/ExpressionUnderCursor.h>
#include <cplusplus/TypeOfExpression.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <QTextCursor>
......@@ -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);
......
......@@ -49,7 +49,7 @@
#include <projectexplorer/target.h>
#include <projectexplorer/headerpath.h>
#include <extensionsystem/pluginmanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <utils/qtcassert.h>
......@@ -400,8 +400,8 @@ QList<Node *> AutotoolsProject::nodes(FolderNode *parent) const
void AutotoolsProject::updateCppCodeModel()
{
CppTools::CppModelManagerInterface *modelManager =
CppTools::CppModelManagerInterface::instance();
CppTools::CppModelManager *modelManager =
CppTools::CppModelManager::instance();
if (!modelManager)
return;
......
......@@ -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;
......
......@@ -43,7 +43,7 @@
#include <cppeditor/cppeditorconstants.h>
#include <cpptools/cppdoxygen.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cppworkingcopy.h>
#include <texteditor/basetexteditor.h>
......@@ -208,7 +208,7 @@ AssistInterface *ClangCompletionAssistProvider::createAssistInterface(
{
Q_UNUSED(isObjCEnabled);
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
CppModelManager *modelManager = CppModelManager::instance();
QList<ProjectPart::Ptr> 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());
}
......
......@@ -35,7 +35,7 @@
#include <cplusplus/Icons.h>
#include <cpptools/cppcompletionassistprovider.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <texteditor/codeassist/assistproposalitem.h>
#include <texteditor/codeassist/completionassistprovider.h>
......
......@@ -32,7 +32,7 @@
#include "pchinfo.h"
#include "pchmanager.h"
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cppprojects.h>
#include <cpptools/cppworkingcopy.h>
......
......@@ -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<void>::finished,
this, &ClangEditorDocumentProcessor::onParserFinished);
......
......@@ -35,7 +35,7 @@
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <projectexplorer/session.h>
#include <QDir>
......@@ -94,7 +94,7 @@ CppTools::CppIndexingSupport *ClangIndexer::indexingSupport()
QFuture<void> 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<ProjectPart::Ptr> &parts = mmi->projectPart(file);
ProjectPart::Ptr part;
if (!parts.isEmpty())
......
......@@ -32,7 +32,7 @@
#include "utils.h"
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
namespace ClangCodeModel {
namespace Utils {
......
......@@ -34,7 +34,7 @@
#include "symbol.h"
#include "unit.h"
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <QtCore/QObject>
#include <QtCore/QString>
......
......@@ -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<ProjectPart::Ptr> projectParts = mmi->projectInfo(
cps->project()).projectParts();
updatePchInfo(cps, projectParts);
......@@ -435,7 +435,7 @@ void PchManager::updateActivePchFiles()
QMutexLocker locker(&m_mutex);
QSet<ProjectPart::Ptr> activeParts;
CppTools::CppModelManagerInterface *mmi = CppTools::CppModelManagerInterface::instance();
CppTools::CppModelManager *mmi = CppTools::CppModelManager::instance();
foreach (const CppTools::ProjectInfo &pi, mmi->projectInfos())
activeParts.unite(QSet<ProjectPart::Ptr>::fromList(pi.projectParts()));
QList<ProjectPart::Ptr> partsWithPCHFiles = m_activePchFiles.keys();
......
......@@ -33,7 +33,7 @@
#include "clangprojectsettings.h"
#include "pchinfo.h"
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <projectexplorer/project.h>
#include <coreplugin/messagemanager.h>
......
......@@ -36,7 +36,7 @@
#include <utils/qtcassert.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/session.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpptoolsconstants.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <coreplugin/editormanager/editormanager.h>
......@@ -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)),
......
......@@ -38,7 +38,7 @@
#include <cplusplus/Name.h>
// other
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <cplusplus/Overview.h>
#include <cplusplus/Icons.h>
#include <projectexplorer/projectexplorer.h>
......@@ -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());
}
......
......@@ -53,7 +53,7 @@
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/uicodemodelsupport.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
......@@ -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();
......
......@@ -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
......
......@@ -30,7 +30,7 @@
#ifndef CPPCODEMODELINSPECTORDIALOG_H
#define CPPCODEMODELINSPECTORDIALOG_H
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <cplusplus/CppDocument.h>
......
......@@ -31,7 +31,7 @@
#include "cppeditortestcase.h"
#include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <cplusplus/CppDocument.h>
#include <utils/fileutils.h>
......
......@@ -50,7 +50,7 @@
#include <cpptools/cppchecksymbols.h>
#include <cpptools/cppcodeformatter.h>
#include <cpptools/cppcompletionassistprovider.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cppsemanticinfo.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/cpptoolsplugin.h>
......@@ -102,7 +102,7 @@ public:
CppEditorWidgetPrivate(CppEditorWidget *q);
public:
QPointer<CppTools::CppModelManagerInterface> m_modelManager;
QPointer<CppTools::CppModelManager> 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<CppEditorDocument *>(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);
......
......@@ -36,7 +36,7 @@
#include <cpptools/builtineditordocumentprocessor.h>
#include <cpptools/cppcodeformatter.h>
#include <cpptools/cppcodemodelsettings.h>
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cppqtstyleindenter.h>
#include <cpptools/cpptoolsconstants.h>
#include <cpptools/cpptoolsplugin.h>
......@@ -50,9 +50,9 @@
namespace {
CppTools::CppModelManagerInterface *mm()
CppTools::CppModelManager *mm()
{
return CppTools::CppModelManagerInterface::instance();
return CppTools::CppModelManager::instance();
}
} // anonymous namespace
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment