diff options
Diffstat (limited to 'src/corelib/tools/qlocale.cpp')
-rw-r--r-- | src/corelib/tools/qlocale.cpp | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index b3fb079342..ebb6c97975 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -1333,6 +1333,48 @@ uint QLocale::toUInt(const QString &s, bool *ok) const } /*! + Returns the long int represented by the localized string \a s. + + If the conversion fails the function returns 0. + + If \a ok is not \c 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 QString &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 \c 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 QString &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. @@ -1500,6 +1542,48 @@ uint QLocale::toUInt(const QStringRef &s, bool *ok) const } /*! + Returns the long int represented by the localized string \a s. + + If the conversion fails the function returns 0. + + If \a ok is not \c 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 \c 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. @@ -1676,6 +1760,48 @@ uint QLocale::toUInt(QStringView s, bool *ok) const } /*! + Returns the long int represented by the localized string \a s. + + If the conversion fails the function returns 0. + + If \a ok is not \c 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(QStringView 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 \c 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(QStringView 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. |