summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcompletionassist.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-08-30 13:13:44 +0200
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-09-09 11:59:14 +0200
commitb4a1bd415f3783d826f012a7d47d1e96218e1730 (patch)
tree89d88a8fc184e0273ae3f48a27ff5f653cad2443 /src/plugins/cpptools/cppcompletionassist.cpp
parent49adb78ec967be09cfb934d997fb9bc54f1c535e (diff)
downloadqt-creator-b4a1bd415f3783d826f012a7d47d1e96218e1730.tar.gz
C++: clean-up CppCompletionAssist.
This is step 1 of 2 for merging the various provider factories into a single class. Merging has the advantage that selecting based on editor (content) mime-type only has to select one class, instead of re-doing the selection for each class separately. Change-Id: I11f815151bd4769ae6028b636793d6a80d02e202 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcompletionassist.cpp')
-rw-r--r--src/plugins/cpptools/cppcompletionassist.cpp53
1 files changed, 17 insertions, 36 deletions
diff --git a/src/plugins/cpptools/cppcompletionassist.cpp b/src/plugins/cpptools/cppcompletionassist.cpp
index c5a7b1a7bf..3ad517e650 100644
--- a/src/plugins/cpptools/cppcompletionassist.cpp
+++ b/src/plugins/cpptools/cppcompletionassist.cpp
@@ -416,44 +416,25 @@ IAssistProcessor *InternalCompletionAssistProvider::createProcessor() const
return new CppCompletionAssistProcessor;
}
-namespace {
-class CppCompletionSupportInternal: public CppCompletionSupport
+TextEditor::IAssistInterface *InternalCompletionAssistProvider::createAssistInterface(
+ ProjectExplorer::Project *project, const QString &filePath, QTextDocument *document,
+ int position, TextEditor::AssistReason reason) const
{
-public:
- CppCompletionSupportInternal(TextEditor::ITextEditor *editor)
- : CppCompletionSupport(editor)
- {}
-
- virtual ~CppCompletionSupportInternal()
- {}
-
- virtual TextEditor::IAssistInterface *createAssistInterface(ProjectExplorer::Project *project,
- QTextDocument *document,
- int position,
- TextEditor::AssistReason reason) const
- {
- CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
- QStringList includePaths;
- QStringList frameworkPaths;
- if (project) {
- includePaths = modelManager->projectInfo(project).includePaths();
- frameworkPaths = modelManager->projectInfo(project).frameworkPaths();
- }
- return new CppTools::Internal::CppCompletionAssistInterface(
- document,
- position,
- editor()->document()->filePath(),
- reason,
- modelManager->snapshot(),
- includePaths,
- frameworkPaths);
+ CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
+ QStringList includePaths;
+ QStringList frameworkPaths;
+ if (project) {
+ includePaths = modelManager->projectInfo(project).includePaths();
+ frameworkPaths = modelManager->projectInfo(project).frameworkPaths();
}
-};
-}
-
-CppCompletionSupport *InternalCompletionAssistProvider::completionSupport(ITextEditor *editor)
-{
- return new CppCompletionSupportInternal(editor);
+ return new CppTools::Internal::CppCompletionAssistInterface(
+ document,
+ position,
+ filePath,
+ reason,
+ modelManager->snapshot(),
+ includePaths,
+ frameworkPaths);
}
// -----------------