QString: mark inline to{U,}LongLong() for inlining in Qt 7

The original implementation of the toIntegral_helper() called these two
functions, before we added the out-of-line non-template
toIntegral_helper() overloads taking QStringView for Qt 5.15 in commit
f1cbc3c9d2. They should have been inlined
in Qt 6.0, but no one noticed this.

Change-Id: Id8e48e8f498c4a029619fffd172795aaba2d815b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2022-11-14 14:56:14 -08:00
parent 85a1663eb1
commit 30c491f3b2
3 changed files with 21 additions and 11 deletions

View File

@ -365,4 +365,7 @@ void QXmlStreamReader::addData(const char *data)
#endif // QT_CONFIG(xmlstreamreader)
// inlined API
#include "qstring.h"
#endif // QT_CORE_REMOVED_SINCE(6, 5)

View File

@ -7158,6 +7158,8 @@ QString QString::vasprintf(const char *cformat, va_list ap)
}
/*!
\fn QString::toLongLong(bool *ok, int base) const
Returns the string converted to a \c{long long} using base \a
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
@ -7184,11 +7186,6 @@ QString QString::vasprintf(const char *cformat, va_list ap)
\sa number(), toULongLong(), toInt(), QLocale::toLongLong()
*/
qint64 QString::toLongLong(bool *ok, int base) const
{
return toIntegral_helper<qlonglong>(*this, ok, base);
}
qlonglong QString::toIntegral_helper(QStringView string, bool *ok, int base)
{
#if defined(QT_CHECK_RANGE)
@ -7203,8 +7200,9 @@ qlonglong QString::toIntegral_helper(QStringView string, bool *ok, int base)
return QLocaleData::bytearrayToLongLong(latin1, base, ok);
}
/*!
\fn QString::toULongLong(bool *ok, int base) const
Returns the string converted to an \c{unsigned long long} using base \a
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
@ -7231,11 +7229,6 @@ qlonglong QString::toIntegral_helper(QStringView string, bool *ok, int base)
\sa number(), toLongLong(), QLocale::toULongLong()
*/
quint64 QString::toULongLong(bool *ok, int base) const
{
return toIntegral_helper<qulonglong>(*this, ok, base);
}
qulonglong QString::toIntegral_helper(QStringView string, bool *ok, uint base)
{
#if defined(QT_CHECK_RANGE)

View File

@ -882,7 +882,9 @@ public:
{ return toIntegral_helper<long>(*this, ok, base); }
ulong toULong(bool *ok=nullptr, int base=10) const
{ return toIntegral_helper<ulong>(*this, ok, base); }
QT_CORE_INLINE_SINCE(6, 5)
qlonglong toLongLong(bool *ok=nullptr, int base=10) const;
QT_CORE_INLINE_SINCE(6, 5)
qulonglong toULongLong(bool *ok=nullptr, int base=10) const;
float toFloat(bool *ok=nullptr) const;
double toDouble(bool *ok=nullptr) const;
@ -1527,6 +1529,18 @@ inline int QString::localeAwareCompare(QStringView s1, QStringView s2)
inline int QStringView::localeAwareCompare(QStringView other) const
{ return QString::localeAwareCompare(*this, other); }
#if QT_CORE_INLINE_IMPL_SINCE(6, 5)
qint64 QString::toLongLong(bool *ok, int base) const
{
return toIntegral_helper<qlonglong>(*this, ok, base);
}
quint64 QString::toULongLong(bool *ok, int base) const
{
return toIntegral_helper<qulonglong>(*this, ok, base);
}
#endif
namespace QtPrivate {
// used by qPrintable() and qUtf8Printable() macros
inline const QString &asString(const QString &s) { return s; }