本文整理汇总了C++中FileName::fileName方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::fileName方法的具体用法?C++ FileName::fileName怎么用?C++ FileName::fileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::fileName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: parseUnit
void CMakeCbpParser::parseUnit()
{
//qDebug()<<stream.attributes().value("filename");
FileName fileName =
FileName::fromUserInput(attributes().value(QLatin1String("filename")).toString());
CMakeTool *tool = CMakeKitInformation::cmakeTool(m_kit);
if (tool) {
QString mappedFile = tool->mapAllPaths(m_kit, fileName.toString());
fileName = FileName::fromUserInput(mappedFile);
}
m_parsingCmakeUnit = false;
m_unitTarget.clear();
while (!atEnd()) {
readNext();
if (isEndElement()) {
if (!fileName.endsWith(QLatin1String(".rule")) && !m_processedUnits.contains(fileName)) {
// Now check whether we found a virtual element beneath
if (m_parsingCmakeUnit) {
m_cmakeFileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ProjectFileType, false));
} else {
bool generated = false;
QString onlyFileName = fileName.fileName();
if ( (onlyFileName.startsWith(QLatin1String("moc_")) && onlyFileName.endsWith(QLatin1String(".cxx")))
|| (onlyFileName.startsWith(QLatin1String("ui_")) && onlyFileName.endsWith(QLatin1String(".h")))
|| (onlyFileName.startsWith(QLatin1String("qrc_")) && onlyFileName.endsWith(QLatin1String(".cxx"))))
generated = true;
if (fileName.endsWith(QLatin1String(".qrc")))
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::ResourceType, generated));
else
m_fileList.append( new ProjectExplorer::FileNode(fileName, ProjectExplorer::SourceType, generated));
}
if (!m_unitTarget.isEmpty())
m_unitTargetMap.insert(fileName, m_unitTarget);
m_processedUnits.insert(fileName);
}
return;
} else if (name() == QLatin1String("Option")) {
parseUnitOption();
} else if (isStartElement()) {
parseUnknownElement();
}
}
}
示例3: reloadPrompt
QTCREATOR_UTILS_EXPORT ReloadPromptAnswer reloadPrompt(const FileName &fileName,
bool modified,
bool enableDiffOption,
QWidget *parent)
{
const QString title = QCoreApplication::translate("Utils::reloadPrompt", "File Changed");
QString msg;
if (modified) {
msg = QCoreApplication::translate("Utils::reloadPrompt",
"The unsaved file <i>%1</i> has changed outside Qt Creator. "
"Do you want to reload it and discard your changes?");
} else {
msg = QCoreApplication::translate("Utils::reloadPrompt",
"The file <i>%1</i> has changed outside Qt Creator. Do you want to reload it?");
}
msg = msg.arg(fileName.fileName());
return reloadPrompt(title, msg, fileName.toUserOutput(), enableDiffOption, parent);
}
示例4: 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));
}
示例5: isVcsDirectory
bool BazaarClient::isVcsDirectory(const FileName &fileName) const
{
return fileName.toFileInfo().isDir()
&& !fileName.fileName().compare(Constants::BAZAARREPO, HostOsInfo::fileNameCaseSensitivity());
}
示例6: isVcsDirectory
bool MercurialClient::isVcsDirectory(const FileName &fileName) const
{
return fileName.toFileInfo().isDir()
&& !fileName.fileName().compare(Constants::MERCURIALREPO, HostOsInfo::fileNameCaseSensitivity());
}