diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-01-30 12:33:51 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-03-29 15:05:25 +0000 |
commit | 8d49df2172aaffaf49fbad0bc4d522d34662b583 (patch) | |
tree | bac6b0a7b71781ccb2339e37774c8ee1258869bf /src/corelib/tools/qlocale.h | |
parent | 46351b4e601ee0e87c4a8467785c1e5718565190 (diff) |
QLocale: add QStringView overload of number parsing functions
This ports all to<Integer>() functions in QLocale to QStringView.
Change-Id: Idc3f026d5afdf51abab670b54ea96d2361cdc350
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/tools/qlocale.h')
-rw-r--r-- | src/corelib/tools/qlocale.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h index bd89e48234..1f20bcd241 100644 --- a/src/corelib/tools/qlocale.h +++ b/src/corelib/tools/qlocale.h @@ -935,6 +935,7 @@ public: QString nativeLanguageName() const; QString nativeCountryName() const; +#if QT_STRINGVIEW_LEVEL < 2 short toShort(const QString &s, bool *ok = Q_NULLPTR) const; ushort toUShort(const QString &s, bool *ok = Q_NULLPTR) const; int toInt(const QString &s, bool *ok = Q_NULLPTR) const; @@ -952,6 +953,16 @@ public: qulonglong toULongLong(const QStringRef &s, bool *ok = Q_NULLPTR) const; float toFloat(const QStringRef &s, bool *ok = Q_NULLPTR) const; double toDouble(const QStringRef &s, bool *ok = Q_NULLPTR) const; +#endif + + short toShort(QStringView s, bool *ok = nullptr) const; + ushort toUShort(QStringView s, bool *ok = nullptr) const; + int toInt(QStringView s, bool *ok = nullptr) const; + uint toUInt(QStringView s, bool *ok = nullptr) const; + qlonglong toLongLong(QStringView s, bool *ok = nullptr) const; + qulonglong toULongLong(QStringView s, bool *ok = nullptr) const; + float toFloat(QStringView s, bool *ok = nullptr) const; + double toDouble(QStringView s, bool *ok = nullptr) const; QString toString(qlonglong i) const; QString toString(qulonglong i) const; |