const correctness for values() calls

Change-Id: I1476ae8d3fb7364686398c5650729dee94a8e933
Reviewed-by: Mark Brand <mabrand@mabrand.nl>
This commit is contained in:
Oswald Buddenhagen 2012-04-23 16:20:30 +02:00
parent e0f1de0788
commit f85292ab20
11 changed files with 103 additions and 99 deletions

View File

@ -259,8 +259,8 @@ GBuildMakefileGenerator::write()
t << "\t-Iwork\n"; t << "\t-Iwork\n";
t << "\t-Llib\n"; t << "\t-Llib\n";
t << "\t"; t << "\t";
QStringList &l = project->values("QMAKE_CXXFLAGS"); const QStringList &l = project->values("QMAKE_CXXFLAGS");
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if ((*it).startsWith("-")) if ((*it).startsWith("-"))
t << "\n" << "\t" << (*it); t << "\n" << "\t" << (*it);
else else
@ -285,8 +285,8 @@ GBuildMakefileGenerator::write()
if (isnativebin && (i == 0)) if (isnativebin && (i == 0))
continue; continue;
t << "\t"; t << "\t";
QStringList &l = project->values(src[i]); const QStringList &l = project->values(src[i]);
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if ((*it).startsWith("-")) if ((*it).startsWith("-"))
t << "\n" << "\t" << (*it); t << "\n" << "\t" << (*it);
else else
@ -298,8 +298,8 @@ GBuildMakefileGenerator::write()
/* first subdirectories/subprojects */ /* first subdirectories/subprojects */
{ {
QStringList &l = project->values("SUBDIRS"); const QStringList &l = project->values("SUBDIRS");
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString gpjname((*it)); QString gpjname((*it));
/* avoid native tools */ /* avoid native tools */
if (nativebins.contains(gpjname.section("_", -1))) if (nativebins.contains(gpjname.section("_", -1)))
@ -319,9 +319,10 @@ GBuildMakefileGenerator::write()
} }
{ {
QStringList &l = project->values("RESOURCES"); const QStringList &l = project->values("RESOURCES");
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString tmpstr((*it).replace(pathtoremove, "")); QString tmpstr(*it);
tmpstr.remove(pathtoremove);
t << tmpstr << "\t[Qt Resource]\n"; t << tmpstr << "\t[Qt Resource]\n";
tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1); tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1);
tmpstr.remove(".qrc"); tmpstr.remove(".qrc");
@ -332,9 +333,10 @@ GBuildMakefileGenerator::write()
} }
} }
{ {
QStringList &l = project->values("FORMS"); const QStringList &l = project->values("FORMS");
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString tmpstr((*it).replace(pathtoremove, "")); QString tmpstr(*it);
tmpstr.remove(pathtoremove);
t << tmpstr << "\t[Qt Dialog]\n"; t << tmpstr << "\t[Qt Dialog]\n";
tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1); tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1);
tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "ui_"); tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "ui_");
@ -347,22 +349,22 @@ GBuildMakefileGenerator::write()
/* source files for this project */ /* source files for this project */
QString src[] = { "HEADERS", "SOURCES", QString() }; QString src[] = { "HEADERS", "SOURCES", QString() };
for (int i = 0; !src[i].isNull(); i++) { for (int i = 0; !src[i].isNull(); i++) {
QStringList &l = project->values(src[i]); const QStringList &l = project->values(src[i]);
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if ((*it).isEmpty()) if ((*it).isEmpty())
continue; continue;
/* native tools aren't preprocessed */ /* native tools aren't preprocessed */
if (!isnativebin) if (!isnativebin)
t << writeOne((*it), pathtoremove); t << writeOne((*it), pathtoremove);
else else
t << (*it).remove(pathtoremove) << "\n"; t << QString(*it).remove(pathtoremove) << "\n";
} }
} }
t << "\n"; t << "\n";
{ {
QStringList &l = project->values("GENERATED_SOURCES"); const QStringList &l = project->values("GENERATED_SOURCES");
for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
t << "work/" << (*it).section(QDir::separator(), -1) << "\n"; t << "work/" << (*it).section(QDir::separator(), -1) << "\n";
} }
} }

View File

@ -393,7 +393,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t)
t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_LIST")) << ";" << "\n"; t << "\t\t\t" << writeSettings("buildConfigurationList", keyFor("QMAKE_SUBDIR_PBX_BUILDCONFIG_LIST")) << ";" << "\n";
t << "\t\t\t" << "projectReferences = (" << "\n"; t << "\t\t\t" << "projectReferences = (" << "\n";
{ {
QStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS"); const QStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS");
for(int i = 0; i < qmake_subdirs.count(); i++) { for(int i = 0; i < qmake_subdirs.count(); i++) {
QString subdir = qmake_subdirs[i]; QString subdir = qmake_subdirs[i];
t << "\t\t\t\t" << "{" << "\n" t << "\t\t\t\t" << "{" << "\n"
@ -714,16 +714,16 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
mkt << "IMAGES = " << varList("QMAKE_IMAGE_COLLECTION") << endl; mkt << "IMAGES = " << varList("QMAKE_IMAGE_COLLECTION") << endl;
mkt << "PARSERS ="; mkt << "PARSERS =";
if(!project->isEmpty("YACCSOURCES")) { if(!project->isEmpty("YACCSOURCES")) {
QStringList &yaccs = project->values("YACCSOURCES"); const QStringList &yaccs = project->values("YACCSOURCES");
for(QStringList::Iterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) { for (QStringList::ConstIterator yit = yaccs.begin(); yit != yaccs.end(); ++yit) {
QFileInfo fi(fileInfo((*yit))); QFileInfo fi(fileInfo((*yit)));
mkt << " " << fi.path() << Option::dir_sep << fi.baseName() mkt << " " << fi.path() << Option::dir_sep << fi.baseName()
<< Option::yacc_mod << Option::cpp_ext.first(); << Option::yacc_mod << Option::cpp_ext.first();
} }
} }
if(!project->isEmpty("LEXSOURCES")) { if(!project->isEmpty("LEXSOURCES")) {
QStringList &lexs = project->values("LEXSOURCES"); const QStringList &lexs = project->values("LEXSOURCES");
for(QStringList::Iterator lit = lexs.begin(); lit != lexs.end(); ++lit) { for (QStringList::ConstIterator lit = lexs.begin(); lit != lexs.end(); ++lit) {
QFileInfo fi(fileInfo((*lit))); QFileInfo fi(fileInfo((*lit)));
mkt << " " << fi.path() << Option::dir_sep << fi.baseName() mkt << " " << fi.path() << Option::dir_sep << fi.baseName()
<< Option::lex_mod << Option::cpp_ext.first(); << Option::lex_mod << Option::cpp_ext.first();

View File

@ -671,7 +671,7 @@ MakefileGenerator::init()
if(tmp_out.isEmpty()) if(tmp_out.isEmpty())
continue; continue;
if(project->values((*it) + ".CONFIG").indexOf("combine") != -1) { if(project->values((*it) + ".CONFIG").indexOf("combine") != -1) {
QStringList &compilerInputs = project->values((*it) + ".input"); const QStringList &compilerInputs = project->values((*it) + ".input");
// Don't generate compiler output if it doesn't have input. // Don't generate compiler output if it doesn't have input.
if (compilerInputs.isEmpty() || project->values(compilerInputs.first()).isEmpty()) if (compilerInputs.isEmpty() || project->values(compilerInputs.first()).isEmpty())
continue; continue;
@ -709,8 +709,8 @@ MakefileGenerator::init()
} }
} }
} else { } else {
QStringList &tmp = project->values((*it) + ".input"); const QStringList &tmp = project->values((*it) + ".input");
for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { for (QStringList::ConstIterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
const QStringList inputs = project->values((*it2)); const QStringList inputs = project->values((*it2));
for(QStringList::ConstIterator input = inputs.constBegin(); input != inputs.constEnd(); ++input) { for(QStringList::ConstIterator input = inputs.constBegin(); input != inputs.constEnd(); ++input) {
if((*input).isEmpty()) if((*input).isEmpty())
@ -1157,11 +1157,11 @@ MakefileGenerator::writePrlFile()
void void
MakefileGenerator::writeObj(QTextStream &t, const QString &src) MakefileGenerator::writeObj(QTextStream &t, const QString &src)
{ {
QStringList &srcl = project->values(src); const QStringList &srcl = project->values(src);
QStringList objl = createObjectList(srcl); const QStringList objl = createObjectList(srcl);
QStringList::Iterator oit = objl.begin(); QStringList::ConstIterator oit = objl.begin();
QStringList::Iterator sit = srcl.begin(); QStringList::ConstIterator sit = srcl.begin();
QString stringSrc("$src"); QString stringSrc("$src");
QString stringObj("$obj"); QString stringObj("$obj");
for(;sit != srcl.end() && oit != objl.end(); ++oit, ++sit) { for(;sit != srcl.end() && oit != objl.end(); ++oit, ++sit) {
@ -1222,8 +1222,8 @@ MakefileGenerator::writeInstalls(QTextStream &t, const QString &installs, bool n
rm_dir_contents = "-$(DEL_FILE) -r"; rm_dir_contents = "-$(DEL_FILE) -r";
QString all_installs, all_uninstalls; QString all_installs, all_uninstalls;
QStringList &l = project->values(installs); const QStringList &l = project->values(installs);
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
QString pvar = (*it) + ".path"; QString pvar = (*it) + ".path";
if(project->values((*it) + ".CONFIG").indexOf("no_path") == -1 && if(project->values((*it) + ".CONFIG").indexOf("no_path") == -1 &&
project->values((*it) + ".CONFIG").indexOf("dummy_install") == -1 && project->values((*it) + ".CONFIG").indexOf("dummy_install") == -1 &&
@ -1689,10 +1689,10 @@ MakefileGenerator::verifyExtraCompiler(const QString &comp, const QString &file_
if(!pass) if(!pass)
return false; return false;
} else { } else {
QStringList &tmp = project->values(comp + ".input"); const QStringList &tmp = project->values(comp + ".input");
for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { for (QStringList::ConstIterator it = tmp.begin(); it != tmp.end(); ++it) {
QStringList &inputs = project->values((*it)); const QStringList &inputs = project->values((*it));
for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { for (QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
if((*input).isEmpty()) if((*input).isEmpty())
continue; continue;
QString in = fileFixify(Option::fixPathToTargetOS((*input), false)); QString in = fileFixify(Option::fixPathToTargetOS((*input), false));
@ -1735,10 +1735,10 @@ MakefileGenerator::verifyExtraCompiler(const QString &comp, const QString &file_
if(system(cmd.toLatin1().constData())) if(system(cmd.toLatin1().constData()))
return false; return false;
} else { } else {
QStringList &tmp = project->values(comp + ".input"); const QStringList &tmp = project->values(comp + ".input");
for(QStringList::Iterator it = tmp.begin(); it != tmp.end(); ++it) { for (QStringList::ConstIterator it = tmp.begin(); it != tmp.end(); ++it) {
QStringList &inputs = project->values((*it)); const QStringList &inputs = project->values((*it));
for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { for (QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
if((*input).isEmpty()) if((*input).isEmpty())
continue; continue;
QString in = fileFixify(Option::fixPathToTargetOS((*input), false)); QString in = fileFixify(Option::fixPathToTargetOS((*input), false));
@ -1759,14 +1759,14 @@ MakefileGenerator::verifyExtraCompiler(const QString &comp, const QString &file_
void void
MakefileGenerator::writeExtraTargets(QTextStream &t) MakefileGenerator::writeExtraTargets(QTextStream &t)
{ {
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { for (QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) {
QString targ = var((*it) + ".target"), QString targ = var((*it) + ".target"),
cmd = var((*it) + ".commands"), deps; cmd = var((*it) + ".commands"), deps;
if(targ.isEmpty()) if(targ.isEmpty())
targ = (*it); targ = (*it);
QStringList &deplist = project->values((*it) + ".depends"); const QStringList &deplist = project->values((*it) + ".depends");
for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { for (QStringList::ConstIterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
QString dep = var((*dep_it) + ".target"); QString dep = var((*dep_it) + ".target");
if(dep.isEmpty()) if(dep.isEmpty())
dep = (*dep_it); dep = (*dep_it);
@ -1828,7 +1828,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
+ escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false))
+ QLatin1String(" && "); + QLatin1String(" && ");
} }
QStringList &vars = project->values((*it) + ".variables"); const QStringList &vars = project->values((*it) + ".variables");
if(tmp_out.isEmpty() || tmp_cmd.isEmpty()) if(tmp_out.isEmpty() || tmp_cmd.isEmpty())
continue; continue;
QStringList tmp_inputs; QStringList tmp_inputs;
@ -2120,10 +2120,10 @@ MakefileGenerator::writeExtraVariables(QTextStream &t)
t << endl; t << endl;
QStringList outlist; QStringList outlist;
QHash<QString, QStringList> &vars = project->variables(); const QHash<QString, QStringList> &vars = project->variables();
QStringList &exports = project->values("QMAKE_EXTRA_VARIABLES"); const QStringList &exports = project->values("QMAKE_EXTRA_VARIABLES");
for (QHash<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) { for (QHash<QString, QStringList>::ConstIterator it = vars.begin(); it != vars.end(); ++it) {
for (QStringList::Iterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) { for (QStringList::ConstIterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) {
QRegExp rx((*exp_it), Qt::CaseInsensitive, QRegExp::Wildcard); QRegExp rx((*exp_it), Qt::CaseInsensitive, QRegExp::Wildcard);
if (rx.exactMatch(it.key())) if (rx.exactMatch(it.key()))
outlist << ("EXPORT_" + it.key() + " = " + it.value().join(" ")); outlist << ("EXPORT_" + it.key() + " = " + it.value().join(" "));
@ -2139,7 +2139,7 @@ bool
MakefileGenerator::writeStubMakefile(QTextStream &t) MakefileGenerator::writeStubMakefile(QTextStream &t)
{ {
t << "QMAKE = " << var("QMAKE_QMAKE") << endl; t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " "; t << *it << " ";
//const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName())); //const QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
@ -2396,8 +2396,8 @@ void
MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags) MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags)
{ {
// blasted includes // blasted includes
QStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); const QStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES");
for(QStringList::Iterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it) for (QStringList::ConstIterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it)
t << "include " << (*qeui_it) << endl; t << "include " << (*qeui_it) << endl;
if (!(flags & SubTargetSkipDefaultVariables)) { if (!(flags & SubTargetSkipDefaultVariables)) {
@ -2607,16 +2607,16 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT
} }
// user defined targets // user defined targets
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for(QStringList::Iterator qut_it = qut.begin(); qut_it != qut.end(); ++qut_it) { for (QStringList::ConstIterator qut_it = qut.begin(); qut_it != qut.end(); ++qut_it) {
QString targ = var((*qut_it) + ".target"), QString targ = var((*qut_it) + ".target"),
cmd = var((*qut_it) + ".commands"), deps; cmd = var((*qut_it) + ".commands"), deps;
if(targ.isEmpty()) if(targ.isEmpty())
targ = (*qut_it); targ = (*qut_it);
t << endl; t << endl;
QStringList &deplist = project->values((*qut_it) + ".depends"); const QStringList &deplist = project->values((*qut_it) + ".depends");
for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) { for (QStringList::ConstIterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
QString dep = var((*dep_it) + ".target"); QString dep = var((*dep_it) + ".target");
if(dep.isEmpty()) if(dep.isEmpty())
dep = Option::fixPathToTargetOS(*dep_it, false); dep = Option::fixPathToTargetOS(*dep_it, false);
@ -2931,8 +2931,8 @@ MakefileGenerator::checkMultipleDefinition(const QString &f, const QString &w)
int slsh = f.lastIndexOf(Option::dir_sep); int slsh = f.lastIndexOf(Option::dir_sep);
if(slsh != -1) if(slsh != -1)
file.remove(0, slsh + 1); file.remove(0, slsh + 1);
QStringList &l = project->values(w); const QStringList &l = project->values(w);
for(QStringList::Iterator val_it = l.begin(); val_it != l.end(); ++val_it) { for (QStringList::ConstIterator val_it = l.begin(); val_it != l.end(); ++val_it) {
QString file2((*val_it)); QString file2((*val_it));
slsh = file2.lastIndexOf(Option::dir_sep); slsh = file2.lastIndexOf(Option::dir_sep);
if(slsh != -1) if(slsh != -1)
@ -2965,8 +2965,8 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca
QMakeLocalFileName ret; QMakeLocalFileName ret;
if(!project->isEmpty("SKIP_DEPENDS")) { if(!project->isEmpty("SKIP_DEPENDS")) {
bool found = false; bool found = false;
QStringList &nodeplist = project->values("SKIP_DEPENDS"); const QStringList &nodeplist = project->values("SKIP_DEPENDS");
for(QStringList::Iterator it = nodeplist.begin(); for (QStringList::ConstIterator it = nodeplist.begin();
it != nodeplist.end(); ++it) { it != nodeplist.end(); ++it) {
QRegExp regx((*it)); QRegExp regx((*it));
if(regx.indexIn(dep.local()) != -1) { if(regx.indexIn(dep.local()) != -1) {
@ -3014,8 +3014,8 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca
} }
{ //is it from an EXTRA_TARGET { //is it from an EXTRA_TARGET
const QString dep_basename = dep.local().section(Option::dir_sep, -1); const QString dep_basename = dep.local().section(Option::dir_sep, -1);
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) { for (QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) {
QString targ = var((*it) + ".target"); QString targ = var((*it) + ".target");
if(targ.isEmpty()) if(targ.isEmpty())
targ = (*it); targ = (*it);
@ -3033,10 +3033,10 @@ MakefileGenerator::findFileForDep(const QMakeLocalFileName &dep, const QMakeLoca
QString tmp_out = project->values((*it) + ".output").first(); QString tmp_out = project->values((*it) + ".output").first();
if(tmp_out.isEmpty()) if(tmp_out.isEmpty())
continue; continue;
QStringList &tmp = project->values((*it) + ".input"); const QStringList &tmp = project->values((*it) + ".input");
for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) { for (QStringList::ConstIterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
QStringList &inputs = project->values((*it2)); const QStringList &inputs = project->values((*it2));
for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) { for (QStringList::ConstIterator input = inputs.begin(); input != inputs.end(); ++input) {
QString out = Option::fixPathToTargetOS(unescapeFilePath(replaceExtraCompilerVariables(tmp_out, (*input), QString()))); QString out = Option::fixPathToTargetOS(unescapeFilePath(replaceExtraCompilerVariables(tmp_out, (*input), QString())));
if(out == dep.real() || out.section(Option::dir_sep, -1) == dep_basename) { if(out == dep.real() || out.section(Option::dir_sep, -1) == dep_basename) {
ret = QMakeLocalFileName(fileFixify(out, qmake_getpwd(), Option::output_dir)); ret = QMakeLocalFileName(fileFixify(out, qmake_getpwd(), Option::output_dir));

View File

@ -742,7 +742,7 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
QStringList links; QStringList links;
QString target="$(TARGET)"; QString target="$(TARGET)";
QStringList &targets = project->values(t + ".targets"); const QStringList &targets = project->values(t + ".targets");
if(!project->isEmpty("QMAKE_BUNDLE")) { if(!project->isEmpty("QMAKE_BUNDLE")) {
target = project->first("QMAKE_BUNDLE"); target = project->first("QMAKE_BUNDLE");
bundle = true; bundle = true;

View File

@ -82,7 +82,7 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t)
writeHeader(t); writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
t << "QMAKE = " << var("QMAKE_QMAKE") << endl; t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " "; t << *it << " ";
t << "first all clean install distclean uninstall qmake_all:" << "\n\t" t << "first all clean install distclean uninstall qmake_all:" << "\n\t"
@ -190,11 +190,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES"))) << " " t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES"))) << " "
<< valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl; << valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl;
if(do_incremental) { if(do_incremental) {
QStringList &objs = project->values("OBJECTS"), &incrs = project->values("QMAKE_INCREMENTAL"), incrs_out; const QStringList &objs = project->values("OBJECTS");
const QStringList &incrs = project->values("QMAKE_INCREMENTAL");
QStringList incrs_out;
t << "OBJECTS = "; t << "OBJECTS = ";
for(QStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) { for (QStringList::ConstIterator objit = objs.begin(); objit != objs.end(); ++objit) {
bool increment = false; bool increment = false;
for(QStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) { for (QStringList::ConstIterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {
if((*objit).indexOf(QRegExp((*incrit), Qt::CaseSensitive, if((*objit).indexOf(QRegExp((*incrit), Qt::CaseSensitive,
QRegExp::Wildcard)) != -1) { QRegExp::Wildcard)) != -1) {
increment = true; increment = true;
@ -247,8 +249,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << endl; t << endl;
// blasted includes // blasted includes
QStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES"); const QStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES");
QStringList::Iterator it; QStringList::ConstIterator it;
for(it = qeui.begin(); it != qeui.end(); ++it) for(it = qeui.begin(); it != qeui.end(); ++it)
t << "include " << (*it) << endl; t << "include " << (*it) << endl;
@ -301,8 +303,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString src[] = { "SOURCES", "GENERATED_SOURCES", QString() }; QString src[] = { "SOURCES", "GENERATED_SOURCES", QString() };
for(int x = 0; !src[x].isNull(); x++) { for(int x = 0; !src[x].isNull(); x++) {
QStringList &l = project->values(src[x]); const QStringList &l = project->values(src[x]);
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) { for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
if(!(*it).isEmpty()) { if(!(*it).isEmpty()) {
QString d_file; QString d_file;
for(QStringList::Iterator cit = Option::c_ext.begin(); for(QStringList::Iterator cit = Option::c_ext.begin();
@ -343,15 +345,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->isEmpty("SUBLIBS_DIR")) if(!project->isEmpty("SUBLIBS_DIR"))
libdir = project->first("SUBLIBS_DIR"); libdir = project->first("SUBLIBS_DIR");
t << "SUBLIBS = "; t << "SUBLIBS = ";
QStringList &l = project->values("SUBLIBS"); const QStringList &l = project->values("SUBLIBS");
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) for (QStringList::ConstIterator it = l.begin(); it != l.end(); ++it)
t << libdir << project->first("QMAKE_PREFIX_STATICLIB") << (*it) << "." t << libdir << project->first("QMAKE_PREFIX_STATICLIB") << (*it) << "."
<< project->first("QMAKE_EXTENSION_STATICLIB") << " "; << project->first("QMAKE_EXTENSION_STATICLIB") << " ";
t << endl << endl; t << endl << endl;
} }
if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) { if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) {
QStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES"); const QStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES");
QStringList::Iterator it; QStringList::ConstIterator it;
for(it = l.begin(); it != l.end(); ++it) { for(it = l.begin(); it != l.end(); ++it) {
QMakeMetaInfo libinfo; QMakeMetaInfo libinfo;
if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) { if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
@ -886,7 +888,7 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QString libdir = "tmp/"; QString libdir = "tmp/";
if(!project->isEmpty("SUBLIBS_DIR")) if(!project->isEmpty("SUBLIBS_DIR"))
libdir = project->first("SUBLIBS_DIR"); libdir = project->first("SUBLIBS_DIR");
QStringList &l = project->values("SUBLIBS"); const QStringList &l = project->values("SUBLIBS");
for(it = l.begin(); it != l.end(); ++it) for(it = l.begin(); it != l.end(); ++it)
t << libdir << project->first("QMAKE_PREFIX_STATICLIB") << (*it) << "." t << libdir << project->first("QMAKE_PREFIX_STATICLIB") << (*it) << "."
<< project->first("QMAKE_EXTENSION_STATICLIB") << ":\n\t" << project->first("QMAKE_EXTENSION_STATICLIB") << ":\n\t"

View File

@ -57,7 +57,7 @@ BorlandMakefileGenerator::writeMakefile(QTextStream &t)
{ {
writeHeader(t); writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " "; t << *it << " ";
t << "all first clean:" << "\n\t" t << "all first clean:" << "\n\t"

View File

@ -91,8 +91,8 @@ bool MingwMakefileGenerator::findLibraries(const QString &where)
QList<QMakeLocalFileName> dirs; QList<QMakeLocalFileName> dirs;
{ {
QStringList &libpaths = project->values("QMAKE_LIBDIR"); const QStringList &libpaths = project->values("QMAKE_LIBDIR");
for(QStringList::Iterator libpathit = libpaths.begin(); for (QStringList::ConstIterator libpathit = libpaths.begin();
libpathit != libpaths.end(); ++libpathit) libpathit != libpaths.end(); ++libpathit)
dirs.append(QMakeLocalFileName((*libpathit))); dirs.append(QMakeLocalFileName((*libpathit)));
} }
@ -148,7 +148,7 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
if(Option::mkfile::do_stub_makefile) { if(Option::mkfile::do_stub_makefile) {
t << "QMAKE = " << var("QMAKE_QMAKE") << endl; t << "QMAKE = " << var("QMAKE_QMAKE") << endl;
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " "; t << *it << " ";
t << "first all clean install distclean uninstall: qmake" << endl t << "first all clean install distclean uninstall: qmake" << endl
@ -344,8 +344,8 @@ void MingwMakefileGenerator::writeIncPart(QTextStream &t)
{ {
t << "INCPATH = "; t << "INCPATH = ";
QStringList &incs = project->values("INCLUDEPATH"); const QStringList &incs = project->values("INCLUDEPATH");
for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { for (QStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
QString inc = (*incit); QString inc = (*incit);
inc.replace(QRegExp("\\\\$"), ""); inc.replace(QRegExp("\\\\$"), "");
inc.replace(QRegExp("\""), ""); inc.replace(QRegExp("\""), "");

View File

@ -59,8 +59,8 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
{ {
writeHeader(t); writeHeader(t);
if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) { if(!project->values("QMAKE_FAILED_REQUIREMENTS").isEmpty()) {
QStringList &qut = project->values("QMAKE_EXTRA_TARGETS"); const QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it) for (QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
t << *it << " "; t << *it << " ";
t << "all first clean:" << "\n\t" t << "all first clean:" << "\n\t"
<< "@echo \"Some of the required modules (" << "@echo \"Some of the required modules ("
@ -332,8 +332,8 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t)
} }
QString srcs[] = { QString("SOURCES"), QString("GENERATED_SOURCES"), QString() }; QString srcs[] = { QString("SOURCES"), QString("GENERATED_SOURCES"), QString() };
for(int x = 0; !srcs[x].isNull(); x++) { for(int x = 0; !srcs[x].isNull(); x++) {
QStringList &l = project->values(srcs[x]); const QStringList &l = project->values(srcs[x]);
for(QStringList::Iterator sit = l.begin(); sit != l.end(); ++sit) { for (QStringList::ConstIterator sit = l.begin(); sit != l.end(); ++sit) {
QString sep = "\\"; QString sep = "\\";
if((*sit).indexOf(sep) == -1) if((*sit).indexOf(sep) == -1)
sep = "/"; sep = "/";

View File

@ -475,7 +475,7 @@ protected:
virtual ~VCToolBase(){} virtual ~VCToolBase(){}
virtual bool parseOption(const char* option) = 0; virtual bool parseOption(const char* option) = 0;
public: public:
void parseOptions(QStringList& options) { void parseOptions(const QStringList& options) {
for (QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++) for (QStringList::ConstIterator it=options.begin(); (it!=options.end()); it++)
parseOption((*it).toLatin1().constData()); parseOption((*it).toLatin1().constData());
} }

View File

@ -1112,7 +1112,7 @@ void VcprojGenerator::initDeploymentTool()
// Only deploy Qt libs for shared build // Only deploy Qt libs for shared build
if (!project->values("QMAKE_QT_DLL").isEmpty()) { if (!project->values("QMAKE_QT_DLL").isEmpty()) {
QStringList& arg = project->values("MSVCPROJ_LIBS"); const QStringList &arg = project->values("MSVCPROJ_LIBS");
for (QStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) { for (QStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) {
if (it->contains(project->first("QMAKE_LIBDIR"))) { if (it->contains(project->first("QMAKE_LIBDIR"))) {
QString dllName = *it; QString dllName = *it;
@ -1471,8 +1471,8 @@ void VcprojGenerator::initOld()
// $$QMAKE.. -> $$MSVCPROJ.. ------------------------------------- // $$QMAKE.. -> $$MSVCPROJ.. -------------------------------------
project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS"); project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS");
project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS_PRIVATE"); project->values("MSVCPROJ_LIBS") += project->values("QMAKE_LIBS_PRIVATE");
QStringList &incs = project->values("INCLUDEPATH"); const QStringList &incs = project->values("INCLUDEPATH");
for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) { for (QStringList::ConstIterator incit = incs.begin(); incit != incs.end(); ++incit) {
QString inc = (*incit); QString inc = (*incit);
if (!inc.startsWith('"') && !inc.endsWith('"')) if (!inc.startsWith('"') && !inc.endsWith('"'))
inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already inc = QString("\"%1\"").arg(inc); // Quote all paths if not quoted already

View File

@ -110,8 +110,8 @@ Win32MakefileGenerator::findLibraries(const QString &where)
QStringList &l = project->values(where); QStringList &l = project->values(where);
QList<QMakeLocalFileName> dirs; QList<QMakeLocalFileName> dirs;
{ {
QStringList &libpaths = project->values("QMAKE_LIBDIR"); const QStringList &libpaths = project->values("QMAKE_LIBDIR");
for(QStringList::Iterator libpathit = libpaths.begin(); for (QStringList::ConstIterator libpathit = libpaths.begin();
libpathit != libpaths.end(); ++libpathit) libpathit != libpaths.end(); ++libpathit)
dirs.append(QMakeLocalFileName((*libpathit))); dirs.append(QMakeLocalFileName((*libpathit)));
} }
@ -223,8 +223,8 @@ Win32MakefileGenerator::processPrlFiles()
QHash<QString, bool> processed; QHash<QString, bool> processed;
QList<QMakeLocalFileName> libdirs; QList<QMakeLocalFileName> libdirs;
{ {
QStringList &libpaths = project->values("QMAKE_LIBDIR"); const QStringList &libpaths = project->values("QMAKE_LIBDIR");
for(QStringList::Iterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit) for (QStringList::ConstIterator libpathit = libpaths.begin(); libpathit != libpaths.end(); ++libpathit)
libdirs.append(QMakeLocalFileName((*libpathit))); libdirs.append(QMakeLocalFileName((*libpathit)));
} }
for(bool ret = false; true; ret = false) { for(bool ret = false; true; ret = false) {
@ -730,8 +730,8 @@ void Win32MakefileGenerator::writeStandardParts(QTextStream &t)
if(!project->isEmpty("TRANSLATIONS")) if(!project->isEmpty("TRANSLATIONS"))
dist_files << var("TRANSLATIONS"); dist_files << var("TRANSLATIONS");
if(!project->isEmpty("FORMS")) { if(!project->isEmpty("FORMS")) {
QStringList &forms = project->values("FORMS"); const QStringList &forms = project->values("FORMS");
for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) { for (QStringList::ConstIterator formit = forms.begin(); formit != forms.end(); ++formit) {
QString ui_h = fileFixify((*formit) + Option::h_ext.first()); QString ui_h = fileFixify((*formit) + Option::h_ext.first());
if(exists(ui_h)) if(exists(ui_h))
dist_files << ui_h; dist_files << ui_h;