forked from qt-creator/qt-creator
Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be best-of-breed within Qt. Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -44,7 +44,7 @@ public:
|
||||
QString severityText;
|
||||
QString checkId;
|
||||
QString message;
|
||||
Utils::FileName fileName;
|
||||
Utils::FilePath fileName;
|
||||
int lineNumber = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -75,15 +75,15 @@ void CppcheckRunner::reconfigure(const QString &binary, const QString &arguments
|
||||
m_arguments = arguments;
|
||||
}
|
||||
|
||||
void CppcheckRunner::addToQueue(const Utils::FileNameList &files,
|
||||
void CppcheckRunner::addToQueue(const Utils::FilePathList &files,
|
||||
const QString &additionalArguments)
|
||||
{
|
||||
Utils::FileNameList &existing = m_queue[additionalArguments];
|
||||
Utils::FilePathList &existing = m_queue[additionalArguments];
|
||||
if (existing.isEmpty()) {
|
||||
existing = files;
|
||||
} else {
|
||||
std::copy_if(files.cbegin(), files.cend(), std::back_inserter(existing),
|
||||
[&existing](const Utils::FileName &file) { return !existing.contains(file); });
|
||||
[&existing](const Utils::FilePath &file) { return !existing.contains(file); });
|
||||
}
|
||||
|
||||
if (m_isRunning) {
|
||||
@@ -94,7 +94,7 @@ void CppcheckRunner::addToQueue(const Utils::FileNameList &files,
|
||||
m_queueTimer.start();
|
||||
}
|
||||
|
||||
void CppcheckRunner::stop(const Utils::FileNameList &files)
|
||||
void CppcheckRunner::stop(const Utils::FilePathList &files)
|
||||
{
|
||||
if (!m_isRunning)
|
||||
return;
|
||||
@@ -103,7 +103,7 @@ void CppcheckRunner::stop(const Utils::FileNameList &files)
|
||||
m_process->kill();
|
||||
}
|
||||
|
||||
void CppcheckRunner::removeFromQueue(const Utils::FileNameList &files)
|
||||
void CppcheckRunner::removeFromQueue(const Utils::FilePathList &files)
|
||||
{
|
||||
if (m_queue.isEmpty())
|
||||
return;
|
||||
@@ -112,14 +112,14 @@ void CppcheckRunner::removeFromQueue(const Utils::FileNameList &files)
|
||||
m_queue.clear();
|
||||
} else {
|
||||
for (auto it = m_queue.begin(), end = m_queue.end(); it != end;) {
|
||||
for (const Utils::FileName &file : files)
|
||||
for (const Utils::FilePath &file : files)
|
||||
it.value().removeOne(file);
|
||||
it = !it.value().isEmpty() ? ++it : m_queue.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Utils::FileNameList &CppcheckRunner::currentFiles() const
|
||||
const Utils::FilePathList &CppcheckRunner::currentFiles() const
|
||||
{
|
||||
return m_currentFiles;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ void CppcheckRunner::checkQueued()
|
||||
if (m_queue.isEmpty() || m_binary.isEmpty())
|
||||
return;
|
||||
|
||||
Utils::FileNameList files = m_queue.begin().value();
|
||||
Utils::FilePathList files = m_queue.begin().value();
|
||||
QString arguments = m_arguments + ' ' + m_queue.begin().key();
|
||||
m_currentFiles.clear();
|
||||
int argumentsLength = arguments.length();
|
||||
|
||||
@@ -30,8 +30,8 @@
|
||||
|
||||
namespace Utils {
|
||||
class QtcProcess;
|
||||
class FileName;
|
||||
using FileNameList = QList<FileName>;
|
||||
class FilePath;
|
||||
using FilePathList = QList<FilePath>;
|
||||
}
|
||||
|
||||
namespace Cppcheck {
|
||||
@@ -48,12 +48,12 @@ public:
|
||||
~CppcheckRunner() override;
|
||||
|
||||
void reconfigure(const QString &binary, const QString &arguments);
|
||||
void addToQueue(const Utils::FileNameList &files,
|
||||
void addToQueue(const Utils::FilePathList &files,
|
||||
const QString &additionalArguments = {});
|
||||
void removeFromQueue(const Utils::FileNameList &files);
|
||||
void stop(const Utils::FileNameList &files = {});
|
||||
void removeFromQueue(const Utils::FilePathList &files);
|
||||
void stop(const Utils::FilePathList &files = {});
|
||||
|
||||
const Utils::FileNameList ¤tFiles() const;
|
||||
const Utils::FilePathList ¤tFiles() const;
|
||||
QString currentCommand() const;
|
||||
|
||||
private:
|
||||
@@ -67,8 +67,8 @@ private:
|
||||
Utils::QtcProcess *m_process = nullptr;
|
||||
QString m_binary;
|
||||
QString m_arguments;
|
||||
QHash<QString, Utils::FileNameList> m_queue;
|
||||
Utils::FileNameList m_currentFiles;
|
||||
QHash<QString, Utils::FilePathList> m_queue;
|
||||
Utils::FilePathList m_currentFiles;
|
||||
QTimer m_queueTimer;
|
||||
int m_maxArgumentsLength = 32767;
|
||||
bool m_isRunning = false;
|
||||
|
||||
@@ -45,13 +45,13 @@ void CppcheckTextMarkManager::add(const Diagnostic &diagnostic)
|
||||
fileMarks.push_back(std::make_unique<CppcheckTextMark>(diagnostic));
|
||||
}
|
||||
|
||||
void CppcheckTextMarkManager::clearFiles(const Utils::FileNameList &files)
|
||||
void CppcheckTextMarkManager::clearFiles(const Utils::FilePathList &files)
|
||||
{
|
||||
if (m_marks.empty())
|
||||
return;
|
||||
|
||||
if (!files.empty()) {
|
||||
for (const Utils::FileName &file : files)
|
||||
for (const Utils::FilePath &file : files)
|
||||
m_marks.erase(file);
|
||||
} else {
|
||||
m_marks.clear();
|
||||
|
||||
@@ -42,11 +42,11 @@ public:
|
||||
~CppcheckTextMarkManager();
|
||||
|
||||
void add(const Diagnostic &diagnostic);
|
||||
void clearFiles(const Utils::FileNameList &files);
|
||||
void clearFiles(const Utils::FilePathList &files);
|
||||
|
||||
private:
|
||||
using MarkPtr = std::unique_ptr<CppcheckTextMark>;
|
||||
std::unordered_map<Utils::FileName, std::vector<MarkPtr>> m_marks;
|
||||
std::unordered_map<Utils::FilePath, std::vector<MarkPtr>> m_marks;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -181,16 +181,16 @@ const CppcheckOptions &CppcheckTool::options() const
|
||||
return m_options;
|
||||
}
|
||||
|
||||
void CppcheckTool::check(const Utils::FileNameList &files)
|
||||
void CppcheckTool::check(const Utils::FilePathList &files)
|
||||
{
|
||||
QTC_ASSERT(m_project, return);
|
||||
|
||||
Utils::FileNameList filtered;
|
||||
Utils::FilePathList filtered;
|
||||
if (m_filters.isEmpty()) {
|
||||
filtered = files;
|
||||
} else {
|
||||
std::copy_if(files.cbegin(), files.cend(), std::back_inserter(filtered),
|
||||
[this](const Utils::FileName &file) {
|
||||
[this](const Utils::FilePath &file) {
|
||||
const QString stringed = file.toString();
|
||||
const auto filter = [stringed](const QRegExp &re) {return re.exactMatch(stringed);};
|
||||
return !Utils::contains(m_filters, filter);
|
||||
@@ -208,8 +208,8 @@ void CppcheckTool::check(const Utils::FileNameList &files)
|
||||
return;
|
||||
}
|
||||
|
||||
std::map<CppTools::ProjectPart::Ptr, Utils::FileNameList> groups;
|
||||
for (const Utils::FileName &file : qAsConst(filtered)) {
|
||||
std::map<CppTools::ProjectPart::Ptr, Utils::FilePathList> groups;
|
||||
for (const Utils::FilePath &file : qAsConst(filtered)) {
|
||||
const QString stringed = file.toString();
|
||||
for (const CppTools::ProjectPart::Ptr &part : parts) {
|
||||
using CppTools::ProjectFile;
|
||||
@@ -224,7 +224,7 @@ void CppcheckTool::check(const Utils::FileNameList &files)
|
||||
addToQueue(group.second, *group.first);
|
||||
}
|
||||
|
||||
void CppcheckTool::addToQueue(const Utils::FileNameList &files, CppTools::ProjectPart &part)
|
||||
void CppcheckTool::addToQueue(const Utils::FilePathList &files, CppTools::ProjectPart &part)
|
||||
{
|
||||
const QString key = part.id();
|
||||
if (!m_cachedAdditionalArguments.contains(key))
|
||||
@@ -232,7 +232,7 @@ void CppcheckTool::addToQueue(const Utils::FileNameList &files, CppTools::Projec
|
||||
m_runner->addToQueue(files, m_cachedAdditionalArguments[key]);
|
||||
}
|
||||
|
||||
void CppcheckTool::stop(const Utils::FileNameList &files)
|
||||
void CppcheckTool::stop(const Utils::FilePathList &files)
|
||||
{
|
||||
m_runner->removeFromQueue(files);
|
||||
m_runner->stop(files);
|
||||
@@ -299,7 +299,7 @@ void CppcheckTool::parseErrorLine(const QString &line)
|
||||
if (!match.hasMatch())
|
||||
return;
|
||||
|
||||
const Utils::FileName fileName = Utils::FileName::fromUserInput(match.captured(File));
|
||||
const Utils::FilePath fileName = Utils::FilePath::fromUserInput(match.captured(File));
|
||||
if (!m_runner->currentFiles().contains(fileName))
|
||||
return;
|
||||
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
#include <memory>
|
||||
|
||||
namespace Utils {
|
||||
class FileName;
|
||||
using FileNameList = QList<FileName>;
|
||||
class FilePath;
|
||||
using FilePathList = QList<FilePath>;
|
||||
}
|
||||
|
||||
namespace CppTools {
|
||||
@@ -64,8 +64,8 @@ public:
|
||||
|
||||
void updateOptions(const CppcheckOptions &options);
|
||||
void setProject(ProjectExplorer::Project *project);
|
||||
void check(const Utils::FileNameList &files);
|
||||
void stop(const Utils::FileNameList &files);
|
||||
void check(const Utils::FilePathList &files);
|
||||
void stop(const Utils::FilePathList &files);
|
||||
|
||||
void startParsing();
|
||||
void parseOutputLine(const QString &line);
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
|
||||
private:
|
||||
void updateArguments();
|
||||
void addToQueue(const Utils::FileNameList &files, CppTools::ProjectPart &part);
|
||||
void addToQueue(const Utils::FilePathList &files, CppTools::ProjectPart &part);
|
||||
QStringList additionalArguments(const CppTools::ProjectPart &part) const;
|
||||
|
||||
CppcheckTextMarkManager &m_marks;
|
||||
|
||||
@@ -83,12 +83,12 @@ void CppcheckTrigger::checkEditors(const QList<Core::IEditor *> &editors)
|
||||
const QList<Core::IEditor *> editorList = !editors.isEmpty()
|
||||
? editors : Core::DocumentModel::editorsForOpenedDocuments();
|
||||
|
||||
Utils::FileNameList toCheck;
|
||||
Utils::FilePathList toCheck;
|
||||
for (const Core::IEditor *editor : editorList) {
|
||||
QTC_ASSERT(editor, continue);
|
||||
Core::IDocument *document = editor->document();
|
||||
QTC_ASSERT(document, continue);
|
||||
const Utils::FileName &path = document->filePath();
|
||||
const Utils::FilePath &path = document->filePath();
|
||||
if (path.isEmpty())
|
||||
continue;
|
||||
|
||||
@@ -128,12 +128,12 @@ void CppcheckTrigger::removeEditors(const QList<Core::IEditor *> &editors)
|
||||
const QList<Core::IEditor *> editorList = !editors.isEmpty()
|
||||
? editors : Core::DocumentModel::editorsForOpenedDocuments();
|
||||
|
||||
Utils::FileNameList toRemove;
|
||||
Utils::FilePathList toRemove;
|
||||
for (const Core::IEditor *editor : editorList) {
|
||||
QTC_ASSERT(editor, return);
|
||||
const Core::IDocument *document = editor->document();
|
||||
QTC_ASSERT(document, return);
|
||||
const Utils::FileName &path = document->filePath();
|
||||
const Utils::FilePath &path = document->filePath();
|
||||
if (path.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -156,7 +156,7 @@ void CppcheckTrigger::checkChangedDocument(Core::IDocument *document)
|
||||
if (!m_currentProject)
|
||||
return;
|
||||
|
||||
const Utils::FileName &path = document->filePath();
|
||||
const Utils::FilePath &path = document->filePath();
|
||||
QTC_ASSERT(!path.isEmpty(), return);
|
||||
if (!m_checkedFiles.contains(path))
|
||||
return;
|
||||
@@ -185,12 +185,12 @@ void CppcheckTrigger::updateProjectFiles(ProjectExplorer::Project *project)
|
||||
checkEditors(Core::DocumentModel::editorsForOpenedDocuments());
|
||||
}
|
||||
|
||||
void CppcheckTrigger::check(const Utils::FileNameList &files)
|
||||
void CppcheckTrigger::check(const Utils::FilePathList &files)
|
||||
{
|
||||
m_tool.check(files);
|
||||
}
|
||||
|
||||
void CppcheckTrigger::remove(const Utils::FileNameList &files)
|
||||
void CppcheckTrigger::remove(const Utils::FilePathList &files)
|
||||
{
|
||||
m_marks.clearFiles(files);
|
||||
m_tool.stop(files);
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include <QPointer>
|
||||
|
||||
namespace Utils {
|
||||
class FileName;
|
||||
using FileNameList = QList<FileName>;
|
||||
class FilePath;
|
||||
using FilePathList = QList<FilePath>;
|
||||
}
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -68,13 +68,13 @@ private:
|
||||
void checkChangedDocument(Core::IDocument *document);
|
||||
void changeCurrentProject(ProjectExplorer::Project *project);
|
||||
void updateProjectFiles(ProjectExplorer::Project *project);
|
||||
void check(const Utils::FileNameList &files);
|
||||
void remove(const Utils::FileNameList &files);
|
||||
void check(const Utils::FilePathList &files);
|
||||
void remove(const Utils::FilePathList &files);
|
||||
|
||||
CppcheckTextMarkManager &m_marks;
|
||||
CppcheckTool &m_tool;
|
||||
QPointer<ProjectExplorer::Project> m_currentProject;
|
||||
QHash<Utils::FileName, QDateTime> m_checkedFiles;
|
||||
QHash<Utils::FilePath, QDateTime> m_checkedFiles;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
Reference in New Issue
Block a user