summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-08-13 15:24:50 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-08-28 21:29:18 +0200
commit34a095848d946d11d367ff9fcbfc26b6b26c7507 (patch)
tree62525acd4ba7068015fcd8c5d7def527773ad12e /src/corelib
parent0d11a92af9003c8c68a5e0fca40c8e94ae34cbce (diff)
Inline QString's conversions to integral types, except long long ones
As requested by a ### Qt6 comment. Task-number: QTBUG-85700 Change-Id: I7c2813c0d8fbc38bcd2f7229de3a9d8e1b8b1f03 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/text/qstring.cpp38
-rw-r--r--src/corelib/text/qstring.h19
2 files changed, 18 insertions, 39 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 24859b6e7a..d0fc3e071f 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -6678,11 +6678,6 @@ qulonglong QString::toIntegral_helper(QStringView string, bool *ok, uint base)
\sa number(), toULong(), toInt(), QLocale::toInt()
*/
-long QString::toLong(bool *ok, int base) const
-{
- return toIntegral_helper<long>(*this, ok, base);
-}
-
/*!
\fn ulong QString::toULong(bool *ok, int base) const
@@ -6709,13 +6704,8 @@ long QString::toLong(bool *ok, int base) const
\sa number(), QLocale::toUInt()
*/
-ulong QString::toULong(bool *ok, int base) const
-{
- return toIntegral_helper<ulong>(*this, ok, base);
-}
-
-
/*!
+ \fn int QString::toInt(bool *ok, int base) const
Returns the string converted to an \c int using base \a
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
@@ -6739,12 +6729,8 @@ ulong QString::toULong(bool *ok, int base) const
\sa number(), toUInt(), toDouble(), QLocale::toInt()
*/
-int QString::toInt(bool *ok, int base) const
-{
- return toIntegral_helper<int>(*this, ok, base);
-}
-
/*!
+ \fn uint QString::toUInt(bool *ok, int base) const
Returns the string converted to an \c{unsigned int} using base \a
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
@@ -6768,12 +6754,9 @@ int QString::toInt(bool *ok, int base) const
\sa number(), toInt(), QLocale::toUInt()
*/
-uint QString::toUInt(bool *ok, int base) const
-{
- return toIntegral_helper<uint>(*this, ok, base);
-}
-
/*!
+ \fn short QString::toShort(bool *ok, int base) const
+
Returns the string converted to a \c short using base \a
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
@@ -6797,12 +6780,9 @@ uint QString::toUInt(bool *ok, int base) const
\sa number(), toUShort(), toInt(), QLocale::toShort()
*/
-short QString::toShort(bool *ok, int base) const
-{
- return toIntegral_helper<short>(*this, ok, base);
-}
-
/*!
+ \fn ushort QString::toUShort(bool *ok, int base) const
+
Returns the string converted to an \c{unsigned short} using base \a
base, which is 10 by default and must be between 2 and 36, or 0.
Returns 0 if the conversion fails.
@@ -6826,12 +6806,6 @@ short QString::toShort(bool *ok, int base) const
\sa number(), toShort(), QLocale::toUShort()
*/
-ushort QString::toUShort(bool *ok, int base) const
-{
- return toIntegral_helper<ushort>(*this, ok, base);
-}
-
-
/*!
Returns the string converted to a \c double value.
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index 6456c088bb..a8a1211ff5 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -712,13 +712,18 @@ public:
static int localeAwareCompare(QStringView s1, QStringView s2);
- // ### Qt6: make inline except for the long long versions
- short toShort(bool *ok=nullptr, int base=10) const;
- ushort toUShort(bool *ok=nullptr, int base=10) const;
- int toInt(bool *ok=nullptr, int base=10) const;
- uint toUInt(bool *ok=nullptr, int base=10) const;
- long toLong(bool *ok=nullptr, int base=10) const;
- ulong toULong(bool *ok=nullptr, int base=10) const;
+ short toShort(bool *ok=nullptr, int base=10) const
+ { return toIntegral_helper<short>(*this, ok, base); }
+ ushort toUShort(bool *ok=nullptr, int base=10) const
+ { return toIntegral_helper<ushort>(*this, ok, base); }
+ int toInt(bool *ok=nullptr, int base=10) const
+ { return toIntegral_helper<int>(*this, ok, base); }
+ uint toUInt(bool *ok=nullptr, int base=10) const
+ { return toIntegral_helper<uint>(*this, ok, base); }
+ long toLong(bool *ok=nullptr, int base=10) const
+ { return toIntegral_helper<long>(*this, ok, base); }
+ ulong toULong(bool *ok=nullptr, int base=10) const
+ { return toIntegral_helper<ulong>(*this, ok, base); }
qlonglong toLongLong(bool *ok=nullptr, int base=10) const;
qulonglong toULongLong(bool *ok=nullptr, int base=10) const;
float toFloat(bool *ok=nullptr) const;