summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qlocale.cpp4
-rw-r--r--src/corelib/tools/qstring.cpp4
-rw-r--r--src/corelib/tools/qstringalgorithms.h2
-rw-r--r--src/corelib/tools/qstringiterator.qdoc2
-rw-r--r--src/corelib/tools/qstringiterator_p.h2
-rw-r--r--src/corelib/tools/qstringview.cpp26
-rw-r--r--src/corelib/tools/qstringview.h40
7 files changed, 40 insertions, 40 deletions
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 723e63114d..166cbe8dee 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -576,7 +576,7 @@ int qt_repeatCount(QStringView s)
if (s.isEmpty())
return 0;
const QChar c = s.front();
- qssize_t j = 1;
+ qsizetype j = 1;
while (j < s.size() && s.at(j) == c)
++j;
return int(j);
@@ -3443,7 +3443,7 @@ bool QLocaleData::validateChars(QStringView str, NumberMode numMode, QByteArray
bool dec = false;
int decDigitCnt = 0;
- for (qssize_t i = 0; i < str.size(); ++i) {
+ for (qsizetype i = 0; i < str.size(); ++i) {
char c = digitToCLocale(str.at(i));
if (c >= '0' && c <= '9') {
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index c10987a5fe..bba0a85319 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -160,9 +160,9 @@ static inline bool qt_ends_with(QStringView haystack, QStringView needle, Qt::Ca
static inline bool qt_ends_with(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs);
static inline bool qt_ends_with(QStringView haystack, QChar needle, Qt::CaseSensitivity cs);
-qssize_t QtPrivate::qustrlen(const ushort *str) Q_DECL_NOTHROW
+qsizetype QtPrivate::qustrlen(const ushort *str) Q_DECL_NOTHROW
{
- qssize_t result = 0;
+ qsizetype result = 0;
#ifdef __SSE2__
// find the 16-byte alignment immediately prior or equal to str
diff --git a/src/corelib/tools/qstringalgorithms.h b/src/corelib/tools/qstringalgorithms.h
index 336da87468..aaa702301e 100644
--- a/src/corelib/tools/qstringalgorithms.h
+++ b/src/corelib/tools/qstringalgorithms.h
@@ -55,7 +55,7 @@ template <typename T> class QVector;
namespace QtPrivate {
-Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qssize_t qustrlen(const ushort *str) Q_DECL_NOTHROW;
+Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION qsizetype qustrlen(const ushort *str) Q_DECL_NOTHROW;
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW;
Q_REQUIRED_RESULT Q_CORE_EXPORT Q_DECL_PURE_FUNCTION int compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs = Qt::CaseSensitive) Q_DECL_NOTHROW;
diff --git a/src/corelib/tools/qstringiterator.qdoc b/src/corelib/tools/qstringiterator.qdoc
index 95c2247bc1..caec8803f3 100644
--- a/src/corelib/tools/qstringiterator.qdoc
+++ b/src/corelib/tools/qstringiterator.qdoc
@@ -120,7 +120,7 @@
*/
/*!
- \fn QStringIterator::QStringIterator(QStringView string, qssize_t idx)
+ \fn QStringIterator::QStringIterator(QStringView string, qsizetype idx)
Constructs an iterator over the contents of \a string. The iterator will point
before position \a idx in the string.
diff --git a/src/corelib/tools/qstringiterator_p.h b/src/corelib/tools/qstringiterator_p.h
index 8b1a6a1cd3..219589b6e4 100644
--- a/src/corelib/tools/qstringiterator_p.h
+++ b/src/corelib/tools/qstringiterator_p.h
@@ -62,7 +62,7 @@ class QStringIterator
QString::const_iterator i, pos, e;
Q_STATIC_ASSERT((std::is_same<QString::const_iterator, const QChar *>::value));
public:
- explicit QStringIterator(QStringView string, qssize_t idx = 0)
+ explicit QStringIterator(QStringView string, qsizetype idx = 0)
: i(string.begin()),
pos(i + idx),
e(string.end())
diff --git a/src/corelib/tools/qstringview.cpp b/src/corelib/tools/qstringview.cpp
index 8eefc6d814..bb22239b66 100644
--- a/src/corelib/tools/qstringview.cpp
+++ b/src/corelib/tools/qstringview.cpp
@@ -131,9 +131,9 @@ QT_BEGIN_NAMESPACE
/*!
\typedef QStringView::size_type
- Alias for qssize_t. Provided for compatibility with the STL.
+ Alias for qsizetype. Provided for compatibility with the STL.
- Unlike other Qt classes, QStringView uses qssize_t as its \c size_type, to allow
+ Unlike other Qt classes, QStringView uses qsizetype as its \c size_type, to allow
accepting data from \c{std::basic_string} without truncation. The Qt API functions,
for example length(), return \c int, while the STL-compatible functions, for example
size(), return \c size_type.
@@ -224,7 +224,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView::QStringView(const Char *str, qssize_t len)
+ \fn QStringView::QStringView(const Char *str, qsizetype len)
Constructs a string view on \a str with length \a len.
@@ -486,7 +486,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn qssize_t QStringView::size() const
+ \fn qsizetype QStringView::size() const
Returns the size of this string view, in UTF-16 code points (that is,
surrogate pairs count as two for the purposes of this function, the same
@@ -510,7 +510,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QChar QStringView::operator[](qssize_t n) const
+ \fn QChar QStringView::operator[](qsizetype n) const
Returns the character at position \a n in this string view.
@@ -520,7 +520,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QChar QStringView::at(qssize_t n) const
+ \fn QChar QStringView::at(qsizetype n) const
Returns the character at position \a n in this string view.
@@ -582,7 +582,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::mid(qssize_t start) const
+ \fn QStringView QStringView::mid(qsizetype start) const
Returns the substring starting at position \a start in this object,
and extending to the end of the string.
@@ -593,7 +593,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::mid(qssize_t start, qssize_t length) const
+ \fn QStringView QStringView::mid(qsizetype start, qsizetype length) const
\overload
Returns the substring of length \a length starting at position
@@ -606,7 +606,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::left(qssize_t length) const
+ \fn QStringView QStringView::left(qsizetype length) const
Returns the substring of length \a length starting at position
0 in this object.
@@ -617,7 +617,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::right(qssize_t length) const
+ \fn QStringView QStringView::right(qsizetype length) const
Returns the substring of length \a length starting at position
size() - \a length in this object.
@@ -628,7 +628,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::chopped(qssize_t length) const
+ \fn QStringView QStringView::chopped(qsizetype length) const
Returns the substring of length size() - \a length starting at the
beginning of this object.
@@ -641,7 +641,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QStringView::truncate(qssize_t length)
+ \fn void QStringView::truncate(qsizetype length)
Truncates this string view to length \a length.
@@ -653,7 +653,7 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QStringView::chop(qssize_t length)
+ \fn void QStringView::chop(qsizetype length)
Truncates this string view by \a length characters.
diff --git a/src/corelib/tools/qstringview.h b/src/corelib/tools/qstringview.h
index 14405f325d..903d7ccb24 100644
--- a/src/corelib/tools/qstringview.h
+++ b/src/corelib/tools/qstringview.h
@@ -111,7 +111,7 @@ public:
#endif
typedef const QChar value_type;
typedef std::ptrdiff_t difference_type;
- typedef qssize_t size_type;
+ typedef qsizetype size_type;
typedef value_type &reference;
typedef value_type &const_reference;
typedef value_type *pointer;
@@ -139,24 +139,24 @@ private:
using if_compatible_qstring_like = typename std::enable_if<std::is_same<T, QString>::value || std::is_same<T, QStringRef>::value, bool>::type;
template <typename Char, size_t N>
- static Q_DECL_CONSTEXPR qssize_t lengthHelperArray(const Char (&)[N]) Q_DECL_NOTHROW
+ static Q_DECL_CONSTEXPR qsizetype lengthHelperArray(const Char (&)[N]) Q_DECL_NOTHROW
{
- return qssize_t(N - 1);
+ return qsizetype(N - 1);
}
template <typename Char>
- static qssize_t lengthHelperPointer(const Char *str) Q_DECL_NOTHROW
+ static qsizetype lengthHelperPointer(const Char *str) Q_DECL_NOTHROW
{
#if defined(Q_CC_GNU) && !defined(Q_CC_CLANG) && !defined(Q_CC_INTEL)
if (__builtin_constant_p(*str)) {
- qssize_t result = 0;
+ qsizetype result = 0;
while (*str++)
++result;
}
#endif
return QtPrivate::qustrlen(reinterpret_cast<const ushort *>(str));
}
- static qssize_t lengthHelperPointer(const QChar *str) Q_DECL_NOTHROW
+ static qsizetype lengthHelperPointer(const QChar *str) Q_DECL_NOTHROW
{
return QtPrivate::qustrlen(reinterpret_cast<const ushort *>(str));
}
@@ -174,7 +174,7 @@ public:
: QStringView() {}
template <typename Char, if_compatible_char<Char> = true>
- Q_DECL_CONSTEXPR QStringView(const Char *str, qssize_t len)
+ Q_DECL_CONSTEXPR QStringView(const Char *str, qsizetype len)
: m_size((Q_ASSERT(len >= 0), Q_ASSERT(str || !len), len)),
m_data(castHelper(str)) {}
@@ -204,20 +204,20 @@ public:
#else
template <typename String, if_compatible_qstring_like<String> = true>
QStringView(const String &str) Q_DECL_NOTHROW
- : QStringView(str.isNull() ? nullptr : str.data(), qssize_t(str.size())) {}
+ : QStringView(str.isNull() ? nullptr : str.data(), qsizetype(str.size())) {}
#endif
template <typename StdBasicString, if_compatible_string<StdBasicString> = true>
QStringView(const StdBasicString &str) Q_DECL_NOTHROW
- : QStringView(str.data(), qssize_t(str.size())) {}
+ : QStringView(str.data(), qsizetype(str.size())) {}
Q_REQUIRED_RESULT inline QString toString() const; // defined in qstring.h
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qssize_t size() const Q_DECL_NOTHROW { return m_size; }
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR qsizetype size() const Q_DECL_NOTHROW { return m_size; }
Q_REQUIRED_RESULT const_pointer data() const Q_DECL_NOTHROW { return reinterpret_cast<const_pointer>(m_data); }
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR const storage_type *utf16() const Q_DECL_NOTHROW { return m_data; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar operator[](qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n < size()), QChar(m_data[n]); }
//
@@ -229,22 +229,22 @@ public:
Q_REQUIRED_RESULT QByteArray toLocal8Bit() const { return QtPrivate::convertToLocal8Bit(*this); }
Q_REQUIRED_RESULT inline QVector<uint> toUcs4() const; // defined in qvector.h
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qssize_t n) const { return (*this)[n]; }
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar at(qsizetype n) const { return (*this)[n]; }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qssize_t pos) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qsizetype pos) const
{ return Q_ASSERT(pos >= 0), Q_ASSERT(pos <= size()), QStringView(m_data + pos, m_size - pos); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qssize_t pos, qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView mid(qsizetype pos, qsizetype n) const
{ return Q_ASSERT(pos >= 0), Q_ASSERT(n >= 0), Q_ASSERT(pos + n <= size()), QStringView(m_data + pos, n); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView left(qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView left(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, n); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView right(qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView right(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data + m_size - n, n); }
- Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qssize_t n) const
+ Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qsizetype n) const
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, m_size - n); }
- Q_DECL_RELAXED_CONSTEXPR void truncate(qssize_t n)
+ Q_DECL_RELAXED_CONSTEXPR void truncate(qsizetype n)
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size = n; }
- Q_DECL_RELAXED_CONSTEXPR void chop(qssize_t n)
+ Q_DECL_RELAXED_CONSTEXPR void chop(qsizetype n)
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); m_size -= n; }
Q_REQUIRED_RESULT QStringView trimmed() const Q_DECL_NOTHROW { return QtPrivate::trimmed(*this); }
@@ -291,7 +291,7 @@ public:
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar first() const { return front(); }
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QChar last() const { return back(); }
private:
- qssize_t m_size;
+ qsizetype m_size;
const storage_type *m_data;
};
Q_DECLARE_TYPEINFO(QStringView, Q_PRIMITIVE_TYPE);