diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-05-22 14:24:01 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-06-11 15:52:25 +0200 |
commit | 39e229fe13a2112dcc5d033f4535fd019aab800b (patch) | |
tree | 42ab8a99c397e22b78cbbec4b2c2346e275fb51e /src/corelib/text | |
parent | 8ea11e0cf7f442f687089ffdf54de1f7540cb20b (diff) |
Remove more QStringRef overloads that aren't required
The QStringView versions will do the job just fine :)
Task-number: QTBUG-84319
Change-Id: I376b310deb27683fd98bbcc55e0f56014cacecc3
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/corelib/text')
-rw-r--r-- | src/corelib/text/qcollator.cpp | 13 | ||||
-rw-r--r-- | src/corelib/text/qcollator.h | 1 | ||||
-rw-r--r-- | src/corelib/text/qlocale.cpp | 217 | ||||
-rw-r--r-- | src/corelib/text/qlocale.h | 11 |
4 files changed, 0 insertions, 242 deletions
diff --git a/src/corelib/text/qcollator.cpp b/src/corelib/text/qcollator.cpp index 958216bde8..4bef356044 100644 --- a/src/corelib/text/qcollator.cpp +++ b/src/corelib/text/qcollator.cpp @@ -329,19 +329,6 @@ int QCollator::compare(const QString &s1, const QString &s2) const /*! \overload - Compares \a s1 with \a s2. - - Returns an integer less than, equal to, or greater than zero depending on - whether \a s1 sorts before, with or after \a s2. - */ -int QCollator::compare(const QStringRef &s1, const QStringRef &s2) const -{ - return compare(QStringView(s1), QStringView(s2)); -} - -/*! - \overload - Compares \a s1 with \a s2. \a len1 and \a len2 specify the lengths of the QChar arrays pointed to by \a s1 and \a s2. diff --git a/src/corelib/text/qcollator.h b/src/corelib/text/qcollator.h index 6bb5038371..de8c8b7e3c 100644 --- a/src/corelib/text/qcollator.h +++ b/src/corelib/text/qcollator.h @@ -108,7 +108,6 @@ public: #if QT_STRINGVIEW_LEVEL < 2 int compare(const QString &s1, const QString &s2) const; - int compare(const QStringRef &s1, const QStringRef &s2) const; int compare(const QChar *s1, int len1, const QChar *s2, int len2) const; bool operator()(const QString &s1, const QString &s2) const diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index a2cf2caec0..8217641aa3 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -1582,223 +1582,6 @@ double QLocale::toDouble(const QString &s, bool *ok) const { return d->m_data->stringToDouble(s, ok, d->m_numberOptions); } - -/*! - Returns the short int represented by the localized string \a s. - - If the conversion fails the function returns 0. - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function ignores leading and trailing whitespace. - - \sa toUShort(), toString() - - \since 5.1 -*/ - -short QLocale::toShort(const QStringRef &s, bool *ok) const -{ - return toIntegral_helper<short>(d, s, ok); -} - -/*! - Returns the unsigned short int represented by the localized string \a s. - - If the conversion fails the function returns 0. - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function ignores leading and trailing whitespace. - - \sa toShort(), toString() - - \since 5.1 -*/ - -ushort QLocale::toUShort(const QStringRef &s, bool *ok) const -{ - return toIntegral_helper<ushort>(d, s, ok); -} - -/*! - Returns the int represented by the localized string \a s. - - If the conversion fails the function returns 0. - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function ignores leading and trailing whitespace. - - \sa toUInt(), toString() - - \since 5.1 -*/ - -int QLocale::toInt(const QStringRef &s, bool *ok) const -{ - return toIntegral_helper<int>(d, s, ok); -} - -/*! - Returns the unsigned int represented by the localized string \a s. - - If the conversion fails the function returns 0. - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function ignores leading and trailing whitespace. - - \sa toInt(), toString() - - \since 5.1 -*/ - -uint QLocale::toUInt(const QStringRef &s, bool *ok) const -{ - return toIntegral_helper<uint>(d, s, ok); -} - -/*! - Returns the long int represented by the localized string \a s. - - If the conversion fails the function returns 0. - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function ignores leading and trailing whitespace. - - \sa toInt(), toULong(), toDouble(), toString() - - \since 5.13 - */ - - -long QLocale::toLong(const QStringRef &s, bool *ok) const -{ - return toIntegral_helper<long>(d, s, ok); -} - -/*! - Returns the unsigned long int represented by the localized - string \a s. - - If the conversion fails the function returns 0. - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function ignores leading and trailing whitespace. - - \sa toLong(), toInt(), toDouble(), toString() - - \since 5.13 - */ - -ulong QLocale::toULong(const QStringRef &s, bool *ok) const -{ - return toIntegral_helper<ulong>(d, s, ok); -} - -/*! - Returns the long long int represented by the localized string \a s. - - If the conversion fails the function returns 0. - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function ignores leading and trailing whitespace. - - \sa toInt(), toULongLong(), toDouble(), toString() - - \since 5.1 -*/ - - -qlonglong QLocale::toLongLong(const QStringRef &s, bool *ok) const -{ - return toIntegral_helper<qlonglong>(d, s, ok); -} - -/*! - Returns the unsigned long long int represented by the localized - string \a s. - - If the conversion fails the function returns 0. - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function ignores leading and trailing whitespace. - - \sa toLongLong(), toInt(), toDouble(), toString() - - \since 5.1 -*/ - -qulonglong QLocale::toULongLong(const QStringRef &s, bool *ok) const -{ - return toIntegral_helper<qulonglong>(d, s, ok); -} - -/*! - Returns the float represented by the localized string \a s. - - Returns an infinity if the conversion overflows or 0.0 if the - conversion fails for any other reason (e.g. underflow). - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function does not fall back to the 'C' locale if the string - cannot be interpreted in this locale. - - This function ignores leading and trailing whitespace. - - \sa toDouble(), toInt(), toString() - - \since 5.1 -*/ - -float QLocale::toFloat(const QStringRef &s, bool *ok) const -{ - return QLocaleData::convertDoubleToFloat(toDouble(s, ok), ok); -} - -/*! - Returns the double represented by the localized string \a s. - - Returns an infinity if the conversion overflows or 0.0 if the - conversion fails for any other reason (e.g. underflow). - - If \a ok is not \nullptr, failure is reported by setting *\a{ok} - to \c false, and success by setting *\a{ok} to \c true. - - This function does not fall back to the 'C' locale if the string - cannot be interpreted in this locale. - - \snippet code/src_corelib_text_qlocale.cpp 3 - - Notice that the last conversion returns 1234.0, because '.' is the - thousands group separator in the German locale. - - This function ignores leading and trailing whitespace. - - \sa toFloat(), toInt(), toString() - - \since 5.1 -*/ - -double QLocale::toDouble(const QStringRef &s, bool *ok) const -{ - return d->m_data->stringToDouble(s, ok, d->m_numberOptions); -} #endif // QT_STRINGVIEW_LEVEL < 2 /*! diff --git a/src/corelib/text/qlocale.h b/src/corelib/text/qlocale.h index 509e19b4ba..ee7e978e48 100644 --- a/src/corelib/text/qlocale.h +++ b/src/corelib/text/qlocale.h @@ -971,17 +971,6 @@ public: qulonglong toULongLong(const QString &s, bool *ok = nullptr) const; float toFloat(const QString &s, bool *ok = nullptr) const; double toDouble(const QString &s, bool *ok = nullptr) const; - - short toShort(const QStringRef &s, bool *ok = nullptr) const; - ushort toUShort(const QStringRef &s, bool *ok = nullptr) const; - int toInt(const QStringRef &s, bool *ok = nullptr) const; - uint toUInt(const QStringRef &s, bool *ok = nullptr) const; - long toLong(const QStringRef &s, bool *ok = nullptr) const; - ulong toULong(const QStringRef &s, bool *ok = nullptr) const; - qlonglong toLongLong(const QStringRef &s, bool *ok = nullptr) const; - qulonglong toULongLong(const QStringRef &s, bool *ok = nullptr) const; - float toFloat(const QStringRef &s, bool *ok = nullptr) const; - double toDouble(const QStringRef &s, bool *ok = nullptr) const; #endif short toShort(QStringView s, bool *ok = nullptr) const; |