Eradicate the last Q_FOREACHs and mark the module free of them ... again

Restores the QT_NO_FOREACH define lost by the removal of .qmake.conf
in 21136bf84c.

The instances in the big5 utility are all over local variables, and
they clearly don't modify the container being iterateed over. Add
std::as_const() to avoid hidden detach()es. Replace two loops with
QByteArrayList::join().

Change-Id: If01bc667f019da0dbce99d84db5832067c5d936d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2023-08-03 21:32:05 +02:00
parent c2eb2c80b8
commit 39c96faa2c
2 changed files with 5 additions and 10 deletions

View File

@ -2,3 +2,4 @@ set(QT_REPO_MODULE_VERSION "6.7.0")
set(QT_REPO_MODULE_PRERELEASE_VERSION_SEGMENT "alpha1")
set(QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_LEAN_HEADERS=1")
list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_AS_CONST=1")
list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_FOREACH=1")

View File

@ -98,23 +98,17 @@ int main(int argc, char **argv)
};
QList<QByteArray> list;
foreach(Map m, b5_to_uc_map) {
for (Map m : std::as_const(b5_to_uc_map)) {
if (!uc_ok.contains(m.b5))
list += QByteArray(" { 0x" + QByteArray::number(m.b5, 16) + ", 0x" + QByteArray::number(m.uc, 16) + " }\n");;
}
QByteArray ba;
std::sort(list.begin(), list.end());
foreach(QByteArray a, list)
ba += a;
qDebug() << "struct B5Map b5_to_uc_map = {\n" << ba + "\n};";
qDebug() << "struct B5Map b5_to_uc_map = {\n" << list.join() + "\n};";
list = QList<QByteArray>();
foreach(Map m, uc_to_b5_map)
for (Map m : std::as_const(uc_to_b5_map))
if (!b5_ok.contains(m.uc))
list += QByteArray(" { 0x" + QByteArray::number(m.uc, 16) + ", 0x" + QByteArray::number(m.b5, 16) + " }\n");;
ba = QByteArray();
std::sort(list.begin(), list.end());;
foreach(QByteArray a, list)
ba += a;
qDebug() << "struct B5Map uc_to_b5_map = {\n" << ba + "\n};";
qDebug() << "struct B5Map uc_to_b5_map = {\n" << list.join() + "\n};";
}