CppTools: Move ProjectPart in its own header file

Also extracting inline HeaderPath class and change projects list in vector
because the size is  larger than a pointer.

Change-Id: I885fdff3fe9bccc877634d1615249755f5b674fd
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Marco Bubke
2016-01-13 14:12:15 +01:00
parent 42d570a3fe
commit 2b4cadf1fe
34 changed files with 532 additions and 372 deletions

View File

@@ -41,7 +41,7 @@ ClangCompletionAssistInterface::ClangCompletionAssistInterface(
int position,
const QString &fileName,
TextEditor::AssistReason reason,
const CppTools::ProjectPart::HeaderPaths &headerPaths,
const CppTools::ProjectPartHeaderPaths &headerPaths,
const CPlusPlus::LanguageFeatures &features)
: AssistInterface(textEditorWidget->document(), position, fileName, reason)
, m_ipcCommunicator(ipcCommunicator)
@@ -56,7 +56,7 @@ bool ClangCompletionAssistInterface::objcEnabled() const
return true; // TODO:
}
const CppTools::ProjectPart::HeaderPaths &ClangCompletionAssistInterface::headerPaths() const
const CppTools::ProjectPartHeaderPaths &ClangCompletionAssistInterface::headerPaths() const
{
return m_headerPaths;
}
@@ -66,7 +66,7 @@ CPlusPlus::LanguageFeatures ClangCompletionAssistInterface::languageFeatures() c
return m_languageFeatures;
}
void ClangCompletionAssistInterface::setHeaderPaths(const CppTools::ProjectPart::HeaderPaths &headerPaths)
void ClangCompletionAssistInterface::setHeaderPaths(const CppTools::ProjectPartHeaderPaths &headerPaths)
{
m_headerPaths = headerPaths;
}

View File

@@ -47,21 +47,21 @@ public:
int position,
const QString &fileName,
TextEditor::AssistReason reason,
const CppTools::ProjectPart::HeaderPaths &headerPaths,
const CppTools::ProjectPartHeaderPaths &headerPaths,
const CPlusPlus::LanguageFeatures &features);
IpcCommunicator &ipcCommunicator() const;
bool objcEnabled() const;
const CppTools::ProjectPart::HeaderPaths &headerPaths() const;
const CppTools::ProjectPartHeaderPaths &headerPaths() const;
CPlusPlus::LanguageFeatures languageFeatures() const;
const TextEditor::TextEditorWidget *textEditorWidget() const;
void setHeaderPaths(const CppTools::ProjectPart::HeaderPaths &headerPaths); // For tests
void setHeaderPaths(const CppTools::ProjectPartHeaderPaths &headerPaths); // For tests
private:
IpcCommunicator &m_ipcCommunicator;
QStringList m_options;
CppTools::ProjectPart::HeaderPaths m_headerPaths;
CppTools::ProjectPartHeaderPaths m_headerPaths;
CPlusPlus::LanguageFeatures m_languageFeatures;
const TextEditor::TextEditorWidget *m_textEditorWidget;
};

View File

@@ -565,9 +565,9 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
}
// Make completion for all relevant includes
CppTools::ProjectPart::HeaderPaths headerPaths = m_interface->headerPaths();
const CppTools::ProjectPart::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
CppTools::ProjectPart::HeaderPath::IncludePath);
CppTools::ProjectPartHeaderPaths headerPaths = m_interface->headerPaths();
const CppTools::ProjectPartHeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
CppTools::ProjectPartHeaderPath::IncludePath);
if (!headerPaths.contains(currentFilePath))
headerPaths.append(currentFilePath);
@@ -575,7 +575,7 @@ bool ClangCompletionAssistProcessor::completeInclude(const QTextCursor &cursor)
const ::Utils::MimeType mimeType = mdb.mimeTypeForName(QLatin1String("text/x-c++hdr"));
const QStringList suffixes = mimeType.suffixes();
foreach (const CppTools::ProjectPart::HeaderPath &headerPath, headerPaths) {
foreach (const CppTools::ProjectPartHeaderPath &headerPath, headerPaths) {
QString realPath = headerPath.path;
if (!directoryPrefix.isEmpty()) {
realPath += QLatin1Char('/');

View File

@@ -432,13 +432,13 @@ public:
QString senderLog;
};
const CppTools::ProjectPart::HeaderPaths toHeaderPaths(const QStringList &paths)
const CppTools::ProjectPartHeaderPaths toHeaderPaths(const QStringList &paths)
{
using namespace CppTools;
ProjectPart::HeaderPaths result;
ProjectPartHeaderPaths result;
foreach (const QString &path, paths)
result << ProjectPart::HeaderPath(path, ProjectPart::HeaderPath::IncludePath);
result << ProjectPartHeaderPath(path, ProjectPartHeaderPath::IncludePath);
return result;
}