本文整理汇总了C++中ProStringList类的典型用法代码示例。如果您正苦于以下问题:C++ ProStringList类的具体用法?C++ ProStringList怎么用?C++ ProStringList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProStringList类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: debug_msg
MakefileGenerator
*BuildsMetaMakefileGenerator::processBuild(const ProString &build)
{
if(project) {
debug_msg(1, "Meta Generator: Parsing '%s' for build [%s].",
project->projectFile().toLatin1().constData(),build.toLatin1().constData());
//initialize the base
ProValueMap basevars;
ProStringList basecfgs = project->values(ProKey(build + ".CONFIG"));
basecfgs += build;
basecfgs += "build_pass";
basevars["BUILD_PASS"] = ProStringList(build);
ProStringList buildname = project->values(ProKey(build + ".name"));
basevars["BUILD_NAME"] = (buildname.isEmpty() ? ProStringList(build) : buildname);
//create project
QMakeProject *build_proj = new QMakeProject;
build_proj->setExtraVars(basevars);
build_proj->setExtraConfigs(basecfgs);
build_proj->read(project->projectFile());
//done
return createMakefileGenerator(build_proj);
}
return 0;
}
示例2: l
void
Win32MakefileGenerator::processPrlFiles()
{
const QString libArg = project->first("QMAKE_L_FLAG").toQString();
QList<QMakeLocalFileName> libdirs;
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]);
for (int lit = 0; lit < l.size(); ++lit) {
QString opt = l.at(lit).trimmed().toQString();
if((opt[0] == '\'' || opt[0] == '"') && opt[(int)opt.length()-1] == opt[0])
opt = opt.mid(1, opt.length()-2);
if (opt.startsWith(libArg)) {
QMakeLocalFileName l(opt.mid(libArg.length()));
if (!libdirs.contains(l))
libdirs.append(l);
} else if (!opt.startsWith("/")) {
if (!processPrlFile(opt) && (QDir::isRelativePath(opt) || opt.startsWith("-l"))) {
QString tmp;
if (opt.startsWith("-l"))
tmp = opt.mid(2);
else
tmp = opt;
for(QList<QMakeLocalFileName>::Iterator it = libdirs.begin(); it != libdirs.end(); ++it) {
QString prl = (*it).local() + Option::dir_sep + tmp;
if (processPrlFile(prl))
break;
}
}
}
ProStringList &prl_libs = project->values("QMAKE_CURRENT_PRL_LIBS");
for (int prl = 0; prl < prl_libs.size(); ++prl) {
ProString arg = prl_libs.at(prl);
if (arg.startsWith(libArg))
arg = arg.left(libArg.length()) + escapeFilePath(arg.mid(libArg.length()).toQString());
else if (!arg.startsWith('/'))
arg = escapeFilePath(arg.toQString());
l.insert(lit + prl + 1, arg);
}
prl_libs.clear();
}
// Merge them into a logical order
if (!project->isActiveConfig("no_smart_library_merge") && !project->isActiveConfig("no_lflags_merge")) {
ProStringList lflags;
for (int lit = 0; lit < l.size(); ++lit) {
ProString opt = l.at(lit).trimmed();
if (opt.startsWith(libArg)) {
if (!lflags.contains(opt))
lflags.append(opt);
} else {
// Make sure we keep the dependency-order of libraries
lflags.removeAll(opt);
lflags.append(opt);
}
}
l = lflags;
}
}
}
示例3: prepareBuiltinArgs
static ProStringList prepareBuiltinArgs(const QList<ProStringList> &args)
{
ProStringList ret;
ret.reserve(args.size());
foreach (const ProStringList &arg, args)
ret << arg.join(' ');
return ret;
}
示例4: createArObjectScriptFile
void createArObjectScriptFile(const QString &fileName, const QString &target, const ProStringList &objList)
{
QString filePath = Option::output_dir + QDir::separator() + fileName;
QFile file(filePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream t(&file);
t << "CREATE " << target << endl;
for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
t << "ADDMOD " << *it << endl;
}
t << "SAVE" << endl;
t.flush();
file.close();
}
}
示例5: expandVariableReferences
ProString QMakeProject::expand(const QString &expr, const QString &where, int line)
{
ProString ret;
ProFile *pro = m_parser->parsedProBlock(expr, where, line, QMakeParser::ValueGrammar);
if (pro->isOk()) {
m_current.pro = pro;
m_current.line = 0;
const ushort *tokPtr = pro->tokPtr();
ProStringList result = expandVariableReferences(tokPtr, 1, true);
if (!result.isEmpty())
ret = result.at(0);
}
pro->deref();
return ret;
}
示例6: createRvctObjectScriptFile
void createRvctObjectScriptFile(const QString &fileName, const ProStringList &objList)
{
QString filePath = Option::output_dir + QDir::separator() + fileName;
QFile file(filePath);
if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream t(&file);
for (ProStringList::ConstIterator it = objList.constBegin(); it != objList.constEnd(); ++it) {
QString path = (*it).toQString();
if (QDir::isRelativePath(path))
t << "./" << path << endl;
else
t << path << endl;
}
t.flush();
file.close();
}
}
示例7: evaluateBuiltinExpand
QStringList QMakeProject::expand(const ProKey &func, const QList<ProStringList> &args)
{
m_current.clear();
if (int func_t = statics.expands.value(func))
return evaluateBuiltinExpand(func_t, func, prepareBuiltinArgs(args)).toQStringList();
QHash<ProKey, ProFunctionDef>::ConstIterator it =
m_functionDefs.replaceFunctions.constFind(func);
if (it != m_functionDefs.replaceFunctions.constEnd()) {
QMakeProject::VisitReturn vr;
ProStringList ret = evaluateFunction(*it, args, &vr);
if (vr == QMakeProject::ReturnError)
exit(3);
return ret.toQStringList();
}
evalError(QStringLiteral("'%1' is not a recognized replace function.")
.arg(func.toQString(m_tmp1)));
return QStringList();
}
示例8: fileFixify
void MingwMakefileGenerator::writeRcFilePart(QTextStream &t)
{
const QString rc_file = fileFixify(project->first("RC_FILE").toQString());
ProStringList rcIncPaths = project->values("RC_INCLUDEPATH");
rcIncPaths.prepend(fileInfo(rc_file).path());
QString incPathStr;
for (int i = 0; i < rcIncPaths.count(); ++i) {
const ProString &path = rcIncPaths.at(i);
if (path.isEmpty())
continue;
incPathStr += QStringLiteral(" --include-dir=");
if (path != "." && QDir::isRelativePath(path.toQString()))
incPathStr += "./";
incPathStr += escapeFilePath(path);
}
if (!rc_file.isEmpty()) {
t << escapeDependencyPath(var("RES_FILE")) << ": " << rc_file << "\n\t"
<< var("QMAKE_RC") << " -i " << rc_file << " -o " << var("RES_FILE")
<< incPathStr << " $(DEFINES)\n\n";
}
}
示例9: ProStringList_join
static QString ProStringList_join(const ProStringList &this_, const QChar *sep, const int sepSize)
{
int totalLength = 0;
const int sz = this_.size();
for (int i = 0; i < sz; ++i)
totalLength += this_.at(i).size();
if (sz)
totalLength += sepSize * (sz - 1);
QString res(totalLength, Qt::Uninitialized);
QChar *ptr = (QChar *)res.constData();
for (int i = 0; i < sz; ++i) {
if (i) {
memcpy(ptr, sep, sepSize * sizeof(QChar));
ptr += sepSize;
}
const ProString &str = this_.at(i);
memcpy(ptr, str.constData(), str.size() * sizeof(QChar));
ptr += str.size();
}
return res;
}
示例10: 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;
}
示例11: writeHeader
bool
NmakeMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if (writeDummyMakefile(t))
return true;
if(project->first("TEMPLATE") == "app" ||
project->first("TEMPLATE") == "lib" ||
project->first("TEMPLATE") == "aux") {
#if 0
if(Option::mkfile::do_stub_makefile)
return MakefileGenerator::writeStubMakefile(t);
#endif
if (!project->isHostBuild()) {
const ProValueMap &variables = project->variables();
if (project->isActiveConfig("wince")) {
CeSdkHandler sdkhandler;
sdkhandler.parse();
const QString sdkName = variables["CE_SDK"].join(' ')
+ " (" + variables["CE_ARCH"].join(' ') + ")";
const QList<CeSdkInfo> sdkList = sdkhandler.listAll();
CeSdkInfo sdk;
foreach (const CeSdkInfo &info, sdkList) {
if (info.name().compare(sdkName, Qt::CaseInsensitive ) == 0) {
sdk = info;
break;
}
}
if (sdk.isValid()) {
t << "\nINCLUDE = " << sdk.includePath();
t << "\nLIB = " << sdk.libPath();
t << "\nPATH = " << sdk.binPath() << "\n";
} else {
QStringList sdkStringList;
foreach (const CeSdkInfo &info, sdkList)
sdkStringList << info.name();
fprintf(stderr, "Failed to find Windows CE SDK matching %s, found: %s\n"
"SDK needs to be specified in mkspec (using: %s/qmake.conf)\n"
"SDK name needs to match the following format: CE_SDK (CE_ARCH)\n",
qPrintable(sdkName), qPrintable(sdkStringList.join(", ")),
qPrintable(variables["QMAKESPEC"].first().toQString()));
return false;
}
} else if (project->isActiveConfig(QStringLiteral("winrt"))) {
QString arch = project->first("VCPROJ_ARCH").toQString().toLower();
QString compiler;
QString compilerArch;
if (arch == QStringLiteral("arm")) {
compiler = QStringLiteral("x86_arm");
compilerArch = QStringLiteral("arm");
} else if (arch == QStringLiteral("x64")) {
const ProStringList hostArch = project->values("QMAKE_TARGET.arch");
if (hostArch.contains("x86_64"))
compiler = QStringLiteral("amd64");
else
compiler = QStringLiteral("x86_amd64");
compilerArch = QStringLiteral("amd64");
} else {
arch = QStringLiteral("x86");
}
const QString msvcVer = project->first("MSVC_VER").toQString();
if (msvcVer.isEmpty()) {
fprintf(stderr, "Mkspec does not specify MSVC_VER. Cannot continue.\n");
return false;
}
const QString winsdkVer = project->first("WINSDK_VER").toQString();
if (winsdkVer.isEmpty()) {
fprintf(stderr, "Mkspec does not specify WINSDK_VER. Cannot continue.\n");
return false;
}
const QString targetVer = project->first("WINTARGET_VER").toQString();
if (targetVer.isEmpty()) {
fprintf(stderr, "Mkspec does not specify WINTARGET_VER. Cannot continue.\n");
return false;
}
const bool isPhone = project->isActiveConfig(QStringLiteral("winphone"));
#ifdef Q_OS_WIN
QString regKeyPrefix;
#if !defined(Q_OS_WIN64) && _WIN32_WINNT >= 0x0501
BOOL isWow64;
IsWow64Process(GetCurrentProcess(), &isWow64);
if (!isWow64)
regKeyPrefix = QStringLiteral("Software\\");
else
#endif
regKeyPrefix = QStringLiteral("Software\\Wow6432Node\\");
QString regKey = regKeyPrefix + QStringLiteral("Microsoft\\VisualStudio\\") + msvcVer + ("\\Setup\\VC\\ProductDir");
const QString vcInstallDir = qt_readRegistryKey(HKEY_LOCAL_MACHINE, regKey);
if (vcInstallDir.isEmpty()) {
fprintf(stderr, "Failed to find the Visual Studio installation directory.\n");
return false;
}
regKey = regKeyPrefix
+ (isPhone ? QStringLiteral("Microsoft\\Microsoft SDKs\\WindowsPhone\\v")
//.........这里部分代码省略.........
示例12: addSourceFiles
void QMakeSourceFileInfo::addSourceFiles(const ProStringList &l, uchar seek,
QMakeSourceFileInfo::SourceFileType type)
{
for(int i=0; i<l.size(); ++i)
addSourceFile(l.at(i).toQString(), seek, type);
}
示例13: foreach
bool
UnixMakefileGenerator::findLibraries()
{
ProString libArg = project->first("QMAKE_L_FLAG");
if (libArg == "-L")
libArg.clear();
QList<QMakeLocalFileName> libdirs;
int libidx = 0;
foreach (const ProString &dlib, project->values("QMAKE_DEFAULT_LIBDIRS"))
libdirs.append(QMakeLocalFileName(dlib.toQString()));
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", 0 };
for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]);
for (ProStringList::Iterator it = l.begin(); it != l.end(); ) {
QString stub, dir, extn, opt = (*it).trimmed().toQString();
if(opt.startsWith("-")) {
if(opt.startsWith("-L")) {
QString lib = opt.mid(2);
QMakeLocalFileName f(lib);
int idx = libdirs.indexOf(f);
if (idx >= 0 && idx < libidx) {
it = l.erase(it);
continue;
}
libdirs.insert(libidx++, f);
if (!libArg.isEmpty())
*it = libArg + lib;
} else if(opt.startsWith("-l")) {
if (project->isActiveConfig("rvct_linker") || project->isActiveConfig("armcc_linker")) {
(*it) = "lib" + opt.mid(2) + ".so";
} else if (project->isActiveConfig("ti_linker")) {
(*it) = opt.mid(2);
} else {
stub = opt.mid(2);
}
} else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
if (opt.length() == 10)
++it;
// Skip
}
} else {
extn = dir = "";
stub = opt;
int slsh = opt.lastIndexOf(Option::dir_sep);
if(slsh != -1) {
dir = opt.left(slsh);
stub = opt.mid(slsh+1);
}
QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$");
if(stub_reg.exactMatch(stub)) {
stub = stub_reg.cap(1);
extn = stub_reg.cap(2);
}
}
if(!stub.isEmpty()) {
stub += project->first(ProKey("QMAKE_" + stub.toUpper() + "_SUFFIX")).toQString();
bool found = false;
ProStringList extens;
if(!extn.isNull())
extens << extn;
else
extens << project->values("QMAKE_EXTENSION_SHLIB").first() << "a";
for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
if(dir.isNull()) {
for(QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin(); dep_it != libdirs.end(); ++dep_it) {
QString pathToLib = ((*dep_it).local() + Option::dir_sep
+ project->values("QMAKE_PREFIX_SHLIB").first()
+ stub + "." + (*extit));
if(exists(pathToLib)) {
(*it) = "-l" + stub;
found = true;
break;
}
}
} else {
QString lib = dir + project->values("QMAKE_PREFIX_SHLIB").first() + stub + "." + (*extit);
if (exists(lib)) {
(*it) = lib;
found = true;
break;
}
}
}
if(!found && project->isActiveConfig("compile_libtool")) {
for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
if(exists(libdirs[dep_i].local() + Option::dir_sep + project->values("QMAKE_PREFIX_SHLIB").first() + stub + Option::libtool_ext)) {
(*it) = libdirs[dep_i].real() + Option::dir_sep + project->values("QMAKE_PREFIX_SHLIB").first() + stub + Option::libtool_ext;
found = true;
break;
}
}
}
}
++it;
}
}
return false;
}