tst_QString: clean up

- add Q_DECLARE_TYPEINFO for types held in Qt containers (incl. QVariant)
- port Q_FOREACH to C++11 range-for
- port uses of inefficient QLists to QVector

Fixes errors pointed out by my tree's static checks.

Change-Id: I7176b4b12ed47ed23166857bd127c459ea2a48d5
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
Marc Mutz 2016-08-05 10:04:11 +03:00
parent af5ccb7f8c
commit e6f5a7d6c0

View File

@ -84,11 +84,11 @@ public:
template <typename MemFun>
void apply0(QString &s, MemFun mf) const
{ Q_FOREACH (QChar ch, this->pinned) (s.*mf)(ch); }
{ for (QChar ch : qAsConst(this->pinned)) (s.*mf)(ch); }
template <typename MemFun, typename A1>
void apply1(QString &s, MemFun mf, A1 a1) const
{ Q_FOREACH (QChar ch, this->pinned) (s.*mf)(a1, ch); }
{ for (QChar ch : qAsConst(this->pinned)) (s.*mf)(a1, ch); }
};
template <>
@ -254,6 +254,9 @@ public:
};
} // unnamed namespace
QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(CharStarContainer, Q_PRIMITIVE_TYPE);
QT_END_NAMESPACE
Q_DECLARE_METATYPE(CharStarContainer)
@ -643,7 +646,7 @@ QString verifyZeroTermination(const QString &str)
} while (0) \
/**/
typedef QList<int> IntList;
typedef QVector<int> IntList;
tst_QString::tst_QString()
{