Commit 2b4cadf1 authored by Marco Bubke's avatar Marco Bubke

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: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 42d570a3
......@@ -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;
}
......
......@@ -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;
};
......
......@@ -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('/');
......
......@@ -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;
}
......
......@@ -109,7 +109,7 @@ QList<QuickFixTestDocument::Ptr> singleDocument(const QByteArray &original,
}
BaseQuickFixTestCase::BaseQuickFixTestCase(const QList<QuickFixTestDocument::Ptr> &testDocuments,
const ProjectPart::HeaderPaths &headerPaths)
const ProjectPartHeaderPaths &headerPaths)
: m_testDocuments(testDocuments)
, m_cppCodeStylePreferences(0)
, m_restoreHeaderPaths(false)
......@@ -229,7 +229,7 @@ static QString &removeTrailingWhitespace(QString &input)
QuickFixOperationTest::QuickFixOperationTest(const QList<QuickFixTestDocument::Ptr> &testDocuments,
CppQuickFixFactory *factory,
const ProjectPart::HeaderPaths &headerPaths,
const ProjectPartHeaderPaths &headerPaths,
int operationIndex,
const QByteArray &expectedFailMessage)
: BaseQuickFixTestCase(testDocuments, headerPaths)
......@@ -272,15 +272,15 @@ void QuickFixOperationTest::run(const QList<QuickFixTestDocument::Ptr> &testDocu
const QString &headerPath,
int operationIndex)
{
ProjectPart::HeaderPaths headerPaths;
headerPaths += ProjectPart::HeaderPath(headerPath, ProjectPart::HeaderPath::IncludePath);
ProjectPartHeaderPaths headerPaths;
headerPaths += ProjectPartHeaderPath(headerPath, ProjectPartHeaderPath::IncludePath);
QuickFixOperationTest(testDocuments, factory, headerPaths, operationIndex);
}
QuickFixOfferedOperationsTest::QuickFixOfferedOperationsTest(
const QList<QuickFixTestDocument::Ptr> &testDocuments,
CppQuickFixFactory *factory,
const ProjectPart::HeaderPaths &headerPaths,
const ProjectPartHeaderPaths &headerPaths,
const QStringList &expectedOperations)
: BaseQuickFixTestCase(testDocuments, headerPaths)
{
......@@ -1857,7 +1857,7 @@ void CppEditorPlugin::test_quickfix_GenerateGetterSetter_onlyGetter()
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
GenerateGetterSetter factory;
QuickFixOperationTest(testDocuments, &factory, ProjectPart::HeaderPaths(), 1);
QuickFixOperationTest(testDocuments, &factory, ProjectPartHeaderPaths(), 1);
}
/// Checks: Only generate setter
......@@ -1894,7 +1894,7 @@ void CppEditorPlugin::test_quickfix_GenerateGetterSetter_onlySetter()
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
GenerateGetterSetter factory;
QuickFixOperationTest(testDocuments, &factory, ProjectPart::HeaderPaths(), 2);
QuickFixOperationTest(testDocuments, &factory, ProjectPartHeaderPaths(), 2);
}
/// Checks: Offer a "generate getter" quick fix if there is a setter
......@@ -2015,7 +2015,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_afterClass()
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
InsertDefFromDecl factory;
QuickFixOperationTest(testDocuments, &factory, ProjectPart::HeaderPaths(), 1);
QuickFixOperationTest(testDocuments, &factory, ProjectPartHeaderPaths(), 1);
}
/// Check from header file: If there is a source file, insert the definition in the source file.
......@@ -2201,7 +2201,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_insideClass()
"};";
InsertDefFromDecl factory;
QuickFixOperationTest(singleDocument(original, expected), &factory, ProjectPart::HeaderPaths(),
QuickFixOperationTest(singleDocument(original, expected), &factory, ProjectPartHeaderPaths(),
1);
}
......@@ -2215,7 +2215,7 @@ void CppEditorPlugin::test_quickfix_InsertDefFromDecl_notTriggeringWhenDefinitio
"void Foo::bar() {}\n";
InsertDefFromDecl factory;
QuickFixOperationTest(singleDocument(original, ""), &factory, ProjectPart::HeaderPaths(), 1);
QuickFixOperationTest(singleDocument(original, ""), &factory, ProjectPartHeaderPaths(), 1);
}
/// Find right implementation file.
......@@ -2629,7 +2629,7 @@ void insertToSectionDeclFromDef(const QByteArray &section, int sectionIndex)
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
InsertDeclFromDef factory;
QuickFixOperationTest(testDocuments, &factory, ProjectPart::HeaderPaths(), sectionIndex);
QuickFixOperationTest(testDocuments, &factory, ProjectPartHeaderPaths(), sectionIndex);
}
/// Check from source file: Insert in header file.
......@@ -3391,9 +3391,9 @@ void CppEditorPlugin::test_quickfix_AddIncludeForUndefinedIdentifier_noDoubleQtH
original = expected = "@QDir dir;\n";
testDocuments << QuickFixTestDocument::create(base + "/fileWantsToUseQDir.cpp", original, expected);
ProjectPart::HeaderPaths headerPaths;
headerPaths += ProjectPart::HeaderPath(TestIncludePaths::globalQtCoreIncludePath(),
ProjectPart::HeaderPath::IncludePath);
ProjectPartHeaderPaths headerPaths;
headerPaths += ProjectPartHeaderPath(TestIncludePaths::globalQtCoreIncludePath(),
ProjectPartHeaderPath::IncludePath);
AddIncludeForUndefinedIdentifier factory;
const QStringList expectedOperations = QStringList() << QLatin1String("Add #include <QDir>");
......@@ -3561,7 +3561,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_MemberFuncOutside2()
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
MoveFuncDefOutside factory;
QuickFixOperationTest(testDocuments, &factory, ProjectPart::HeaderPaths(), 1);
QuickFixOperationTest(testDocuments, &factory, ProjectPartHeaderPaths(), 1);
}
/// Check: Move definition from header to cpp (with namespace).
......@@ -3868,7 +3868,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_afterClass()
testDocuments << QuickFixTestDocument::create("file.cpp", original, expected);
MoveFuncDefOutside factory;
QuickFixOperationTest(testDocuments, &factory, ProjectPart::HeaderPaths(), 1);
QuickFixOperationTest(testDocuments, &factory, ProjectPartHeaderPaths(), 1);
}
/// Check if whitespace is respected for operator functions
......@@ -3943,7 +3943,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefOutside_macroUses()
MoveFuncDefOutside factory;
QuickFixOperationTest(singleDocument(original, expected), &factory,
ProjectPart::HeaderPaths(), 0, "QTCREATORBUG-12314");
ProjectPartHeaderPaths(), 0, "QTCREATORBUG-12314");
}
/// Check: revert test_quickfix_MoveFuncDefOutside_MemberFuncToCpp()
......@@ -4277,7 +4277,7 @@ void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_macroUses()
MoveFuncDefToDecl factory;
QuickFixOperationTest(singleDocument(original, expected), &factory,
ProjectPart::HeaderPaths(), 0, "QTCREATORBUG-12314");
ProjectPartHeaderPaths(), 0, "QTCREATORBUG-12314");
}
void CppEditorPlugin::test_quickfix_MoveFuncDefToDecl_override()
......
......@@ -81,8 +81,8 @@ public:
/// Exactly one QuickFixTestDocument must contain the cursor position marker '@'
/// or "@{start}" and "@{end}"
BaseQuickFixTestCase(const QList<QuickFixTestDocument::Ptr> &testDocuments,
const CppTools::ProjectPart::HeaderPaths &headerPaths
= CppTools::ProjectPart::HeaderPaths());
const CppTools::ProjectPartHeaderPaths &headerPaths
= CppTools::ProjectPartHeaderPaths());
~BaseQuickFixTestCase();
......@@ -96,7 +96,7 @@ private:
CppTools::CppCodeStylePreferences *m_cppCodeStylePreferences;
QByteArray m_cppCodeStylePreferencesOriginalDelegateId;
CppTools::ProjectPart::HeaderPaths m_headerPathsToRestore;
CppTools::ProjectPartHeaderPaths m_headerPathsToRestore;
bool m_restoreHeaderPaths;
};
......@@ -106,8 +106,8 @@ class QuickFixOperationTest : public BaseQuickFixTestCase
public:
QuickFixOperationTest(const QList<QuickFixTestDocument::Ptr> &testDocuments,
CppQuickFixFactory *factory,
const CppTools::ProjectPart::HeaderPaths &headerPaths
= CppTools::ProjectPart::HeaderPaths(),
const CppTools::ProjectPartHeaderPaths &headerPaths
= CppTools::ProjectPartHeaderPaths(),
int operationIndex = 0,
const QByteArray &expectedFailMessage = QByteArray());
......@@ -123,8 +123,8 @@ class QuickFixOfferedOperationsTest : public BaseQuickFixTestCase
public:
QuickFixOfferedOperationsTest(const QList<QuickFixTestDocument::Ptr> &testDocuments,
CppQuickFixFactory *factory,
const CppTools::ProjectPart::HeaderPaths &headerPaths
= CppTools::ProjectPart::HeaderPaths(),
const CppTools::ProjectPartHeaderPaths &headerPaths
= CppTools::ProjectPartHeaderPaths(),
const QStringList &expectedOperations = QStringList());
};
......
......@@ -1751,7 +1751,7 @@ namespace {
QString findShortestInclude(const QString currentDocumentFilePath,
const QString candidateFilePath,
const ProjectPart::HeaderPaths &headerPaths)
const ProjectPartHeaderPaths &headerPaths)
{
QString result;
......@@ -1760,7 +1760,7 @@ QString findShortestInclude(const QString currentDocumentFilePath,
if (fileInfo.path() == QFileInfo(currentDocumentFilePath).path()) {
result = QLatin1Char('"') + fileInfo.fileName() + QLatin1Char('"');
} else {
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
foreach (const ProjectPartHeaderPath &headerPath, headerPaths) {
if (!candidateFilePath.startsWith(headerPath.path))
continue;
QString relativePath = candidateFilePath.mid(headerPath.path.size());
......@@ -1775,12 +1775,12 @@ QString findShortestInclude(const QString currentDocumentFilePath,
}
QString findQtIncludeWithSameName(const QString &className,
const ProjectPart::HeaderPaths &headerPaths)
const ProjectPartHeaderPaths &headerPaths)
{
QString result;
// Check for a header file with the same name in the Qt include paths
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
foreach (const ProjectPartHeaderPath &headerPath, headerPaths) {
if (!headerPath.path.contains(QLatin1String("/Qt"))) // "QtCore", "QtGui" etc...
continue;
......@@ -1795,9 +1795,9 @@ QString findQtIncludeWithSameName(const QString &className,
return result;
}
ProjectPart::HeaderPaths relevantHeaderPaths(const QString &filePath)
ProjectPartHeaderPaths relevantHeaderPaths(const QString &filePath)
{
ProjectPart::HeaderPaths headerPaths;
ProjectPartHeaderPaths headerPaths;
CppModelManager *modelManager = CppModelManager::instance();
const QList<ProjectPart::Ptr> projectParts = modelManager->projectPart(filePath);
......@@ -1924,7 +1924,7 @@ void AddIncludeForUndefinedIdentifier::match(const CppQuickFixInterface &interfa
return;
const QString currentDocumentFilePath = interface.semanticInfo().doc->fileName();
const ProjectPart::HeaderPaths headerPaths = relevantHeaderPaths(currentDocumentFilePath);
const ProjectPartHeaderPaths headerPaths = relevantHeaderPaths(currentDocumentFilePath);
bool qtHeaderFileIncludeOffered = false;
// Find an include file through the locator
......
......@@ -76,7 +76,7 @@ void BuiltinEditorDocumentParser::updateHelper(const WorkingCopy &theWorkingCopy
CppModelManager *modelManager = CppModelManager::instance();
QByteArray configFile = modelManager->codeModelConfiguration();
ProjectPart::HeaderPaths headerPaths;
ProjectPartHeaderPaths headerPaths;
QStringList precompiledHeaders;
QString projectConfigFile;
LanguageFeatures features = LanguageFeatures::defaultFeatures();
......@@ -238,7 +238,7 @@ Snapshot BuiltinEditorDocumentParser::snapshot() const
return extraState().snapshot;
}
ProjectPart::HeaderPaths BuiltinEditorDocumentParser::headerPaths() const
ProjectPartHeaderPaths BuiltinEditorDocumentParser::headerPaths() const
{
return extraState().headerPaths;
}
......
......@@ -52,7 +52,7 @@ public:
CPlusPlus::Document::Ptr document() const;
CPlusPlus::Snapshot snapshot() const;
ProjectPart::HeaderPaths headerPaths() const;
ProjectPartHeaderPaths headerPaths() const;
void releaseResources();
......@@ -72,7 +72,7 @@ private:
struct ExtraState {
QByteArray configFile;
ProjectPart::HeaderPaths headerPaths;
ProjectPartHeaderPaths headerPaths;
QString projectConfigFile;
QStringList precompiledHeaders;
......
......@@ -61,7 +61,7 @@ namespace {
class ParseParams
{
public:
ProjectPart::HeaderPaths headerPaths;
ProjectPartHeaderPaths headerPaths;
WorkingCopy workingCopy;
QSet<QString> sourceFiles;
};
......@@ -203,7 +203,7 @@ void index(QFutureInterface<void> &future, const ParseParams params)
bool processingHeaders = false;
CppModelManager *cmm = CppModelManager::instance();
const ProjectPart::HeaderPaths fallbackHeaderPaths = cmm->headerPaths();
const ProjectPartHeaderPaths fallbackHeaderPaths = cmm->headerPaths();
const CPlusPlus::LanguageFeatures defaultFeatures =
CPlusPlus::LanguageFeatures::defaultFeatures();
for (int i = 0; i < files.size(); ++i) {
......@@ -229,7 +229,7 @@ void index(QFutureInterface<void> &future, const ParseParams params)
processingHeaders = true;
}
ProjectPart::HeaderPaths headerPaths = parts.isEmpty()
ProjectPartHeaderPaths headerPaths = parts.isEmpty()
? fallbackHeaderPaths
: parts.first()->headerPaths;
sourceProcessor->setHeaderPaths(headerPaths);
......
......@@ -143,7 +143,7 @@ QString Utils::toString(ProjectPart::QtVersion qtVersion)
return QString();
}
QString Utils::toString(const QList<ProjectFile> &projectFiles)
QString Utils::toString(const QVector<ProjectFile> &projectFiles)
{
QStringList filesList;
foreach (const ProjectFile &projectFile, projectFiles)
......@@ -411,10 +411,10 @@ QString Utils::pathListToString(const QStringList &pathList)
return result.join(QLatin1Char('\n'));
}
QString Utils::pathListToString(const ProjectPart::HeaderPaths &pathList)
QString Utils::pathListToString(const ProjectPartHeaderPaths &pathList)
{
QStringList result;
foreach (const ProjectPart::HeaderPath &path, pathList) {
foreach (const ProjectPartHeaderPath &path, pathList) {
result << QString(QLatin1String("%1 (%2 path)")).arg(
QDir::toNativeSeparators(path.path),
path.isFrameworkPath() ? QLatin1String("framework") : QLatin1String("include")
......@@ -523,9 +523,9 @@ void Dumper::dumpProjectInfos( const QList<ProjectInfo> &projectInfos)
if (!part->headerPaths.isEmpty()) {
m_out << i3 << "Header Paths:{{{4\n";
foreach (const ProjectPart::HeaderPath &headerPath, part->headerPaths)
foreach (const ProjectPartHeaderPath &headerPath, part->headerPaths)
m_out << i4 << headerPath.path
<< (headerPath.type == ProjectPart::HeaderPath::IncludePath
<< (headerPath.type == ProjectPartHeaderPath::IncludePath
? "(include path)"
: "(framework path)")
<< "\n";
......@@ -590,7 +590,7 @@ void Dumper::dumpWorkingCopy(const WorkingCopy &workingCopy)
}
}
void Dumper::dumpMergedEntities(const ProjectPart::HeaderPaths &mergedHeaderPaths,
void Dumper::dumpMergedEntities(const ProjectPartHeaderPaths &mergedHeaderPaths,
const QByteArray &mergedMacros)
{
m_out << "Merged Entities{{{1\n";
......@@ -598,7 +598,7 @@ void Dumper::dumpMergedEntities(const ProjectPart::HeaderPaths &mergedHeaderPath
const QByteArray i3 = indent(3);
m_out << i2 << "Merged Header Paths{{{2\n";
foreach (const ProjectPart::HeaderPath &hp, mergedHeaderPaths)
foreach (const ProjectPartHeaderPath &hp, mergedHeaderPaths)
m_out << i3 << hp.path
<< (hp.isFrameworkPath() ? " (framework path)" : " (include path)")
<< "\n";
......
......@@ -54,13 +54,13 @@ struct CPPTOOLS_EXPORT Utils
static QString toString(CppTools::ProjectPart::LanguageVersion languageVersion);
static QString toString(CppTools::ProjectPart::LanguageExtensions languageExtension);
static QString toString(CppTools::ProjectPart::QtVersion qtVersion);
static QString toString(const QList<CppTools::ProjectFile> &projectFiles);
static QString toString(const QVector<CppTools::ProjectFile> &projectFiles);
static QString toString(CppTools::ProjectFile::Kind kind);
static QString toString(CPlusPlus::Kind kind);
static QString partsForFile(const QString &fileName);
static QString unresolvedFileNameWithDelimiters(const CPlusPlus::Document::Include &include);
static QString pathListToString(const QStringList &pathList);
static QString pathListToString(const ProjectPart::HeaderPaths &pathList);
static QString pathListToString(const ProjectPartHeaderPaths &pathList);
static QList<CPlusPlus::Document::Ptr> snapshotToList(const CPlusPlus::Snapshot &snapshot);
};
......@@ -76,7 +76,7 @@ public:
const QString &title,
bool isGlobalSnapshot = false);
void dumpWorkingCopy(const CppTools::WorkingCopy &workingCopy);
void dumpMergedEntities(const ProjectPart::HeaderPaths &mergedHeaderPaths,
void dumpMergedEntities(const ProjectPartHeaderPaths &mergedHeaderPaths,
const QByteArray &mergedMacros);
private:
......
......@@ -113,7 +113,7 @@ public:
= new CppCompletionAssistInterface(m_editorWidget->textDocument()->filePath().toString(),
m_textDocument, m_position,
ExplicitlyInvoked, m_snapshot,
ProjectPart::HeaderPaths(),
ProjectPartHeaderPaths(),
languageFeatures);
InternalCppCompletionAssistProcessor processor;
......
......@@ -1339,16 +1339,16 @@ bool InternalCppCompletionAssistProcessor::completeInclude(const QTextCursor &cu
}
// Make completion for all relevant includes
ProjectPart::HeaderPaths headerPaths = m_interface->headerPaths();
const ProjectPart::HeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
ProjectPart::HeaderPath::IncludePath);
ProjectPartHeaderPaths headerPaths = m_interface->headerPaths();
const ProjectPartHeaderPath currentFilePath(QFileInfo(m_interface->fileName()).path(),
ProjectPartHeaderPath::IncludePath);
if (!headerPaths.contains(currentFilePath))
headerPaths.append(currentFilePath);
Utils::MimeDatabase mdb;
const QStringList suffixes = mdb.mimeTypeForName(QLatin1String("text/x-c++hdr")).suffixes();
foreach (const ProjectPart::HeaderPath &headerPath, headerPaths) {
foreach (const ProjectPartHeaderPath &headerPath, headerPaths) {
QString realPath = headerPath.path;
if (!directoryPrefix.isEmpty()) {
realPath += QLatin1Char('/');
......
......@@ -189,7 +189,7 @@ public:
int position,
TextEditor::AssistReason reason,
const CPlusPlus::Snapshot &snapshot,
const ProjectPart::HeaderPaths &headerPaths,
const ProjectPartHeaderPaths &headerPaths,
const CPlusPlus::LanguageFeatures &features)
: TextEditor::AssistInterface(textDocument, position, filePath, reason)
, m_gotCppSpecifics(true)
......@@ -199,7 +199,7 @@ public:
{}
const CPlusPlus::Snapshot &snapshot() const { getCppSpecifics(); return m_snapshot; }
const ProjectPart::HeaderPaths &headerPaths() const
const ProjectPartHeaderPaths &headerPaths() const
{ getCppSpecifics(); return m_headerPaths; }
CPlusPlus::LanguageFeatures languageFeatures() const
{ getCppSpecifics(); return m_languageFeatures; }
......@@ -211,7 +211,7 @@ private:
mutable bool m_gotCppSpecifics;
WorkingCopy m_workingCopy;
mutable CPlusPlus::Snapshot m_snapshot;
mutable ProjectPart::HeaderPaths m_headerPaths;
mutable ProjectPartHeaderPaths m_headerPaths;
mutable CPlusPlus::LanguageFeatures m_languageFeatures;
};
......
......@@ -142,7 +142,7 @@ public:
// 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;
ProjectPartHeaderPaths m_headerPaths;
QByteArray m_definedMacros;
// Editor integration
......@@ -412,16 +412,16 @@ QStringList CppModelManager::internalProjectFiles() const
return files;
}
ProjectPart::HeaderPaths CppModelManager::internalHeaderPaths() const
ProjectPartHeaderPaths CppModelManager::internalHeaderPaths() const
{
ProjectPart::HeaderPaths headerPaths;
ProjectPartHeaderPaths headerPaths;
QMapIterator<ProjectExplorer::Project *, ProjectInfo> it(d->m_projectToProjectsInfo);
while (it.hasNext()) {
it.next();
const ProjectInfo pinfo = it.value();
foreach (const ProjectPart::Ptr &part, pinfo.projectParts()) {
foreach (const ProjectPart::HeaderPath &path, part->headerPaths) {
const ProjectPart::HeaderPath hp(QDir::cleanPath(path.path), path.type);
foreach (const ProjectPartHeaderPath &path, part->headerPaths) {
const ProjectPartHeaderPath hp(QDir::cleanPath(path.path), path.type);
if (!headerPaths.contains(hp))
headerPaths += hp;
}
......@@ -1168,7 +1168,7 @@ QStringList CppModelManager::projectFiles()
return d->m_projectFiles;
}
ProjectPart::HeaderPaths CppModelManager::headerPaths()
ProjectPartHeaderPaths CppModelManager::headerPaths()
{
QMutexLocker locker(&d->m_projectMutex);
ensureUpdated();
......@@ -1176,7 +1176,7 @@ ProjectPart::HeaderPaths CppModelManager::headerPaths()
return d->m_headerPaths;
}
void CppModelManager::setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths)
void CppModelManager::setHeaderPaths(const ProjectPartHeaderPaths &headerPaths)
{
QMutexLocker locker(&d->m_projectMutex);
d->m_headerPaths = headerPaths;
......
......@@ -154,10 +154,10 @@ public:
QStringList projectFiles();
ProjectPart::HeaderPaths headerPaths();
ProjectPartHeaderPaths headerPaths();
// Use this *only* for auto tests
void setHeaderPaths(const ProjectPart::HeaderPaths &headerPaths);
void setHeaderPaths(const ProjectPartHeaderPaths &headerPaths);
QByteArray definedMacros();
......@@ -217,7 +217,7 @@ private:
void ensureUpdated();
QStringList internalProjectFiles() const;
ProjectPart::HeaderPaths internalHeaderPaths() const;
ProjectPartHeaderPaths internalHeaderPaths() const;
QByteArray internalDefinedMacros() const;
void dumpModelManagerConfiguration(const QString &logFileId);
......
......@@ -61,7 +61,7 @@ using namespace ProjectExplorer;
typedef CPlusPlus::Document Document;
Q_DECLARE_METATYPE(QList<ProjectFile>)
Q_DECLARE_METATYPE(QVector<ProjectFile>)
namespace {
......@@ -189,21 +189,20 @@ void CppToolsPlugin::test_modelmanager_paths_are_clean()
Project *project = helper.createProject(_("test_modelmanager_paths_are_clean"));
ProjectInfo pi = ProjectInfo(project);
typedef ProjectPart::HeaderPath HeaderPath;
typedef ProjectPartHeaderPath HeaderPath;
ProjectPart::Ptr part(new ProjectPart);
part->languageVersion = ProjectPart::CXX14;
part->qtVersion = ProjectPart::Qt5;
part->projectDefines = QByteArray("#define OH_BEHAVE -1\n");
part->headerPaths = QList<HeaderPath>()
<< HeaderPath(testDataDir.includeDir(false), HeaderPath::IncludePath)
<< HeaderPath(testDataDir.frameworksDir(