TextEditor: Introduce AssistProposalItemInterface

For unit test we need to break every dependency to the TextEditor
Widget etc.. With an abstract interface we can implement it in clang
without relying on unwanted dependencies. It makes it also easier to
compute the values deferred.

Change-Id: I1b313a1625f4e80bd324ab4bf1a7c4f6b690abe9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Marco Bubke
2016-02-01 14:51:01 +01:00
parent e42bf6ebc6
commit c903f4974f
31 changed files with 187 additions and 105 deletions

View File

@@ -58,14 +58,14 @@ namespace ClangCodeModel {
namespace Internal {
using ClangBackEnd::CodeCompletion;
using TextEditor::AssistProposalItem;
using TextEditor::AssistProposalItemInterface;
namespace {
const char SNIPPET_ICON_PATH[] = ":/texteditor/images/snippet.png";
QList<AssistProposalItem *> toAssistProposalItems(const CodeCompletions &completions)
QList<AssistProposalItemInterface *> toAssistProposalItems(const CodeCompletions &completions)
{
static CPlusPlus::Icons m_icons; // de-deduplicate
@@ -178,7 +178,7 @@ QList<AssistProposalItem *> toAssistProposalItems(const CodeCompletions &complet
}
}
QList<AssistProposalItem *> results;
QList<AssistProposalItemInterface *> results;
results.reserve(items.size());
std::copy(items.cbegin(), items.cend(), std::back_inserter(results));