Move toString calls after their definition

Move two functions that are using toString(const QString &str) from
qtestcase.h to qtest.h. This fixes compilation on INTEGRITY platform.

Task-number: QTBUG-61702
Change-Id: I5a433126741c7a52621616c5b98203e7d642b330
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Timo Aarnipuro 2017-07-20 16:14:08 +03:00
parent 8418a6335b
commit 5cae29ffc7
2 changed files with 18 additions and 12 deletions

View File

@ -199,6 +199,22 @@ template<> inline char *toString(const QVariant &v)
return qstrdup(vstring.constData());
}
template <typename T1, typename T2>
inline char *toString(const QPair<T1, T2> &pair)
{
const QScopedArrayPointer<char> first(toString(pair.first));
const QScopedArrayPointer<char> second(toString(pair.second));
return toString(QString::asprintf("QPair(%s,%s)", first.data(), second.data()));
}
template <typename T1, typename T2>
inline char *toString(const std::pair<T1, T2> &pair)
{
const QScopedArrayPointer<char> first(toString(pair.first));
const QScopedArrayPointer<char> second(toString(pair.second));
return toString(QString::asprintf("std::pair(%s,%s)", first.data(), second.data()));
}
inline char *toString(std::nullptr_t)
{
return toString(QLatin1String("nullptr"));

View File

@ -260,20 +260,10 @@ namespace QTest
}
template <typename T1, typename T2>
inline char *toString(const QPair<T1, T2> &pair)
{
const QScopedArrayPointer<char> first(toString(pair.first));
const QScopedArrayPointer<char> second(toString(pair.second));
return toString(QString::asprintf("QPair(%s,%s)", first.data(), second.data()));
}
inline char *toString(const QPair<T1, T2> &pair);
template <typename T1, typename T2>
inline char *toString(const std::pair<T1, T2> &pair)
{
const QScopedArrayPointer<char> first(toString(pair.first));
const QScopedArrayPointer<char> second(toString(pair.second));
return toString(QString::asprintf("std::pair(%s,%s)", first.data(), second.data()));
}
inline char *toString(const std::pair<T1, T2> &pair);
Q_TESTLIB_EXPORT char *toHexRepresentation(const char *ba, int length);
Q_TESTLIB_EXPORT char *toPrettyCString(const char *unicode, int length);