diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-13 15:24:50 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-08-28 21:29:18 +0200 |
commit | 34a095848d946d11d367ff9fcbfc26b6b26c7507 (patch) | |
tree | 62525acd4ba7068015fcd8c5d7def527773ad12e /src/corelib/text/qstring.h | |
parent | 0d11a92af9003c8c68a5e0fca40c8e94ae34cbce (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/text/qstring.h')
-rw-r--r-- | src/corelib/text/qstring.h | 19 |
1 files changed, 12 insertions, 7 deletions
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; |