本文整理汇总了C++中ProString::endsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ ProString::endsWith方法的具体用法?C++ ProString::endsWith怎么用?C++ ProString::endsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProString
的用法示例。
在下文中一共展示了ProString::endsWith方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: foreach
QStringList
&UnixMakefileGenerator::findDependencies(const QString &f)
{
QStringList &ret = MakefileGenerator::findDependencies(f);
if (doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
ProString file = f;
QString header_prefix;
if(!project->isEmpty("PRECOMPILED_DIR"))
header_prefix = project->first("PRECOMPILED_DIR").toQString();
header_prefix += project->first("QMAKE_ORIG_TARGET").toQString();
if (!project->isActiveConfig("clang_pch_style"))
header_prefix += project->first("QMAKE_PCH_OUTPUT_EXT").toQString();
if (project->isActiveConfig("icc_pch_style")) {
// icc style
for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
if(file.endsWith(*it)) {
ret += header_prefix;
break;
}
}
} else {
// gcc style (including clang_pch_style)
QString header_suffix = project->isActiveConfig("clang_pch_style")
? project->first("QMAKE_PCH_OUTPUT_EXT").toQString() : "";
header_prefix += Option::dir_sep + project->first("QMAKE_PRECOMP_PREFIX");
foreach (const ProString &compiler, project->values("QMAKE_BUILTIN_COMPILERS")) {
if (project->isEmpty(ProKey("QMAKE_" + compiler + "FLAGS_PRECOMPILE")))
continue;
ProString language = project->first(ProKey("QMAKE_LANGUAGE_" + compiler));
if (language.isEmpty())
continue;
// Unfortunately we were not consistent about the C++ naming
ProString extensionSuffix = compiler;
if (extensionSuffix == "CXX")
extensionSuffix = ProString("CPP");
foreach (const ProString &extension, project->values(ProKey("QMAKE_EXT_" + extensionSuffix))) {
if (!file.endsWith(extension.toQString()))
continue;
QString precompiledHeader = header_prefix + language + header_suffix;
if (!ret.contains(precompiledHeader))
ret += precompiledHeader;
goto foundPrecompiledDependency;
}
}
foundPrecompiledDependency:
; // Hurray!!
}
}
示例2: if
bool
QMakeMetaInfo::readLibtoolFile(const QString &f)
{
/* I can just run the .la through the .pro parser since they are compatible.. */
QMakeProject proj;
QString nf = Option::normalizePath(f);
if (!proj.read(nf, QMakeEvaluator::LoadProOnly))
return false;
QString dirf = nf.section(QLatin1Char('/'), 0, -2);
if(dirf == nf)
dirf = "";
else if(!dirf.isEmpty() && !dirf.endsWith(Option::output_dir))
dirf += QLatin1Char('/');
const ProValueMap &v = proj.variables();
for (ProValueMap::ConstIterator it = v.begin(); it != v.end(); ++it) {
ProStringList lst = it.value();
if(lst.count() == 1 && (lst.first().startsWith("'") || lst.first().startsWith("\"")) &&
lst.first().endsWith(QString(lst.first().at(0))))
lst = ProStringList(lst.first().mid(1, lst.first().length() - 2));
if(!vars.contains("QMAKE_PRL_TARGET") &&
(it.key() == "dlname" || it.key() == "library_names" || it.key() == "old_library")) {
ProString dir = v["libdir"].first();
if ((dir.startsWith('\'') || dir.startsWith('"')) && dir.endsWith(dir.at(0)))
dir = dir.mid(1, dir.length() - 2);
dir = dir.trimmed();
if(!dir.isEmpty() && !dir.endsWith(QLatin1Char('/')))
dir += QLatin1Char('/');
if(lst.count() == 1)
lst = ProStringList(lst.first().toQString().split(" "));
for (ProStringList::Iterator lst_it = lst.begin(); lst_it != lst.end(); ++lst_it) {
bool found = false;
QString dirs[] = { "", dir.toQString(), dirf, dirf + ".libs/", "(term)" };
for(int i = 0; !found && dirs[i] != "(term)"; i++) {
if(QFile::exists(dirs[i] + (*lst_it))) {
QString targ = dirs[i] + (*lst_it);
if(QDir::isRelativePath(targ))
targ.prepend(qmake_getpwd() + QLatin1Char('/'));
vars["QMAKE_PRL_TARGET"] << targ;
found = true;
}
}
if(found)
break;
}
} else if(it.key() == "dependency_libs") {
if(lst.count() == 1) {
ProString dep = lst.first();
if ((dep.startsWith('\'') || dep.startsWith('"')) && dep.endsWith(dep.at(0)))
dep = dep.mid(1, dep.length() - 2);
lst = ProStringList(dep.trimmed().toQString().split(" "));
}
for (ProStringList::Iterator lit = lst.begin(); lit != lst.end(); ++lit) {
if((*lit).startsWith("-R")) {
if(!conf->isEmpty("QMAKE_LFLAGS_RPATH"))
(*lit) = conf->first("QMAKE_LFLAGS_RPATH") + (*lit).mid(2);
}
}
vars["QMAKE_PRL_LIBS"] += lst;
}
}
return true;
}
示例3: if
//.........这里部分代码省略.........
rpathdir.prepend(rpathbase + '/');
project->values("QMAKE_LFLAGS").insertUnique(project->values("QMAKE_LFLAGS_REL_RPATH"));
}
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + escapeFilePath(rpathdir);
}
}
if (!project->isEmpty("QMAKE_RPATHLINKDIR")) {
const ProStringList &rpathdirs = project->values("QMAKE_RPATHLINKDIR");
for (int i = 0; i < rpathdirs.size(); ++i) {
if (!project->isEmpty("QMAKE_LFLAGS_RPATHLINK"))
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATHLINK") + escapeFilePath(QFileInfo(rpathdirs[i].toQString()).absoluteFilePath());
}
}
if(project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS"))
include_deps = true; //do not generate deps
MakefileGenerator::init();
if (project->isActiveConfig("objective_c"))
project->values("QMAKE_BUILTIN_COMPILERS") << "OBJC" << "OBJCXX";
foreach (const ProString &compiler, project->values("QMAKE_BUILTIN_COMPILERS")) {
QString compile_flag = var("QMAKE_COMPILE_FLAG");
if(compile_flag.isEmpty())
compile_flag = "-c";
if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
QString pchFlags = var(ProKey("QMAKE_" + compiler + "FLAGS_USE_PRECOMPILE"));
QString pchBaseName;
if(!project->isEmpty("PRECOMPILED_DIR")) {
pchBaseName = Option::fixPathToTargetOS(project->first("PRECOMPILED_DIR").toQString());
if(!pchBaseName.endsWith(Option::dir_sep))
pchBaseName += Option::dir_sep;
}
pchBaseName += project->first("QMAKE_ORIG_TARGET").toQString();
// replace place holders
pchFlags.replace(QLatin1String("${QMAKE_PCH_INPUT}"),
escapeFilePath(project->first("PRECOMPILED_HEADER").toQString()));
pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT_BASE}"), escapeFilePath(pchBaseName));
if (project->isActiveConfig("icc_pch_style")) {
// icc style
pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT}"),
escapeFilePath(pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT")));
} else {
// gcc style (including clang_pch_style)
QString headerSuffix;
if (project->isActiveConfig("clang_pch_style"))
headerSuffix = project->first("QMAKE_PCH_OUTPUT_EXT").toQString();
else
pchBaseName += project->first("QMAKE_PCH_OUTPUT_EXT").toQString();
pchBaseName += Option::dir_sep;
ProString language = project->first(ProKey("QMAKE_LANGUAGE_" + compiler));
if (!language.isEmpty()) {
pchFlags.replace(QLatin1String("${QMAKE_PCH_OUTPUT}"),
escapeFilePath(pchBaseName + language + headerSuffix));
}
}
if (!pchFlags.isEmpty())
compile_flag += " " + pchFlags;
}
示例4: if
//.........这里部分代码省略.........
const ProStringList &rpathdirs = project->values("QMAKE_RPATHDIR");
for(int i = 0; i < rpathdirs.size(); ++i) {
if(!project->isEmpty("QMAKE_LFLAGS_RPATH"))
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + escapeFilePath(QFileInfo(rpathdirs[i].toQString()).absoluteFilePath());
}
}
if (!project->isEmpty("QMAKE_RPATHLINKDIR")) {
const ProStringList &rpathdirs = project->values("QMAKE_RPATHLINKDIR");
for (int i = 0; i < rpathdirs.size(); ++i) {
if (!project->isEmpty("QMAKE_LFLAGS_RPATHLINK"))
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATHLINK") + escapeFilePath(QFileInfo(rpathdirs[i].toQString()).absoluteFilePath());
}
}
if(project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS"))
include_deps = true; //do not generate deps
if(project->isActiveConfig("compile_libtool"))
Option::obj_ext = ".lo"; //override the .o
MakefileGenerator::init();
QString comps[] = { "C", "CXX", "OBJC", "OBJCXX", QString() };
for(int i = 0; !comps[i].isNull(); i++) {
QString compile_flag = var("QMAKE_COMPILE_FLAG");
if(compile_flag.isEmpty())
compile_flag = "-c";
if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
QString pchFlags = var(ProKey("QMAKE_" + comps[i] + "FLAGS_USE_PRECOMPILE"));
QString pchBaseName;
if(!project->isEmpty("PRECOMPILED_DIR")) {
pchBaseName = Option::fixPathToTargetOS(project->first("PRECOMPILED_DIR").toQString());
if(!pchBaseName.endsWith(Option::dir_sep))
pchBaseName += Option::dir_sep;
}
pchBaseName += project->first("QMAKE_ORIG_TARGET").toQString();
// replace place holders
pchFlags = pchFlags.replace("${QMAKE_PCH_INPUT}",
fileFixify(project->first("PRECOMPILED_HEADER").toQString()));
pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT_BASE}", pchBaseName);
if (project->isActiveConfig("icc_pch_style")) {
// icc style
pchFlags = pchFlags.replace("${QMAKE_PCH_OUTPUT}",
pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT"));
} else {
// gcc style (including clang_pch_style)
QString headerSuffix;
if (project->isActiveConfig("clang_pch_style"))
headerSuffix = project->first("QMAKE_PCH_OUTPUT_EXT").toQString();
else
pchBaseName += project->first("QMAKE_PCH_OUTPUT_EXT").toQString();
pchBaseName += Option::dir_sep;
QString pchOutputFile;
if(comps[i] == "C") {
pchOutputFile = "c";
} else if(comps[i] == "CXX") {
pchOutputFile = "c++";
} else if(project->isActiveConfig("objective_c")) {
if(comps[i] == "OBJC")
pchOutputFile = "objective-c";
else if(comps[i] == "OBJCXX")
pchOutputFile = "objective-c++";