}
/*!
- Returns the short int represented by the localized string \a s,
- using base \a base. If \a base is 0 the base is determined
- automatically using the following rules: If the string begins with
- "0x", it is assumed to be hexadecimal; if it begins with "0", it
- is assumed to be octal; otherwise it is assumed to be decimal.
+ Returns the short int represented by the localized string \a s.
If the conversion fails the function returns 0.
\sa toUShort(), toString()
*/
-short QLocale::toShort(const QString &s, bool *ok, int base) const
+short QLocale::toShort(const QString &s, bool *ok) const
{
- qlonglong i = toLongLong(s, ok, base);
+ qlonglong i = toLongLong(s, ok);
if (i < SHRT_MIN || i > SHRT_MAX) {
if (ok != 0)
*ok = false;
}
/*!
- Returns the unsigned short int represented by the localized string
- \a s, using base \a base. If \a base is 0 the base is determined
- automatically using the following rules: If the string begins with
- "0x", it is assumed to be hexadecimal; if it begins with "0", it
- is assumed to be octal; otherwise it is assumed to be decimal.
+ Returns the unsigned short int represented by the localized string \a s.
If the conversion fails the function returns 0.
\sa toShort(), toString()
*/
-ushort QLocale::toUShort(const QString &s, bool *ok, int base) const
+ushort QLocale::toUShort(const QString &s, bool *ok) const
{
- qulonglong i = toULongLong(s, ok, base);
+ qulonglong i = toULongLong(s, ok);
if (i > USHRT_MAX) {
if (ok != 0)
*ok = false;
}
/*!
- Returns the int represented by the localized string \a s, using
- base \a base. If \a base is 0 the base is determined automatically
- using the following rules: If the string begins with "0x", it is
- assumed to be hexadecimal; if it begins with "0", it is assumed to
- be octal; otherwise it is assumed to be decimal.
+ Returns the int represented by the localized string \a s.
If the conversion fails the function returns 0.
\sa toUInt(), toString()
*/
-int QLocale::toInt(const QString &s, bool *ok, int base) const
+int QLocale::toInt(const QString &s, bool *ok) const
{
- qlonglong i = toLongLong(s, ok, base);
+ qlonglong i = toLongLong(s, ok);
if (i < INT_MIN || i > INT_MAX) {
if (ok != 0)
*ok = false;
}
/*!
- Returns the unsigned int represented by the localized string \a s,
- using base \a base. If \a base is 0 the base is determined
- automatically using the following rules: If the string begins with
- "0x", it is assumed to be hexadecimal; if it begins with "0", it
- is assumed to be octal; otherwise it is assumed to be decimal.
+ Returns the unsigned int represented by the localized string \a s.
If the conversion fails the function returns 0.
\sa toInt(), toString()
*/
-uint QLocale::toUInt(const QString &s, bool *ok, int base) const
+uint QLocale::toUInt(const QString &s, bool *ok) const
{
- qulonglong i = toULongLong(s, ok, base);
+ qulonglong i = toULongLong(s, ok);
if (i > UINT_MAX) {
if (ok != 0)
*ok = false;
}
/*!
- Returns the long long int represented by the localized string \a
- s, using base \a base. If \a base is 0 the base is determined
- automatically using the following rules: If the string begins with
- "0x", it is assumed to be hexadecimal; if it begins with "0", it
- is assumed to be octal; otherwise it is assumed to be decimal.
+ Returns the long long int represented by the localized string \a s.
If the conversion fails the function returns 0.
*/
-qlonglong QLocale::toLongLong(const QString &s, bool *ok, int base) const
+qlonglong QLocale::toLongLong(const QString &s, bool *ok) const
{
QLocalePrivate::GroupSeparatorMode mode
= p.numberOptions & RejectGroupSeparator
? QLocalePrivate::FailOnGroupSeparators
: QLocalePrivate::ParseGroupSeparators;
- return d()->stringToLongLong(s, base, ok, mode);
+ return d()->stringToLongLong(s, 10, ok, mode);
}
// ### Qt5: make the return type for toULongLong() qulonglong.
/*!
Returns the unsigned long long int represented by the localized
- string \a s, using base \a base. If \a base is 0 the base is
- determined automatically using the following rules: If the string
- begins with "0x", it is assumed to be hexadecimal; if it begins
- with "0", it is assumed to be octal; otherwise it is assumed to be
- decimal.
+ string \a s.
If the conversion fails the function returns 0.
\sa toLongLong(), toInt(), toDouble(), toString()
*/
-qlonglong QLocale::toULongLong(const QString &s, bool *ok, int base) const
+qlonglong QLocale::toULongLong(const QString &s, bool *ok) const
{
QLocalePrivate::GroupSeparatorMode mode
= p.numberOptions & RejectGroupSeparator
? QLocalePrivate::FailOnGroupSeparators
: QLocalePrivate::ParseGroupSeparators;
- return d()->stringToUnsLongLong(s, base, ok, mode);
+ return d()->stringToUnsLongLong(s, 10, ok, mode);
}
/*!
QString nativeLanguageName() const;
QString nativeCountryName() const;
- short toShort(const QString &s, bool *ok = 0, int base = 0) const;
- ushort toUShort(const QString &s, bool *ok = 0, int base = 0) const;
- int toInt(const QString &s, bool *ok = 0, int base = 0) const;
- uint toUInt(const QString &s, bool *ok = 0, int base = 0) const;
- qlonglong toLongLong(const QString &s, bool *ok = 0, int base = 0) const;
- qlonglong toULongLong(const QString &s, bool *ok = 0, int base = 0) const;
+ short toShort(const QString &s, bool *ok = 0) const;
+ ushort toUShort(const QString &s, bool *ok = 0) const;
+ int toInt(const QString &s, bool *ok = 0) const;
+ uint toUInt(const QString &s, bool *ok = 0) const;
+ qlonglong toLongLong(const QString &s, bool *ok = 0) const;
+ qlonglong toULongLong(const QString &s, bool *ok = 0) const;
float toFloat(const QString &s, bool *ok = 0) const;
double toDouble(const QString &s, bool *ok = 0) const;