summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/global/qglobal.cpp8
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/global/qrandom.cpp40
-rw-r--r--src/corelib/global/qrandom.h10
-rw-r--r--src/corelib/io/qresource.cpp4
-rw-r--r--src/corelib/io/qtemporaryfile_p.h4
-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
13 files changed, 75 insertions, 75 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 36b7560398..2c2dcb663b 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -160,8 +160,8 @@ Q_STATIC_ASSERT_X(std::numeric_limits<float>::radix == 2,
// not required by the definition of size_t, but we depend on this
Q_STATIC_ASSERT_X(sizeof(size_t) == sizeof(void *), "size_t and a pointer don't have the same size");
-Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qssize_t)); // implied by the definition
-Q_STATIC_ASSERT((std::is_same<qssize_t, qptrdiff>::value));
+Q_STATIC_ASSERT(sizeof(size_t) == sizeof(qsizetype)); // implied by the definition
+Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
/*!
\class QFlag
@@ -824,7 +824,7 @@ Q_STATIC_ASSERT((std::is_same<qssize_t, qptrdiff>::value));
*/
/*!
- \typedef qssize_t
+ \typedef qsizetype
\relates <QtGlobal>
\since 5.10
@@ -833,7 +833,7 @@ Q_STATIC_ASSERT((std::is_same<qssize_t, qptrdiff>::value));
This type is guaranteed to be the same size as a \c size_t on all
platforms supported by Qt.
- Note that qssize_t is signed. Use \c size_t for unsigned values.
+ Note that qsizetype is signed. Use \c size_t for unsigned values.
\sa qptrdiff
*/
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 7b691ca59e..4e7c1b59be 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -439,7 +439,7 @@ namespace QtPrivate {
sizeof(void *) == sizeof(quintptr)
&& sizeof(void *) == sizeof(qptrdiff)
- size_t and qssize_t are not guaranteed to be the same size as a pointer, but
+ size_t and qsizetype are not guaranteed to be the same size as a pointer, but
they usually are.
*/
template <int> struct QIntegerForSize;
@@ -456,7 +456,7 @@ typedef QIntegerForSize<Q_PROCESSOR_WORDSIZE>::Unsigned qregisteruint;
typedef QIntegerForSizeof<void*>::Unsigned quintptr;
typedef QIntegerForSizeof<void*>::Signed qptrdiff;
typedef qptrdiff qintptr;
-using qssize_t = QIntegerForSizeof<std::size_t>::Signed;
+using qsizetype = QIntegerForSizeof<std::size_t>::Signed;
/* moc compats (signals/slots) */
#ifndef QT_MOC_COMPAT
diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp
index 72ac8d332b..6769190335 100644
--- a/src/corelib/global/qrandom.cpp
+++ b/src/corelib/global/qrandom.cpp
@@ -93,7 +93,7 @@ DECLSPEC_IMPORT BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG Rando
QT_BEGIN_NAMESPACE
#if defined(Q_PROCESSOR_X86) && QT_COMPILER_SUPPORTS_HERE(RDRND)
-static qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW;
+static qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW;
# ifdef Q_PROCESSOR_X86_64
# define _rdrandXX_step _rdrand64_step
@@ -101,7 +101,7 @@ static qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW;
# define _rdrandXX_step _rdrand32_step
# endif
-static QT_FUNCTION_TARGET(RDRND) qssize_t qt_random_cpu(void *buffer, qssize_t count) Q_DECL_NOTHROW
+static QT_FUNCTION_TARGET(RDRND) qsizetype qt_random_cpu(void *buffer, qsizetype count) Q_DECL_NOTHROW
{
unsigned *ptr = reinterpret_cast<unsigned *>(buffer);
unsigned *end = ptr + count;
@@ -122,7 +122,7 @@ out:
return ptr - reinterpret_cast<unsigned *>(buffer);
}
#else
-static qssize_t qt_random_cpu(void *, qssize_t)
+static qsizetype qt_random_cpu(void *, qsizetype)
{
return 0;
}
@@ -136,10 +136,10 @@ enum {
struct QRandomGenerator::SystemGenerator
{
#if QT_CONFIG(getentropy)
- static qssize_t fillBuffer(void *buffer, qssize_t count) Q_DECL_NOTHROW
+ static qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW
{
// getentropy can read at most 256 bytes, so break the reading
- qssize_t read = 0;
+ qsizetype read = 0;
while (count - read > 256) {
// getentropy can't fail under normal circumstances
int ret = getentropy(reinterpret_cast<uchar *>(buffer) + read, 256);
@@ -195,24 +195,24 @@ struct QRandomGenerator::SystemGenerator
Q_DECL_CONSTEXPR SystemGenerator() : fdp1 Q_BASIC_ATOMIC_INITIALIZER(0) {}
- qssize_t fillBuffer(void *buffer, qssize_t count)
+ qsizetype fillBuffer(void *buffer, qsizetype count)
{
int fd = openDevice();
if (Q_UNLIKELY(fd < 0))
return 0;
qint64 n = qt_safe_read(fd, buffer, count);
- return qMax<qssize_t>(n, 0); // ignore any errors
+ return qMax<qsizetype>(n, 0); // ignore any errors
}
#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
- qssize_t fillBuffer(void *buffer, qssize_t count) Q_DECL_NOTHROW
+ qsizetype fillBuffer(void *buffer, qsizetype count) Q_DECL_NOTHROW
{
auto RtlGenRandom = SystemFunction036;
return RtlGenRandom(buffer, ULONG(count)) ? count: 0;
}
#elif defined(Q_OS_WINRT)
- qssize_t fillBuffer(void *, qssize_t) Q_DECL_NOTHROW
+ qsizetype fillBuffer(void *, qsizetype) Q_DECL_NOTHROW
{
// always use the fallback
return 0;
@@ -243,7 +243,7 @@ struct QRandomGenerator::SystemGenerator
#if defined(Q_OS_WIN)
static void fallback_update_seed(unsigned) {}
-static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW
+static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
{
// on Windows, rand_s is a high-quality random number generator
// and it requires no seeding
@@ -255,14 +255,14 @@ static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW
}
#elif QT_CONFIG(getentropy)
static void fallback_update_seed(unsigned) {}
-static void fallback_fill(quint32 *, qssize_t) Q_DECL_NOTHROW
+static void fallback_fill(quint32 *, qsizetype) Q_DECL_NOTHROW
{
// no fallback necessary, getentropy cannot fail under normal circumstances
Q_UNREACHABLE();
}
#elif defined(Q_OS_BSD4)
static void fallback_update_seed(unsigned) {}
-static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW
+static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
{
// BSDs have arc4random(4) and these work even in chroot(2)
arc4random_buf(ptr, left * sizeof(*ptr));
@@ -281,7 +281,7 @@ Q_NEVER_INLINE
#ifdef Q_CC_GNU
__attribute__((cold)) // this function is pretty big, so optimize for size
#endif
-static void fallback_fill(quint32 *ptr, qssize_t left) Q_DECL_NOTHROW
+static void fallback_fill(quint32 *ptr, qsizetype left) Q_DECL_NOTHROW
{
quint32 scratch[12]; // see element count below
quint32 *end = scratch;
@@ -358,7 +358,7 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin,
Q_DECL_NOEXCEPT_EXPR(FillBufferNoexcept)
{
quint32 *buffer = begin;
- qssize_t count = end - begin;
+ qsizetype count = end - begin;
if (Q_UNLIKELY(uint(qt_randomdevice_control) & SetRandomData)) {
uint value = uint(qt_randomdevice_control) & RandomDataMask;
@@ -366,14 +366,14 @@ Q_NEVER_INLINE void QRandomGenerator::SystemGenerator::generate(quint32 *begin,
return;
}
- qssize_t filled = 0;
+ qsizetype filled = 0;
if (qt_has_hwrng() && (uint(qt_randomdevice_control) & SkipHWRNG) == 0)
filled += qt_random_cpu(buffer, count);
if (filled != count && (uint(qt_randomdevice_control) & SkipSystemRNG) == 0) {
- qssize_t bytesFilled =
- fillBuffer(buffer + filled, (count - filled) * qssize_t(sizeof(*buffer)));
- filled += bytesFilled / qssize_t(sizeof(*buffer));
+ qsizetype bytesFilled =
+ fillBuffer(buffer + filled, (count - filled) * qsizetype(sizeof(*buffer)));
+ filled += bytesFilled / qsizetype(sizeof(*buffer));
}
if (filled)
fallback_update_seed(*buffer);
@@ -677,7 +677,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
*/
/*!
- \fn QRandomGenerator::QRandomGenerator(const quint32 *seedBuffer, qssize_t len)
+ \fn QRandomGenerator::QRandomGenerator(const quint32 *seedBuffer, qsizetype len)
\overload
Initializes this QRandomGenerator object with \a len values found in
@@ -853,7 +853,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel
*/
/*!
- \fn void QRandomGenerator::fillRange(UInt *buffer, qssize_t count)
+ \fn void QRandomGenerator::fillRange(UInt *buffer, qsizetype count)
Generates \a count 32- or 64-bit quantities (depending on the type \c UInt)
and stores them in the buffer pointed by \a buffer. This is the most
diff --git a/src/corelib/global/qrandom.h b/src/corelib/global/qrandom.h
index 005de0941f..cbeab19a7b 100644
--- a/src/corelib/global/qrandom.h
+++ b/src/corelib/global/qrandom.h
@@ -55,10 +55,10 @@ public:
QRandomGenerator(quint32 seedValue = 1)
: QRandomGenerator(&seedValue, 1)
{}
- template <qssize_t N> QRandomGenerator(const quint32 (&seedBuffer)[N])
+ template <qsizetype N> QRandomGenerator(const quint32 (&seedBuffer)[N])
: QRandomGenerator(seedBuffer, seedBuffer + N)
{}
- QRandomGenerator(const quint32 *seedBuffer, qssize_t len)
+ QRandomGenerator(const quint32 *seedBuffer, qsizetype len)
: QRandomGenerator(seedBuffer, seedBuffer + len)
{}
Q_CORE_EXPORT QRandomGenerator(std::seed_seq &sseq) Q_DECL_NOTHROW;
@@ -131,7 +131,7 @@ public:
}
template <typename UInt, IfValidUInt<UInt> = true>
- void fillRange(UInt *buffer, qssize_t count)
+ void fillRange(UInt *buffer, qsizetype count)
{
_fillRange(buffer, buffer + count);
}
@@ -215,10 +215,10 @@ public:
QRandomGenerator64(quint32 seedValue = 1)
: QRandomGenerator(seedValue)
{}
- template <qssize_t N> QRandomGenerator64(const quint32 (&seedBuffer)[N])
+ template <qsizetype N> QRandomGenerator64(const quint32 (&seedBuffer)[N])
: QRandomGenerator(seedBuffer)
{}
- QRandomGenerator64(const quint32 *seedBuffer, qssize_t len)
+ QRandomGenerator64(const quint32 *seedBuffer, qsizetype len)
: QRandomGenerator(seedBuffer, len)
{}
QRandomGenerator64(std::seed_seq &sseq) Q_DECL_NOTHROW
diff --git a/src/corelib/io/qresource.cpp b/src/corelib/io/qresource.cpp
index c1187e5145..31f02e977d 100644
--- a/src/corelib/io/qresource.cpp
+++ b/src/corelib/io/qresource.cpp
@@ -86,8 +86,8 @@ public:
}
const QChar *m_data;
- qssize_t m_len;
- qssize_t m_pos = 0;
+ qsizetype m_len;
+ qsizetype m_pos = 0;
QChar m_splitChar = QLatin1Char('/');
};
diff --git a/src/corelib/io/qtemporaryfile_p.h b/src/corelib/io/qtemporaryfile_p.h
index c3a2c01790..fb8887af53 100644
--- a/src/corelib/io/qtemporaryfile_p.h
+++ b/src/corelib/io/qtemporaryfile_p.h
@@ -74,8 +74,8 @@ QT_BEGIN_NAMESPACE
struct QTemporaryFileName
{
QFileSystemEntry::NativePath path;
- qssize_t pos;
- qssize_t length;
+ qsizetype pos;
+ qsizetype length;
QTemporaryFileName(const QString &templateName);
QFileSystemEntry::NativePath generateNext();
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);