summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.h
diff options
context:
space:
mode:
authorKeith Gardner <kreios4004@gmail.com>2012-12-28 16:35:39 -0600
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-22 21:23:33 +0100
commit3b5600f6ee9f2982c5a93250e577f87a34fe32d1 (patch)
tree9d3bcfa252d9a6b522a93c0944807c566bb50cb5 /src/corelib/tools/qstring.h
parent736e4258a10c1df8dd5e4a5170fbc1a7d6e5588f (diff)
QStringRef: Added toInt(), toUInt(), etc... functions to QStringRef.
Added the following functions to QStringRef: toShort, toUShort, toInt, toUInt, toLong, toULong, toLongLong, toULongLong, toFloat, and toDouble. These functions use the corresponding functions found in QLocale. Updated tst_qstringref.cpp to exercise the new functionality. Change-Id: I38668a0cc7da0c101a62613fd16cb5a98286617f Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qstring.h')
-rw-r--r--src/corelib/tools/qstring.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 9cde603c0b..d152e6795e 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -1279,6 +1279,16 @@ public:
static int localeAwareCompare(const QStringRef &s1, const QStringRef &s2);
QStringRef trimmed() const Q_REQUIRED_RESULT;
+ short toShort(bool *ok = 0, int base = 10) const;
+ ushort toUShort(bool *ok = 0, int base = 10) const;
+ int toInt(bool *ok = 0, int base = 10) const;
+ uint toUInt(bool *ok = 0, int base = 10) const;
+ long toLong(bool *ok = 0, int base = 10) const;
+ ulong toULong(bool *ok = 0, int base = 10) const;
+ qlonglong toLongLong(bool *ok = 0, int base = 10) const;
+ qulonglong toULongLong(bool *ok = 0, int base = 10) const;
+ float toFloat(bool *ok = 0) const;
+ double toDouble(bool *ok = 0) const;
};
Q_DECLARE_TYPEINFO(QStringRef, Q_PRIMITIVE_TYPE);