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:
@@ -62,7 +62,7 @@ QString AbstractEditorSupport::licenseTemplate(const QString &file, const QStrin
|
||||
const QString license = Internal::CppFileSettings::licenseTemplate();
|
||||
Utils::MacroExpander expander;
|
||||
expander.registerVariable("Cpp:License:FileName", tr("The file name."),
|
||||
[file]() { return Utils::FileName::fromString(file).fileName(); });
|
||||
[file]() { return Utils::FilePath::fromString(file).fileName(); });
|
||||
expander.registerVariable("Cpp:License:ClassName", tr("The class name."),
|
||||
[className]() { return className; });
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ ProjectPartInfo BaseEditorDocumentParser::determineProjectPart(
|
||||
return CppModelManager::instance()->projectPart(filePath);
|
||||
});
|
||||
chooser.setProjectPartsFromDependenciesForFile([&](const QString &filePath) {
|
||||
const auto fileName = Utils::FileName::fromString(filePath);
|
||||
const auto fileName = Utils::FilePath::fromString(filePath);
|
||||
return CppModelManager::instance()->projectPartFromDependencies(fileName);
|
||||
});
|
||||
|
||||
|
||||
@@ -145,9 +145,9 @@ void BuiltinEditorDocumentParser::updateImpl(const QFutureInterface<void> &futur
|
||||
state.snapshot = Snapshot();
|
||||
} else {
|
||||
// Remove changed files from the snapshot
|
||||
QSet<Utils::FileName> toRemove;
|
||||
QSet<Utils::FilePath> toRemove;
|
||||
foreach (const Document::Ptr &doc, state.snapshot) {
|
||||
const Utils::FileName fileName = Utils::FileName::fromString(doc->fileName());
|
||||
const Utils::FilePath fileName = Utils::FilePath::fromString(doc->fileName());
|
||||
if (workingCopy.contains(fileName)) {
|
||||
if (workingCopy.get(fileName).second != doc->editorRevision())
|
||||
addFileAndDependencies(&state.snapshot, &toRemove, fileName);
|
||||
@@ -160,7 +160,7 @@ void BuiltinEditorDocumentParser::updateImpl(const QFutureInterface<void> &futur
|
||||
|
||||
if (!toRemove.isEmpty()) {
|
||||
invalidateSnapshot = true;
|
||||
foreach (const Utils::FileName &fileName, toRemove)
|
||||
foreach (const Utils::FilePath &fileName, toRemove)
|
||||
state.snapshot.remove(fileName);
|
||||
}
|
||||
}
|
||||
@@ -261,15 +261,15 @@ BuiltinEditorDocumentParser::Ptr BuiltinEditorDocumentParser::get(const QString
|
||||
}
|
||||
|
||||
void BuiltinEditorDocumentParser::addFileAndDependencies(Snapshot *snapshot,
|
||||
QSet<Utils::FileName> *toRemove,
|
||||
const Utils::FileName &fileName) const
|
||||
QSet<Utils::FilePath> *toRemove,
|
||||
const Utils::FilePath &fileName) const
|
||||
{
|
||||
QTC_ASSERT(snapshot, return);
|
||||
|
||||
toRemove->insert(fileName);
|
||||
if (fileName != Utils::FileName::fromString(filePath())) {
|
||||
Utils::FileNameList deps = snapshot->filesDependingOn(fileName);
|
||||
toRemove->unite(QSet<Utils::FileName>::fromList(deps));
|
||||
if (fileName != Utils::FilePath::fromString(filePath())) {
|
||||
Utils::FilePathList deps = snapshot->filesDependingOn(fileName);
|
||||
toRemove->unite(QSet<Utils::FilePath>::fromList(deps));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ private:
|
||||
void updateImpl(const QFutureInterface<void> &future,
|
||||
const UpdateParams &updateParams) override;
|
||||
void addFileAndDependencies(CPlusPlus::Snapshot *snapshot,
|
||||
QSet<Utils::FileName> *toRemove,
|
||||
const Utils::FileName &fileName) const;
|
||||
QSet<Utils::FilePath> *toRemove,
|
||||
const Utils::FilePath &fileName) const;
|
||||
|
||||
struct ExtraState {
|
||||
QByteArray configFile;
|
||||
|
||||
@@ -70,7 +70,7 @@ static void buildTree(ProjectExplorer::Tree *parent,
|
||||
current->fullPath = parent->fullPath + current->name;
|
||||
parent->childDirectories.push_back(current);
|
||||
} else {
|
||||
current->fullPath = Utils::FileName::fromString(current->name);
|
||||
current->fullPath = Utils::FilePath::fromString(current->name);
|
||||
}
|
||||
current->parent = parent;
|
||||
for (const Constants::TidyNode &nodeChild : node.children)
|
||||
|
||||
@@ -613,10 +613,10 @@ void Dumper::dumpWorkingCopy(const WorkingCopy &workingCopy)
|
||||
m_out << "Working Copy contains " << workingCopy.size() << " entries{{{1\n";
|
||||
|
||||
const QByteArray i1 = indent(1);
|
||||
QHashIterator< ::Utils::FileName, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
|
||||
QHashIterator< ::Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
const ::Utils::FileName &filePath = it.key();
|
||||
const ::Utils::FilePath &filePath = it.key();
|
||||
unsigned sourcRevision = it.value().second;
|
||||
m_out << i1 << "rev=" << sourcRevision << ", " << filePath << "\n";
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ class CppInclude : public CppElement
|
||||
public:
|
||||
explicit CppInclude(const Document::Include &includeFile)
|
||||
: path(QDir::toNativeSeparators(includeFile.resolvedFileName()))
|
||||
, fileName(Utils::FileName::fromString(includeFile.resolvedFileName()).fileName())
|
||||
, fileName(Utils::FilePath::fromString(includeFile.resolvedFileName()).fileName())
|
||||
{
|
||||
helpCategory = Core::HelpItem::Brief;
|
||||
helpIdCandidates = QStringList(fileName);
|
||||
|
||||
@@ -56,7 +56,7 @@ using namespace CppTools::Internal;
|
||||
using namespace CppTools;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
static QByteArray getSource(const Utils::FileName &fileName,
|
||||
static QByteArray getSource(const Utils::FilePath &fileName,
|
||||
const WorkingCopy &workingCopy)
|
||||
{
|
||||
if (workingCopy.contains(fileName)) {
|
||||
@@ -178,7 +178,7 @@ class ProcessFile
|
||||
|
||||
public:
|
||||
// needed by QtConcurrent
|
||||
using argument_type = const Utils::FileName &;
|
||||
using argument_type = const Utils::FilePath &;
|
||||
using result_type = QList<CPlusPlus::Usage>;
|
||||
|
||||
ProcessFile(const WorkingCopy &workingCopy,
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
future(future)
|
||||
{ }
|
||||
|
||||
QList<CPlusPlus::Usage> operator()(const Utils::FileName &fileName)
|
||||
QList<CPlusPlus::Usage> operator()(const Utils::FilePath &fileName)
|
||||
{
|
||||
QList<CPlusPlus::Usage> usages;
|
||||
if (future->isPaused())
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
CPlusPlus::Document::Ptr doc;
|
||||
const QByteArray unpreprocessedSource = getSource(fileName, workingCopy);
|
||||
|
||||
if (symbolDocument && fileName == Utils::FileName::fromString(symbolDocument->fileName())) {
|
||||
if (symbolDocument && fileName == Utils::FilePath::fromString(symbolDocument->fileName())) {
|
||||
doc = symbolDocument;
|
||||
} else {
|
||||
doc = snapshot.preprocessedDocument(unpreprocessedSource, fileName);
|
||||
@@ -282,9 +282,9 @@ static void find_helper(QFutureInterface<CPlusPlus::Usage> &future,
|
||||
|
||||
const CPlusPlus::Snapshot snapshot = context.snapshot();
|
||||
|
||||
const Utils::FileName sourceFile = Utils::FileName::fromUtf8(symbol->fileName(),
|
||||
const Utils::FilePath sourceFile = Utils::FilePath::fromUtf8(symbol->fileName(),
|
||||
symbol->fileNameLength());
|
||||
Utils::FileNameList files{sourceFile};
|
||||
Utils::FilePathList files{sourceFile};
|
||||
|
||||
if (symbol->isClass()
|
||||
|| symbol->isForwardClassDeclaration()
|
||||
@@ -527,7 +527,7 @@ CPlusPlus::Symbol *CppFindReferences::findSymbol(const CppFindReferencesParamete
|
||||
|
||||
CPlusPlus::Document::Ptr newSymbolDocument = snapshot.document(symbolFile);
|
||||
// document is not parsed and has no bindings yet, do it
|
||||
QByteArray source = getSource(Utils::FileName::fromString(newSymbolDocument->fileName()),
|
||||
QByteArray source = getSource(Utils::FilePath::fromString(newSymbolDocument->fileName()),
|
||||
m_modelManager->workingCopy());
|
||||
CPlusPlus::Document::Ptr doc =
|
||||
snapshot.preprocessedDocument(source, newSymbolDocument->fileName());
|
||||
@@ -607,7 +607,7 @@ class FindMacroUsesInFile
|
||||
|
||||
public:
|
||||
// needed by QtConcurrent
|
||||
using argument_type = const Utils::FileName &;
|
||||
using argument_type = const Utils::FilePath &;
|
||||
using result_type = QList<CPlusPlus::Usage>;
|
||||
|
||||
FindMacroUsesInFile(const WorkingCopy &workingCopy,
|
||||
@@ -617,7 +617,7 @@ public:
|
||||
: workingCopy(workingCopy), snapshot(snapshot), macro(macro), future(future)
|
||||
{ }
|
||||
|
||||
QList<CPlusPlus::Usage> operator()(const Utils::FileName &fileName)
|
||||
QList<CPlusPlus::Usage> operator()(const Utils::FilePath &fileName)
|
||||
{
|
||||
QList<CPlusPlus::Usage> usages;
|
||||
CPlusPlus::Document::Ptr doc = snapshot.document(fileName);
|
||||
@@ -688,8 +688,8 @@ static void findMacroUses_helper(QFutureInterface<CPlusPlus::Usage> &future,
|
||||
const CPlusPlus::Snapshot snapshot,
|
||||
const CPlusPlus::Macro macro)
|
||||
{
|
||||
const Utils::FileName sourceFile = Utils::FileName::fromString(macro.fileName());
|
||||
Utils::FileNameList files{sourceFile};
|
||||
const Utils::FilePath sourceFile = Utils::FilePath::fromString(macro.fileName());
|
||||
Utils::FilePathList files{sourceFile};
|
||||
files = Utils::filteredUnique(files + snapshot.filesDependingOn(sourceFile));
|
||||
|
||||
future.setProgressRange(0, files.size());
|
||||
@@ -736,7 +736,7 @@ void CppFindReferences::findMacroUses(const CPlusPlus::Macro ¯o, const QStri
|
||||
|
||||
// add the macro definition itself
|
||||
{
|
||||
const QByteArray &source = getSource(Utils::FileName::fromString(macro.fileName()),
|
||||
const QByteArray &source = getSource(Utils::FilePath::fromString(macro.fileName()),
|
||||
workingCopy);
|
||||
unsigned column;
|
||||
const QString line = FindMacroUsesInFile::matchingLine(macro.bytesOffset(), source,
|
||||
|
||||
@@ -53,7 +53,7 @@ Core::LocatorFilterEntry CppFunctionsFilter::filterEntryFromIndexItem(IndexItem:
|
||||
if (extraInfo.isEmpty()) {
|
||||
extraInfo = info->shortNativeFilePath();
|
||||
} else {
|
||||
extraInfo.append(" (" + Utils::FileName::fromString(info->fileName()).fileName() + ')');
|
||||
extraInfo.append(" (" + Utils::FilePath::fromString(info->fileName()).fileName() + ')');
|
||||
}
|
||||
|
||||
Core::LocatorFilterEntry filterEntry(this, name + info->symbolType(), id, info->icon());
|
||||
|
||||
@@ -99,7 +99,7 @@ void CppToolsPlugin::initTestCase()
|
||||
|
||||
void CppToolsPlugin::cleanupTestCase()
|
||||
{
|
||||
Utils::FileUtils::removeRecursively(Utils::FileName::fromString(baseTestDir()));
|
||||
Utils::FileUtils::removeRecursively(Utils::FilePath::fromString(baseTestDir()));
|
||||
m_fileSettings->headerSearchPaths.removeLast();
|
||||
m_fileSettings->headerSearchPaths.removeLast();
|
||||
m_fileSettings->sourceSearchPaths.removeLast();
|
||||
|
||||
@@ -160,8 +160,8 @@ void CppIncludesFilter::prepareSearch(const QString &entry)
|
||||
m_needsUpdate = false;
|
||||
QSet<QString> seedPaths;
|
||||
for (Project *project : SessionManager::projects()) {
|
||||
const Utils::FileNameList allFiles = project->files(Project::AllFiles);
|
||||
for (const Utils::FileName &filePath : allFiles )
|
||||
const Utils::FilePathList allFiles = project->files(Project::AllFiles);
|
||||
for (const Utils::FilePath &filePath : allFiles )
|
||||
seedPaths.insert(filePath.toString());
|
||||
}
|
||||
const QList<DocumentModel::Entry *> entries = DocumentModel::entries();
|
||||
|
||||
@@ -166,8 +166,8 @@ void CppToolsPlugin::test_cpplocatorfilters_CppLocatorFilter_data()
|
||||
MyTestDataDir testDirectory("testdata_basic");
|
||||
const QString testFile = testDirectory.file("file1.cpp");
|
||||
const QString objTestFile = testDirectory.file("file1.mm");
|
||||
const QString testFileShort = FileName::fromString(testFile).shortNativePath();
|
||||
const QString objTestFileShort = FileName::fromString(objTestFile).shortNativePath();
|
||||
const QString testFileShort = FilePath::fromString(testFile).shortNativePath();
|
||||
const QString objTestFileShort = FilePath::fromString(objTestFile).shortNativePath();
|
||||
|
||||
QTest::newRow("CppFunctionsFilter")
|
||||
<< testFile
|
||||
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
mutable QMutex m_projectMutex;
|
||||
QMap<ProjectExplorer::Project *, ProjectInfo> m_projectToProjectsInfo;
|
||||
QHash<ProjectExplorer::Project *, bool> m_projectToIndexerCanceled;
|
||||
QMap<Utils::FileName, QList<ProjectPart::Ptr> > m_fileToProjectParts;
|
||||
QMap<Utils::FilePath, QList<ProjectPart::Ptr> > m_fileToProjectParts;
|
||||
QMap<QString, ProjectPart::Ptr> m_projectPartIdToProjectProjectPart;
|
||||
// The members below are cached/(re)calculated from the projects and/or their project parts
|
||||
bool m_dirty;
|
||||
@@ -968,7 +968,7 @@ void CppModelManager::recalculateProjectPartMappings()
|
||||
foreach (const ProjectPart::Ptr &projectPart, projectInfo.projectParts()) {
|
||||
d->m_projectPartIdToProjectProjectPart[projectPart->id()] = projectPart;
|
||||
foreach (const ProjectFile &cxxFile, projectPart->files)
|
||||
d->m_fileToProjectParts[Utils::FileName::fromString(cxxFile.path)].append(
|
||||
d->m_fileToProjectParts[Utils::FilePath::fromString(cxxFile.path)].append(
|
||||
projectPart);
|
||||
|
||||
}
|
||||
@@ -1132,20 +1132,20 @@ ProjectPart::Ptr CppModelManager::projectPartForId(const QString &projectPartId)
|
||||
return d->m_projectPartIdToProjectProjectPart.value(projectPartId);
|
||||
}
|
||||
|
||||
QList<ProjectPart::Ptr> CppModelManager::projectPart(const Utils::FileName &fileName) const
|
||||
QList<ProjectPart::Ptr> CppModelManager::projectPart(const Utils::FilePath &fileName) const
|
||||
{
|
||||
QMutexLocker locker(&d->m_projectMutex);
|
||||
return d->m_fileToProjectParts.value(fileName);
|
||||
}
|
||||
|
||||
QList<ProjectPart::Ptr> CppModelManager::projectPartFromDependencies(
|
||||
const Utils::FileName &fileName) const
|
||||
const Utils::FilePath &fileName) const
|
||||
{
|
||||
QSet<ProjectPart::Ptr> parts;
|
||||
const Utils::FileNameList deps = snapshot().filesDependingOn(fileName);
|
||||
const Utils::FilePathList deps = snapshot().filesDependingOn(fileName);
|
||||
|
||||
QMutexLocker locker(&d->m_projectMutex);
|
||||
foreach (const Utils::FileName &dep, deps) {
|
||||
foreach (const Utils::FilePath &dep, deps) {
|
||||
parts.unite(QSet<ProjectPart::Ptr>::fromList(d->m_fileToProjectParts.value(dep)));
|
||||
}
|
||||
|
||||
@@ -1338,7 +1338,7 @@ void CppModelManager::GC()
|
||||
filesInEditorSupports << abstractEditorSupport->fileName();
|
||||
|
||||
Snapshot currentSnapshot = snapshot();
|
||||
QSet<Utils::FileName> reachableFiles;
|
||||
QSet<Utils::FilePath> reachableFiles;
|
||||
// The configuration file is part of the project files, which is just fine.
|
||||
// If single files are open, without any project, then there is no need to
|
||||
// keep the configuration file around.
|
||||
@@ -1349,7 +1349,7 @@ void CppModelManager::GC()
|
||||
const QString file = todo.last();
|
||||
todo.removeLast();
|
||||
|
||||
const Utils::FileName fileName = Utils::FileName::fromString(file);
|
||||
const Utils::FilePath fileName = Utils::FilePath::fromString(file);
|
||||
if (reachableFiles.contains(fileName))
|
||||
continue;
|
||||
reachableFiles.insert(fileName);
|
||||
@@ -1362,7 +1362,7 @@ void CppModelManager::GC()
|
||||
QStringList notReachableFiles;
|
||||
Snapshot newSnapshot;
|
||||
for (Snapshot::const_iterator it = currentSnapshot.begin(); it != currentSnapshot.end(); ++it) {
|
||||
const Utils::FileName &fileName = it.key();
|
||||
const Utils::FilePath &fileName = it.key();
|
||||
|
||||
if (reachableFiles.contains(fileName))
|
||||
newSnapshot.insert(it.value());
|
||||
|
||||
@@ -121,12 +121,12 @@ public:
|
||||
/// \return The project part with the given project file
|
||||
ProjectPart::Ptr projectPartForId(const QString &projectPartId) const override;
|
||||
/// \return All project parts that mention the given file name as one of the sources/headers.
|
||||
QList<ProjectPart::Ptr> projectPart(const Utils::FileName &fileName) const;
|
||||
QList<ProjectPart::Ptr> projectPart(const Utils::FilePath &fileName) const;
|
||||
QList<ProjectPart::Ptr> projectPart(const QString &fileName) const
|
||||
{ return projectPart(Utils::FileName::fromString(fileName)); }
|
||||
{ return projectPart(Utils::FilePath::fromString(fileName)); }
|
||||
/// This is a fall-back function: find all files that includes the file directly or indirectly,
|
||||
/// and return its \c ProjectPart list for use with this file.
|
||||
QList<ProjectPart::Ptr> projectPartFromDependencies(const Utils::FileName &fileName) const;
|
||||
QList<ProjectPart::Ptr> projectPartFromDependencies(const Utils::FilePath &fileName) const;
|
||||
/// \return A synthetic \c ProjectPart which consists of all defines/includes/frameworks from
|
||||
/// all loaded projects.
|
||||
ProjectPart::Ptr fallbackProjectPart();
|
||||
|
||||
@@ -618,10 +618,10 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
|
||||
QCOMPARE(workingCopy.size(), 2); // mm->configurationFileName() and "ui_*.h"
|
||||
|
||||
QStringList fileNamesInWorkinCopy;
|
||||
QHashIterator<Utils::FileName, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
|
||||
QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > it = workingCopy.iterator();
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
fileNamesInWorkinCopy << Utils::FileName::fromString(it.key().toString()).fileName();
|
||||
fileNamesInWorkinCopy << Utils::FilePath::fromString(it.key().toString()).fileName();
|
||||
}
|
||||
fileNamesInWorkinCopy.sort();
|
||||
const QString expectedUiHeaderFileName = _("ui_mainwindow.h");
|
||||
@@ -639,8 +639,8 @@ void CppToolsPlugin::test_modelmanager_extraeditorsupport_uiFiles()
|
||||
QVERIFY(document);
|
||||
const QStringList includedFiles = document->includedFiles();
|
||||
QCOMPARE(includedFiles.size(), 2);
|
||||
QCOMPARE(Utils::FileName::fromString(includedFiles.at(0)).fileName(), _("mainwindow.h"));
|
||||
QCOMPARE(Utils::FileName::fromString(includedFiles.at(1)).fileName(), _("ui_mainwindow.h"));
|
||||
QCOMPARE(Utils::FilePath::fromString(includedFiles.at(0)).fileName(), _("mainwindow.h"));
|
||||
QCOMPARE(Utils::FilePath::fromString(includedFiles.at(1)).fileName(), _("ui_mainwindow.h"));
|
||||
}
|
||||
|
||||
/// QTCREATORBUG-9828: Locator shows symbols of closed files
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace Internal {
|
||||
|
||||
static QString fileName(const QString &path, const QString &extension)
|
||||
{
|
||||
return Utils::FileName::fromStringWithExtension(path, extension).toString();
|
||||
return Utils::FilePath::fromStringWithExtension(path, extension).toString();
|
||||
}
|
||||
|
||||
QString CppToolsJsExtension::headerGuard(const QString &in) const
|
||||
|
||||
@@ -130,9 +130,9 @@ void CppToolsPlugin::clearHeaderSourceCache()
|
||||
m_headerSourceMapping.clear();
|
||||
}
|
||||
|
||||
Utils::FileName CppToolsPlugin::licenseTemplatePath()
|
||||
Utils::FilePath CppToolsPlugin::licenseTemplatePath()
|
||||
{
|
||||
return Utils::FileName::fromString(m_instance->m_fileSettings->licenseTemplatePath);
|
||||
return Utils::FilePath::fromString(m_instance->m_fileSettings->licenseTemplatePath);
|
||||
}
|
||||
|
||||
QString CppToolsPlugin::licenseTemplate()
|
||||
@@ -256,7 +256,7 @@ static QStringList findFilesInProject(const QString &name,
|
||||
QString pattern = QString(1, QLatin1Char('/'));
|
||||
pattern += name;
|
||||
const QStringList projectFiles
|
||||
= Utils::transform(project->files(ProjectExplorer::Project::AllFiles), &Utils::FileName::toString);
|
||||
= Utils::transform(project->files(ProjectExplorer::Project::AllFiles), &Utils::FilePath::toString);
|
||||
const QStringList::const_iterator pcend = projectFiles.constEnd();
|
||||
QStringList candidateList;
|
||||
for (QStringList::const_iterator it = projectFiles.constBegin(); it != pcend; ++it) {
|
||||
|
||||
@@ -36,7 +36,7 @@ class QFileInfo;
|
||||
class QDir;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Utils { class FileName; }
|
||||
namespace Utils { class FilePath; }
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
static const QStringList &headerPrefixes();
|
||||
static const QStringList &sourcePrefixes();
|
||||
static void clearHeaderSourceCache();
|
||||
static Utils::FileName licenseTemplatePath();
|
||||
static Utils::FilePath licenseTemplatePath();
|
||||
static QString licenseTemplate();
|
||||
static bool usePragmaOnce();
|
||||
|
||||
|
||||
@@ -340,8 +340,8 @@ static bool copyRecursively(const QString &sourceDirPath,
|
||||
return file.setPermissions(file.permissions() | QFile::WriteUser);
|
||||
};
|
||||
|
||||
return Utils::FileUtils::copyRecursively(Utils::FileName::fromString(sourceDirPath),
|
||||
Utils::FileName::fromString(targetDirPath),
|
||||
return Utils::FileUtils::copyRecursively(Utils::FilePath::fromString(sourceDirPath),
|
||||
Utils::FilePath::fromString(targetDirPath),
|
||||
error,
|
||||
copyHelper);
|
||||
}
|
||||
|
||||
@@ -41,43 +41,43 @@ public:
|
||||
WorkingCopy();
|
||||
|
||||
void insert(const QString &fileName, const QByteArray &source, unsigned revision = 0)
|
||||
{ insert(Utils::FileName::fromString(fileName), source, revision); }
|
||||
{ insert(Utils::FilePath::fromString(fileName), source, revision); }
|
||||
|
||||
void insert(const Utils::FileName &fileName, const QByteArray &source, unsigned revision = 0)
|
||||
void insert(const Utils::FilePath &fileName, const QByteArray &source, unsigned revision = 0)
|
||||
{ _elements.insert(fileName, qMakePair(source, revision)); }
|
||||
|
||||
bool contains(const QString &fileName) const
|
||||
{ return contains(Utils::FileName::fromString(fileName)); }
|
||||
{ return contains(Utils::FilePath::fromString(fileName)); }
|
||||
|
||||
bool contains(const Utils::FileName &fileName) const
|
||||
bool contains(const Utils::FilePath &fileName) const
|
||||
{ return _elements.contains(fileName); }
|
||||
|
||||
QByteArray source(const QString &fileName) const
|
||||
{ return source(Utils::FileName::fromString(fileName)); }
|
||||
{ return source(Utils::FilePath::fromString(fileName)); }
|
||||
|
||||
QByteArray source(const Utils::FileName &fileName) const
|
||||
QByteArray source(const Utils::FilePath &fileName) const
|
||||
{ return _elements.value(fileName).first; }
|
||||
|
||||
unsigned revision(const QString &fileName) const
|
||||
{ return revision(Utils::FileName::fromString(fileName)); }
|
||||
{ return revision(Utils::FilePath::fromString(fileName)); }
|
||||
|
||||
unsigned revision(const Utils::FileName &fileName) const
|
||||
unsigned revision(const Utils::FilePath &fileName) const
|
||||
{ return _elements.value(fileName).second; }
|
||||
|
||||
QPair<QByteArray, unsigned> get(const QString &fileName) const
|
||||
{ return get(Utils::FileName::fromString(fileName)); }
|
||||
{ return get(Utils::FilePath::fromString(fileName)); }
|
||||
|
||||
QPair<QByteArray, unsigned> get(const Utils::FileName &fileName) const
|
||||
QPair<QByteArray, unsigned> get(const Utils::FilePath &fileName) const
|
||||
{ return _elements.value(fileName); }
|
||||
|
||||
QHashIterator<Utils::FileName, QPair<QByteArray, unsigned> > iterator() const
|
||||
{ return QHashIterator<Utils::FileName, QPair<QByteArray, unsigned> >(_elements); }
|
||||
QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> > iterator() const
|
||||
{ return QHashIterator<Utils::FilePath, QPair<QByteArray, unsigned> >(_elements); }
|
||||
|
||||
int size() const
|
||||
{ return _elements.size(); }
|
||||
|
||||
private:
|
||||
using Table = QHash<Utils::FileName, QPair<QByteArray, unsigned> >;
|
||||
using Table = QHash<Utils::FilePath, QPair<QByteArray, unsigned> >;
|
||||
Table _elements;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace CppTools {
|
||||
class CursorInEditor
|
||||
{
|
||||
public:
|
||||
CursorInEditor(const QTextCursor &cursor, const Utils::FileName &filePath,
|
||||
CursorInEditor(const QTextCursor &cursor, const Utils::FilePath &filePath,
|
||||
CppEditorWidgetInterface *editorWidget = nullptr)
|
||||
: m_cursor(cursor)
|
||||
, m_filePath(filePath)
|
||||
@@ -44,10 +44,10 @@ public:
|
||||
{}
|
||||
CppEditorWidgetInterface *editorWidget() const { return m_editorWidget; }
|
||||
const QTextCursor &cursor() const { return m_cursor; }
|
||||
const Utils::FileName &filePath() const { return m_filePath; }
|
||||
const Utils::FilePath &filePath() const { return m_filePath; }
|
||||
private:
|
||||
QTextCursor m_cursor;
|
||||
Utils::FileName m_filePath;
|
||||
Utils::FilePath m_filePath;
|
||||
CppEditorWidgetInterface *m_editorWidget = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ static int lineBeforeCursor(const QTextCursor &cursor)
|
||||
|
||||
QString DoxygenGenerator::generate(QTextCursor cursor,
|
||||
const CPlusPlus::Snapshot &snapshot,
|
||||
const Utils::FileName &documentFilePath)
|
||||
const Utils::FilePath &documentFilePath)
|
||||
{
|
||||
const QTextCursor initialCursor = cursor;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ QT_FORWARD_DECLARE_CLASS(QTextCursor)
|
||||
|
||||
namespace CPlusPlus { class DeclarationAST; }
|
||||
namespace CPlusPlus { class Snapshot; }
|
||||
namespace Utils { class FileName; }
|
||||
namespace Utils { class FilePath; }
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
|
||||
QString generate(QTextCursor cursor,
|
||||
const CPlusPlus::Snapshot &snapshot,
|
||||
const Utils::FileName &documentFilePath);
|
||||
const Utils::FilePath &documentFilePath);
|
||||
QString generate(QTextCursor cursor, CPlusPlus::DeclarationAST *decl);
|
||||
|
||||
private:
|
||||
|
||||
@@ -69,7 +69,7 @@ private:
|
||||
|
||||
GeneratedCodeModelSupport::GeneratedCodeModelSupport(CppModelManager *modelmanager,
|
||||
ProjectExplorer::ExtraCompiler *generator,
|
||||
const Utils::FileName &generatedFile) :
|
||||
const Utils::FilePath &generatedFile) :
|
||||
CppTools::AbstractEditorSupport(modelmanager, generator), m_generatedFileName(generatedFile),
|
||||
m_generator(generator)
|
||||
{
|
||||
@@ -90,7 +90,7 @@ GeneratedCodeModelSupport::~GeneratedCodeModelSupport()
|
||||
qCDebug(log) << "dtor ~generatedcodemodelsupport for" << m_generatedFileName;
|
||||
}
|
||||
|
||||
void GeneratedCodeModelSupport::onContentsChanged(const Utils::FileName &file)
|
||||
void GeneratedCodeModelSupport::onContentsChanged(const Utils::FilePath &file)
|
||||
{
|
||||
if (file == m_generatedFileName) {
|
||||
notifyAboutUpdatedContents();
|
||||
@@ -124,7 +124,7 @@ void GeneratedCodeModelSupport::update(const QList<ProjectExplorer::ExtraCompile
|
||||
continue;
|
||||
|
||||
extraCompilerCache.insert(generator);
|
||||
generator->forEachTarget([mm, generator](const Utils::FileName &generatedFile) {
|
||||
generator->forEachTarget([mm, generator](const Utils::FilePath &generatedFile) {
|
||||
new GeneratedCodeModelSupport(mm, generator, generatedFile);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class CPPTOOLS_EXPORT GeneratedCodeModelSupport : public AbstractEditorSupport
|
||||
public:
|
||||
GeneratedCodeModelSupport(CppModelManager *modelmanager,
|
||||
ProjectExplorer::ExtraCompiler *generator,
|
||||
const Utils::FileName &generatedFile);
|
||||
const Utils::FilePath &generatedFile);
|
||||
~GeneratedCodeModelSupport() override;
|
||||
|
||||
/// \returns the contents encoded in UTF-8.
|
||||
@@ -59,8 +59,8 @@ public:
|
||||
static void update(const QList<ProjectExplorer::ExtraCompiler *> &generators);
|
||||
|
||||
private:
|
||||
void onContentsChanged(const Utils::FileName &file);
|
||||
Utils::FileName m_generatedFileName;
|
||||
void onContentsChanged(const Utils::FilePath &file);
|
||||
Utils::FilePath m_generatedFileName;
|
||||
ProjectExplorer::ExtraCompiler *m_generator;
|
||||
};
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ void HeaderPathFilter::tweakHeaderPaths()
|
||||
void HeaderPathFilter::addPreIncludesPath()
|
||||
{
|
||||
if (projectDirectory.size()) {
|
||||
const Utils::FileName rootProjectDirectory = Utils::FileName::fromString(projectDirectory)
|
||||
const Utils::FilePath rootProjectDirectory = Utils::FilePath::fromString(projectDirectory)
|
||||
.pathAppended(".pre_includes");
|
||||
|
||||
systemHeaderPaths.push_back(
|
||||
|
||||
@@ -88,7 +88,7 @@ QString IndexItem::representDeclaration() const
|
||||
|
||||
QString IndexItem::shortNativeFilePath() const
|
||||
{
|
||||
return Utils::FileName::fromString(m_fileName).shortNativePath();
|
||||
return Utils::FilePath::fromString(m_fileName).shortNativePath();
|
||||
}
|
||||
|
||||
void IndexItem::squeeze()
|
||||
|
||||
@@ -37,7 +37,7 @@ using namespace CppTools::Internal;
|
||||
using namespace CppTools::Tests;
|
||||
|
||||
TestProject::TestProject(const QString &name, QObject *parent) :
|
||||
ProjectExplorer::Project("x-binary/foo", Utils::FileName()),
|
||||
ProjectExplorer::Project("x-binary/foo", Utils::FilePath()),
|
||||
m_name(name)
|
||||
{
|
||||
setParent(parent);
|
||||
|
||||
@@ -129,7 +129,7 @@ void SymbolsFindFilter::startSearch(SearchResult *search)
|
||||
QSet<QString> projectFileNames;
|
||||
if (parameters.scope == SymbolSearcher::SearchProjectsOnly) {
|
||||
for (ProjectExplorer::Project *project : ProjectExplorer::SessionManager::projects())
|
||||
projectFileNames += Utils::transform(project->files(ProjectExplorer::Project::AllFiles), &Utils::FileName::toString).toSet();
|
||||
projectFileNames += Utils::transform(project->files(ProjectExplorer::Project::AllFiles), &Utils::FilePath::toString).toSet();
|
||||
}
|
||||
|
||||
auto watcher = new QFutureWatcher<SearchResultItem>;
|
||||
|
||||
@@ -193,9 +193,9 @@ QStringList TypeHierarchyBuilder::filesDependingOn(CPlusPlus::Symbol *symbol) co
|
||||
if (!symbol)
|
||||
return deps;
|
||||
|
||||
Utils::FileName file = Utils::FileName::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
||||
Utils::FilePath file = Utils::FilePath::fromUtf8(symbol->fileName(), symbol->fileNameLength());
|
||||
deps << file.toString();
|
||||
foreach (const Utils::FileName &fileName, _snapshot.filesDependingOn(file))
|
||||
foreach (const Utils::FilePath &fileName, _snapshot.filesDependingOn(file))
|
||||
deps.append(fileName.toString());
|
||||
return deps;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user