diff options
Diffstat (limited to 'qmake/generators/mac/pbuilder_pbx.cpp')
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 79 |
1 files changed, 27 insertions, 52 deletions
diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index e06a114592..d0d560aca9 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -1,30 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake application of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 #include "pbuilder_pbx.h" #include "option.h" @@ -112,7 +87,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) for(int pb_subdir = 0; pb_subdir < pb_subdirs.size(); ++pb_subdir) { ProjectBuilderSubDirs *pb = pb_subdirs[pb_subdir]; const ProStringList &subdirs = pb->project->values("SUBDIRS"); - for(int subdir = 0; subdir < subdirs.count(); subdir++) { + for(int subdir = 0; subdir < subdirs.size(); subdir++) { ProString tmpk = subdirs[subdir]; const ProKey fkey(tmpk + ".file"); if (!pb->project->isEmpty(fkey)) { @@ -354,7 +329,7 @@ ProjectBuilderMakefileGenerator::writeSubDirs(QTextStream &t) t << "\t\t\tprojectReferences = (\n"; { const ProStringList &qmake_subdirs = project->values("QMAKE_PBX_SUBDIRS"); - for(int i = 0; i < qmake_subdirs.count(); i++) { + for(int i = 0; i < qmake_subdirs.size(); i++) { const ProString &subdir = qmake_subdirs[i]; t << "\t\t\t\t{\n" << "\t\t\t\t\t" << writeSettings("ProductGroup", keyFor(subdir + "_PRODUCTGROUP")) << ";\n" @@ -454,17 +429,17 @@ ProjectBuilderSources::files(QMakeProject *project) const static QString xcodeFiletypeForFilename(const QString &filename) { - for (const QString &ext : qAsConst(Option::cpp_ext)) { + for (const QString &ext : std::as_const(Option::cpp_ext)) { if (filename.endsWith(ext)) return QStringLiteral("sourcecode.cpp.cpp"); } - for (const QString &ext : qAsConst(Option::c_ext)) { + for (const QString &ext : std::as_const(Option::c_ext)) { if (filename.endsWith(ext)) return QStringLiteral("sourcecode.c.c"); } - for (const QString &ext : qAsConst(Option::h_ext)) { + for (const QString &ext : std::as_const(Option::h_ext)) { if (filename.endsWith(ext)) return "sourcecode.c.h"; } @@ -549,14 +524,14 @@ bool ProjectBuilderMakefileGenerator::replaceLibrarySuffix(const QString &lib_fi warn_msg(WarnLogic, "Failed to find expected suffix '%s' for library '%s'.", qPrintable(librarySuffix), qPrintable(library)); } else { - library.replace(pos, librarySuffix.length(), suffixSetting); + library.replace(pos, librarySuffix.size(), suffixSetting); if (name.endsWith(librarySuffix)) - name.chop(librarySuffix.length()); + name.chop(librarySuffix.size()); } } else { int pos = library.lastIndexOf(name); if (pos != -1) - library.insert(pos + name.length(), suffixSetting); + library.insert(pos + name.size(), suffixSetting); } } } @@ -683,7 +658,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) const QStringList &files = fileFixify(sources.at(source).files(project), FileFixifyFromOutdir | FileFixifyAbsolute); - for(int f = 0; f < files.count(); ++f) { + for(int f = 0; f < files.size(); ++f) { QString file = files[f]; if(!sources.at(source).compilerName().isNull() && !verifyExtraCompiler(sources.at(source).compilerName(), file)) @@ -898,7 +873,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr }; for (int i = 0; libs[i]; i++) { tmp = project->values(libs[i]); - for(int x = 0; x < tmp.count();) { + for(int x = 0; x < tmp.size();) { bool libSuffixReplaced = false; bool remove = false; QString library, name; @@ -937,7 +912,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if(opt.size() > 2) { r = opt.mid(2).toQString(); } else { - if(x == tmp.count()-1) + if(x == tmp.size()-1) break; r = tmp[++x].toQString(); } @@ -946,12 +921,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) frameworkdirs.append(r); } } else if(opt == "-framework") { - if(x == tmp.count()-1) + if(x == tmp.size()-1) break; const ProString &framework = tmp[x+1]; ProStringList fdirs = frameworkdirs; fdirs << "/System/Library/Frameworks/" << "/Library/Frameworks/"; - for(int fdir = 0; fdir < fdirs.count(); fdir++) { + for(int fdir = 0; fdir < fdirs.size(); fdir++) { if(exists(fdirs[fdir] + QDir::separator() + framework + ".framework")) { remove = true; library = fdirs[fdir] + Option::dir_sep + framework + ".framework"; @@ -980,7 +955,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) const int slsh = library.lastIndexOf(Option::dir_sep); if(name.isEmpty()) { if(slsh != -1) - name = library.right(library.length() - slsh - 1); + name = library.right(library.size() - slsh - 1); } if(slsh != -1) { const QString path = QFileInfo(library.left(slsh)).absoluteFilePath(); @@ -1033,12 +1008,12 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) mkt << "SUBLIBS= "; // ### This is missing the parametrization found in unixmake2.cpp tmp = project->values("SUBLIBS"); - for(int i = 0; i < tmp.count(); i++) + for(int i = 0; i < tmp.size(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") << ' '; t << Qt::endl << Qt::endl; mkt << "sublibs: $(SUBLIBS)\n\n"; tmp = project->values("SUBLIBS"); - for(int i = 0; i < tmp.count(); i++) + for(int i = 0; i < tmp.size(); i++) t << escapeFilePath("tmp/lib" + tmp[i] + ".a") + ":\n\t" << var(ProKey("MAKELIB" + tmp[i])) << Qt::endl << Qt::endl; mkt.flush(); @@ -1173,7 +1148,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //all bundle data const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); - for(int i = 0; i < bundle_data.count(); i++) { + for(int i = 0; i < bundle_data.size(); i++) { ProStringList bundle_files; ProString path = project->first(ProKey(bundle_data[i] + ".path")); const bool isEmbeddedFramework = ((!osx && path == QLatin1String("Frameworks")) @@ -1183,7 +1158,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) //all files const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files")); - for(int file = 0; file < files.count(); file++) { + for(int file = 0; file < files.size(); file++) { QString fn = fileFixify(files[file].toQString(), FileFixifyAbsolute); QString name = fn.split(Option::dir_sep).back(); QString file_ref_key = keyFor("QMAKE_PBX_BUNDLE_DATA_FILE_REF." + bundle_data[i] + "-" + fn); @@ -1206,13 +1181,13 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if (copyBundleResources && ((!osx && path.isEmpty()) || (osx && path == QLatin1String("Contents/Resources")))) { - for (const ProString &s : qAsConst(bundle_files)) + for (const ProString &s : std::as_const(bundle_files)) bundle_resources_files << s; } else if (copyBundleResources && isEmbeddedFramework) { - for (const ProString &s : qAsConst(bundle_files)) + for (const ProString &s : std::as_const(bundle_files)) embedded_frameworks << s; } else if (copyBundleResources && isEmbeddedPlugin) { - for (const ProString &s : qAsConst(bundle_files)) { + for (const ProString &s : std::as_const(bundle_files)) { ProString subpath = (path == pluginsPrefix) ? ProString() : path.mid(pluginsPrefix.size() + 1); embedded_plugins[subpath] << s; } @@ -1709,7 +1684,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t\t\t" << writeSettings("CODE_SIGN_IDENTITY", project->first("QMAKE_XCODE_CODE_SIGN_IDENTITY")) << ";\n"; tmp = project->values("QMAKE_PBX_VARS"); - for (int i = 0; i < tmp.count(); i++) { + for (int i = 0; i < tmp.size(); i++) { QString var = tmp[i].toQString(), val = QString::fromLocal8Bit(qgetenv(var.toLatin1().constData())); if (val.isEmpty() && var == "TB") val = "/usr/bin/"; @@ -1913,7 +1888,7 @@ ProStringList ProjectBuilderMakefileGenerator::fixListForOutput(const ProStringList &l) { ProStringList ret; - for(int i = 0; i < l.count(); i++) + for(int i = 0; i < l.size(); i++) ret += fixForOutput(l[i].toQString()); return ret; } @@ -1995,14 +1970,14 @@ ProjectBuilderMakefileGenerator::pbxbuild() static QString quotedStringLiteral(const QString &value) { QString result; - const int len = value.length(); + const int len = value.size(); result.reserve(int(len * 1.1) + 2); result += QLatin1Char('"'); // Escape for (int i = 0; i < len; ++i) { - QChar character = value.at(i);; + QChar character = value.at(i); ushort code = character.unicode(); switch (code) { case '\\': |