本文整理汇总了C++中FileName::parentDir方法的典型用法代码示例。如果您正苦于以下问题:C++ FileName::parentDir方法的具体用法?C++ FileName::parentDir怎么用?C++ FileName::parentDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileName
的用法示例。
在下文中一共展示了FileName::parentDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseTaskFile
static bool parseTaskFile(QString *errorString, const FileName &name)
{
QFile tf(name.toString());
if (!tf.open(QIODevice::ReadOnly)) {
*errorString = TaskListPlugin::tr("Cannot open task file %1: %2").arg(
name.toUserOutput(), tf.errorString());
return false;
}
const FileName parentDir = name.parentDir();
while (!tf.atEnd()) {
QStringList chunks = parseRawLine(tf.readLine());
if (chunks.isEmpty())
continue;
QString description;
QString file;
Task::TaskType type = Task::Unknown;
int line = -1;
if (chunks.count() == 1) {
description = chunks.at(0);
} else if (chunks.count() == 2) {
type = typeFrom(chunks.at(0));
description = chunks.at(1);
} else if (chunks.count() == 3) {
file = chunks.at(0);
type = typeFrom(chunks.at(1));
description = chunks.at(2);
} else if (chunks.count() >= 4) {
file = chunks.at(0);
bool ok;
line = chunks.at(1).toInt(&ok);
if (!ok)
line = -1;
type = typeFrom(chunks.at(2));
description = chunks.at(3);
}
if (!file.isEmpty()) {
file = QDir::fromNativeSeparators(file);
QFileInfo fi(file);
if (fi.isRelative())
file = FileName(parentDir).appendPath(file).toString();
}
description = unescape(description);
TaskHub::addTask(type, description, Constants::TASKLISTTASK_ID,
FileName::fromUserInput(file), line);
}
return true;
}
示例2: shadowBuildDirectory
FileName CMakeBuildConfiguration::shadowBuildDirectory(const FileName &projectFilePath,
const Kit *k,
const QString &bcName,
BuildConfiguration::BuildType buildType)
{
if (projectFilePath.isEmpty())
return FileName();
const QString projectName = projectFilePath.parentDir().fileName();
ProjectMacroExpander expander(projectName, k, bcName, buildType);
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));
}
示例3: CMakeProjectNode
/*!
\class CMakeProject
*/
CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
: m_manager(manager),
m_activeTarget(0),
m_fileName(fileName),
m_rootNode(new CMakeProjectNode(fileName)),
m_watcher(new QFileSystemWatcher(this))
{
setId(Constants::CMAKEPROJECT_ID);
setProjectContext(Core::Context(CMakeProjectManager::Constants::PROJECTCONTEXT));
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
m_rootNode->setDisplayName(fileName.parentDir().fileName());
m_file = new CMakeFile(this, fileName);
connect(this, &CMakeProject::buildTargetsChanged, this, &CMakeProject::updateRunConfigurations);
connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &CMakeProject::fileChanged);
}