Utils: Collapse most of porting,h

Taking the Qt 6 branches, leaving some dummies until downstream
adapted.

Change-Id: Ib9b86568d73c341c8f740ba497c3cbfab830d8a1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
hjk
2022-07-13 09:27:18 +02:00
parent 480da99508
commit 802de0eb5e
82 changed files with 206 additions and 256 deletions

View File

@@ -37,8 +37,6 @@
// initializer_list related code on the templates inside algorithm.h
#include <utils/algorithm.h>
#include <utils/porting.h>
class tst_Algorithm : public QObject
{
Q_OBJECT
@@ -114,8 +112,8 @@ void tst_Algorithm::transform()
QCOMPARE(i1, QList<int>({1, 3, 132}));
const QList<int> i2 = Utils::transform(strings, stringToInt);
QCOMPARE(i2, QList<int>({1, 3, 132}));
const QList<Utils::QtSizeType> i3 = Utils::transform(strings, &QString::size);
QCOMPARE(i3, QList<Utils::QtSizeType>({1, 1, 3}));
const QList<qsizetype> i3 = Utils::transform(strings, &QString::size);
QCOMPARE(i3, QList<qsizetype>({1, 1, 3}));
}
{
// QStringList
@@ -124,8 +122,8 @@ void tst_Algorithm::transform()
QCOMPARE(i1, QList<int>({1, 3, 132}));
const QList<int> i2 = Utils::transform(strings, stringToInt);
QCOMPARE(i2, QList<int>({1, 3, 132}));
const QList<Utils::QtSizeType> i3 = Utils::transform(strings, &QString::size);
QCOMPARE(i3, QList<Utils::QtSizeType>({1, 1, 3}));
const QList<qsizetype> i3 = Utils::transform(strings, &QString::size);
QCOMPARE(i3, QList<qsizetype>({1, 1, 3}));
}
{
// QSet internally needs special inserter
@@ -134,8 +132,8 @@ void tst_Algorithm::transform()
QCOMPARE(i1, QSet<int>({1, 3, 132}));
const QSet<int> i2 = Utils::transform(strings, stringToInt);
QCOMPARE(i2, QSet<int>({1, 3, 132}));
const QSet<Utils::QtSizeType> i3 = Utils::transform(strings, &QString::size);
QCOMPARE(i3, QSet<Utils::QtSizeType>({1, 3}));
const QSet<qsizetype> i3 = Utils::transform(strings, &QString::size);
QCOMPARE(i3, QSet<qsizetype>({1, 3}));
}
// different container types
@@ -146,8 +144,8 @@ void tst_Algorithm::transform()
QCOMPARE(i1, QSet<int>({1, 3, 132}));
const QSet<int> i2 = Utils::transform<QSet>(strings, stringToInt);
QCOMPARE(i2, QSet<int>({1, 3, 132}));
const QSet<Utils::QtSizeType> i3 = Utils::transform<QSet>(strings, &QString::size);
QCOMPARE(i3, QSet<Utils::QtSizeType>({1, 3}));
const QSet<qsizetype> i3 = Utils::transform<QSet>(strings, &QString::size);
QCOMPARE(i3, QSet<qsizetype>({1, 3}));
}
{
// QStringList to QSet
@@ -156,8 +154,8 @@ void tst_Algorithm::transform()
QCOMPARE(i1, QSet<int>({1, 3, 132}));
const QSet<int> i2 = Utils::transform<QSet>(strings, stringToInt);
QCOMPARE(i2, QSet<int>({1, 3, 132}));
const QSet<Utils::QtSizeType> i3 = Utils::transform<QSet>(strings, &QString::size);
QCOMPARE(i3, QSet<Utils::QtSizeType>({1, 3}));
const QSet<qsizetype> i3 = Utils::transform<QSet>(strings, &QString::size);
QCOMPARE(i3, QSet<qsizetype>({1, 3}));
}
{
// QSet to QList
@@ -168,9 +166,9 @@ void tst_Algorithm::transform()
QList<int> i2 = Utils::transform<QList>(strings, stringToInt);
Utils::sort(i2);
QCOMPARE(i2, QList<int>({1, 3, 132}));
QList<Utils::QtSizeType> i3 = Utils::transform<QList>(strings, &QString::size);
QList<qsizetype> i3 = Utils::transform<QList>(strings, &QString::size);
Utils::sort(i3);
QCOMPARE(i3, QList<Utils::QtSizeType>({1, 1, 3}));
QCOMPARE(i3, QList<qsizetype>({1, 1, 3}));
}
{
const QList<Struct> list({4, 3, 2, 1, 2});