本文整理汇总了C++中FileName::isChildOf方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::isChildOf方法的具体用法?C++ FileName::isChildOf怎么用?C++ FileName::isChildOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::isChildOf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateExternalFileWarning
void ProjectTree::updateExternalFileWarning()
{
Core::IDocument *document = qobject_cast<Core::IDocument *>(sender());
if (!document || document->filePath().isEmpty())
return;
Core::InfoBar *infoBar = document->infoBar();
Core::Id externalFileId(EXTERNAL_FILE_WARNING);
if (!document->isModified()) {
infoBar->removeInfo(externalFileId);
return;
}
if (!infoBar->canInfoBeAdded(externalFileId))
return;
const FileName fileName = document->filePath();
const QList<Project *> projects = SessionManager::projects();
if (projects.isEmpty())
return;
foreach (Project *project, projects) {
FileName projectDir = project->projectDirectory();
if (projectDir.isEmpty())
continue;
if (fileName.isChildOf(projectDir))
return;
// External file. Test if it under the same VCS
QString topLevel;
if (Core::VcsManager::findVersionControlForDirectory(projectDir.toString(), &topLevel)
&& fileName.isChildOf(FileName::fromString(topLevel))) {
return;
}
}
示例2: generateProjectTree
void ServerModeReader::generateProjectTree(CMakeListsNode *root,
const QList<const FileNode *> &allFiles)
{
// Split up cmake inputs into useful chunks:
QList<FileNode *> cmakeFilesSource;
QList<FileNode *> cmakeFilesBuild;
QList<FileNode *> cmakeFilesOther;
QList<FileNode *> cmakeLists;
foreach (FileNode *fn, m_cmakeInputsFileNodes) {
const FileName path = fn->filePath();
if (path.fileName().compare("CMakeLists.txt", HostOsInfo::fileNameCaseSensitivity()) == 0)
cmakeLists.append(fn);
else if (path.isChildOf(m_parameters.sourceDirectory))
cmakeFilesSource.append(fn);
else if (path.isChildOf(m_parameters.buildDirectory))
cmakeFilesBuild.append(fn);
else
cmakeFilesOther.append(fn);
}
m_cmakeInputsFileNodes.clear(); // Clean out, they are not going to be used anymore!
if (!m_projects.isEmpty())
root->setDisplayName(m_projects.at(0)->name);
QSet<Node *> usedNodes;
usedNodes.insert(updateCMakeInputs(root, m_parameters.sourceDirectory, m_parameters.buildDirectory,
cmakeFilesSource, cmakeFilesBuild, cmakeFilesOther));
usedNodes.unite(updateCMakeLists(root, cmakeLists));
usedNodes.unite(updateProjects(root, m_projects, allFiles));
// Trim out unused nodes:
root->trim(usedNodes);
}
示例3: generateProjectTree
void ServerModeReader::generateProjectTree(CMakeProjectNode *root,
const QList<const FileNode *> &allFiles)
{
// Split up cmake inputs into useful chunks:
std::vector<std::unique_ptr<FileNode>> cmakeFilesSource;
std::vector<std::unique_ptr<FileNode>> cmakeFilesBuild;
std::vector<std::unique_ptr<FileNode>> cmakeFilesOther;
std::vector<std::unique_ptr<FileNode>> cmakeLists;
for (std::unique_ptr<FileNode> &fn : m_cmakeInputsFileNodes) {
const FileName path = fn->filePath();
if (path.fileName().compare("CMakeLists.txt", HostOsInfo::fileNameCaseSensitivity()) == 0)
cmakeLists.emplace_back(std::move(fn));
else if (path.isChildOf(m_parameters.workDirectory))
cmakeFilesBuild.emplace_back(std::move(fn));
else if (path.isChildOf(m_parameters.sourceDirectory))
cmakeFilesSource.emplace_back(std::move(fn));
else
cmakeFilesOther.emplace_back(std::move(fn));
}
m_cmakeInputsFileNodes.clear(); // Clean out, they are not going to be used anymore!
const Project *topLevel = Utils::findOrDefault(m_projects, [this](const Project *p) {
return m_parameters.sourceDirectory == p->sourceDirectory;
});
if (topLevel)
root->setDisplayName(topLevel->name);
QHash<Utils::FileName, ProjectNode *> cmakeListsNodes
= addCMakeLists(root, std::move(cmakeLists));
QList<FileNode *> knownHeaders;
addProjects(cmakeListsNodes, m_projects, knownHeaders);
addHeaderNodes(root, knownHeaders, allFiles);
if (cmakeFilesSource.size() > 0 || cmakeFilesBuild.size() > 0 || cmakeFilesOther.size() > 0)
addCMakeInputs(root, m_parameters.sourceDirectory, m_parameters.workDirectory,
std::move(cmakeFilesSource), std::move(cmakeFilesBuild),
std::move(cmakeFilesOther));
}
示例4: extractSpecFromArguments
FileName QmakeBuildConfiguration::extractSpecFromArguments(QString *args,
const QString &directory, const BaseQtVersion *version,
QStringList *outArgs)
{
FileName parsedSpec;
bool ignoreNext = false;
bool nextIsSpec = false;
for (QtcProcess::ArgIterator ait(args); ait.next(); ) {
if (ignoreNext) {
ignoreNext = false;
ait.deleteArg();
} else if (nextIsSpec) {
nextIsSpec = false;
parsedSpec = FileName::fromUserInput(ait.value());
ait.deleteArg();
} else if (ait.value() == QLatin1String("-spec") || ait.value() == QLatin1String("-platform")) {
nextIsSpec = true;
ait.deleteArg();
} else if (ait.value() == QLatin1String("-cache")) {
// We ignore -cache, because qmake contained a bug that it didn't
// mention the -cache in the Makefile.
// That means changing the -cache option in the additional arguments
// does not automatically rerun qmake. Alas, we could try more
// intelligent matching for -cache, but i guess people rarely
// do use that.
ignoreNext = true;
ait.deleteArg();
} else if (outArgs && ait.isSimple()) {
outArgs->append(ait.value());
}
}
if (parsedSpec.isEmpty())
return FileName();
FileName baseMkspecDir = FileName::fromUserInput(
version->qmakeProperty("QT_HOST_DATA") + QLatin1String("/mkspecs"));
baseMkspecDir = Utils::FileName::fromString(baseMkspecDir.toFileInfo().canonicalFilePath());
// if the path is relative it can be
// relative to the working directory (as found in the Makefiles)
// or relatively to the mkspec directory
// if it is the former we need to get the canonical form
// for the other one we don't need to do anything
if (parsedSpec.toFileInfo().isRelative()) {
if (QFileInfo::exists(directory + QLatin1Char('/') + parsedSpec.toString()))
parsedSpec = FileName::fromUserInput(directory + QLatin1Char('/') + parsedSpec.toString());
else
parsedSpec = FileName::fromUserInput(baseMkspecDir.toString() + QLatin1Char('/') + parsedSpec.toString());
}
QFileInfo f2 = parsedSpec.toFileInfo();
while (f2.isSymLink()) {
parsedSpec = FileName::fromString(f2.symLinkTarget());
f2.setFile(parsedSpec.toString());
}
if (parsedSpec.isChildOf(baseMkspecDir)) {
parsedSpec = parsedSpec.relativeChildPath(baseMkspecDir);
} else {
FileName sourceMkSpecPath = FileName::fromString(version->sourcePath().toString()
+ QLatin1String("/mkspecs"));
if (parsedSpec.isChildOf(sourceMkSpecPath))
parsedSpec = parsedSpec.relativeChildPath(sourceMkSpecPath);
}
return parsedSpec;
}