diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/text/qbytearray.cpp | 14 | ||||
-rw-r--r-- | src/corelib/text/qbytearray.h | 2 | ||||
-rw-r--r-- | src/corelib/text/qstring.cpp | 14 | ||||
-rw-r--r-- | src/corelib/text/qstring.h | 2 | ||||
-rw-r--r-- | src/corelib/text/qstringview.cpp | 10 | ||||
-rw-r--r-- | src/corelib/text/qstringview.h | 2 |
6 files changed, 22 insertions, 22 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp index 3f83e36d90..31ae063cb1 100644 --- a/src/corelib/text/qbytearray.cpp +++ b/src/corelib/text/qbytearray.cpp @@ -2949,7 +2949,7 @@ QByteArray QByteArray::left(int len) const Example: \snippet code/src_corelib_text_qbytearray.cpp 28 - \sa endsWith(), last(), first(), slice(), chopped(), chop(), truncate() + \sa endsWith(), last(), first(), sliced(), chopped(), chop(), truncate() */ QByteArray QByteArray::right(int len) const { @@ -2964,7 +2964,7 @@ QByteArray QByteArray::right(int len) const Returns a byte array containing \a len bytes from this byte array, starting at position \a pos. - \obsolete Use slice() instead in new code. + \obsolete Use sliced() instead in new code. If \a len is -1 (the default), or \a pos + \a len >= size(), returns a byte array containing all bytes starting at position \a @@ -2973,7 +2973,7 @@ QByteArray QByteArray::right(int len) const Example: \snippet code/src_corelib_text_qbytearray.cpp 29 - \sa first(), last(), slice(), chopped(), chop(), truncate() + \sa first(), last(), sliced(), chopped(), chop(), truncate() */ QByteArray QByteArray::mid(int pos, int len) const @@ -3007,7 +3007,7 @@ QByteArray QByteArray::mid(int pos, int len) const \note The behavior is undefined when \a n < 0 or \a n > size(). - \sa last(), slice(), from(), startsWith(), chopped(), chop(), truncate() + \sa last(), sliced(), from(), startsWith(), chopped(), chop(), truncate() */ /*! @@ -3018,11 +3018,11 @@ QByteArray QByteArray::mid(int pos, int len) const \note The behavior is undefined when \a n < 0 or \a n > size(). - \sa first(), slice(), from(), endsWith(), chopped(), chop(), truncate() + \sa first(), sliced(), from(), endsWith(), chopped(), chop(), truncate() */ /*! - \fn QByteArray QByteArray::slice(qsizetype pos, qsizetype n) const + \fn QByteArray QByteArray::sliced(qsizetype pos, qsizetype n) const \since 6.0 Returns a byte array containing the \a n bytes of this object starting @@ -3043,7 +3043,7 @@ QByteArray QByteArray::mid(int pos, int len) const \note The behavior is undefined when \a pos < 0 or \a pos > size(). - \sa first(), last(), slice(), chopped(), chop(), truncate() + \sa first(), last(), sliced(), chopped(), chop(), truncate() */ /*! diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h index 130509802b..4de7f4ad56 100644 --- a/src/corelib/text/qbytearray.h +++ b/src/corelib/text/qbytearray.h @@ -231,7 +231,7 @@ public: { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QByteArray(data() + size() - n, int(n)); } Q_REQUIRED_RESULT QByteArray from(qsizetype pos) const { Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QByteArray(data() + pos, size() - int(pos)); } - Q_REQUIRED_RESULT QByteArray slice(qsizetype pos, qsizetype n) const + Q_REQUIRED_RESULT QByteArray sliced(qsizetype pos, qsizetype n) const { Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QByteArray(data() + pos, int(n)); } Q_REQUIRED_RESULT QByteArray chopped(int len) const { Q_ASSERT(len >= 0); Q_ASSERT(len <= size()); return first(size() - len); } diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 206d495647..1ccb67203e 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -4516,7 +4516,7 @@ QString QString::left(int n) const \snippet qstring/main.cpp 48 - \sa endsWith(), last(), first(), slice(), chopped(), chop(), truncate() + \sa endsWith(), last(), first(), sliced(), chopped(), chop(), truncate() */ QString QString::right(int n) const { @@ -4529,7 +4529,7 @@ QString QString::right(int n) const Returns a string that contains \a n characters of this string, starting at the specified \a position index. - \obsolete Use slice() instead in new code. + \obsolete Use sliced() instead in new code. Returns a null string if the \a position index exceeds the length of the string. If there are less than \a n characters @@ -4541,7 +4541,7 @@ QString QString::right(int n) const \snippet qstring/main.cpp 34 - \sa first(), last(), slice(), chopped(), chop(), truncate() + \sa first(), last(), sliced(), chopped(), chop(), truncate() */ QString QString::mid(int position, int n) const @@ -4576,7 +4576,7 @@ QString QString::mid(int position, int n) const \note The behavior is undefined when \a n < 0 or \a n > size(). - \sa last(), slice(), from(), startsWith(), chopped(), chop(), truncate() + \sa last(), sliced(), from(), startsWith(), chopped(), chop(), truncate() */ /*! @@ -4587,11 +4587,11 @@ QString QString::mid(int position, int n) const \note The behavior is undefined when \a n < 0 or \a n > size(). - \sa first(), slice(), from(), endsWith(), chopped(), chop(), truncate() + \sa first(), sliced(), from(), endsWith(), chopped(), chop(), truncate() */ /*! - \fn QString QString::slice(qsizetype pos, qsizetype n) const + \fn QString QString::sliced(qsizetype pos, qsizetype n) const \since 6.0 Returns a string that contains \a n characters of this string, @@ -4612,7 +4612,7 @@ QString QString::mid(int position, int n) const \note The behavior is undefined when \a pos < 0 or \a pos > size(). - \sa first(), last(), slice(), chopped(), chop(), truncate() + \sa first(), last(), sliced(), chopped(), chop(), truncate() */ /*! diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index c6ef27c481..bb946b655e 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -454,7 +454,7 @@ public: { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QString(data() + size() - n, int(n)); } Q_REQUIRED_RESULT QString from(qsizetype pos) const { Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QString(data() + pos, size() - int(pos)); } - Q_REQUIRED_RESULT QString slice(qsizetype pos, qsizetype n) const + Q_REQUIRED_RESULT QString sliced(qsizetype pos, qsizetype n) const { Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QString(data() + pos, int(n)); } Q_REQUIRED_RESULT QString chopped(int n) const { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return first(size() - n); } diff --git a/src/corelib/text/qstringview.cpp b/src/corelib/text/qstringview.cpp index 42d18851c7..092f58a90a 100644 --- a/src/corelib/text/qstringview.cpp +++ b/src/corelib/text/qstringview.cpp @@ -616,7 +616,7 @@ QT_BEGIN_NAMESPACE Returns the substring of length \a length starting at position \a start in this object. - \obsolete Use slice() instead in new code. + \obsolete Use sliced() instead in new code. Returns an empty string view if \a start exceeds the length of the string. If there are less than \a length characters @@ -624,7 +624,7 @@ QT_BEGIN_NAMESPACE \a length is negative (default), the function returns all characters that are available from \a start. - \sa first(), last(), slice(), chopped(), chop(), truncate() + \sa first(), last(), sliced(), chopped(), chop(), truncate() */ /*! @@ -638,7 +638,7 @@ QT_BEGIN_NAMESPACE The entire string is returned if \a length is greater than or equal to size(), or less than zero. - \sa first(), last(), slice(), startsWith(), chopped(), chop(), truncate() + \sa first(), last(), sliced(), startsWith(), chopped(), chop(), truncate() */ /*! @@ -652,7 +652,7 @@ QT_BEGIN_NAMESPACE The entire string is returned if \a length is greater than or equal to size(), or less than zero. - \sa first(), last(), slice(), endsWith(), chopped(), chop(), truncate() + \sa first(), last(), sliced(), endsWith(), chopped(), chop(), truncate() */ /*! @@ -679,7 +679,7 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QStringView QStringView::slice(qsizetype pos, qsizetype n) const + \fn QStringView QStringView::sliced(qsizetype pos, qsizetype n) const \since 6.0 Returns a string view that points to \a n characters of this string, diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h index 6dbec21165..67c4825413 100644 --- a/src/corelib/text/qstringview.h +++ b/src/corelib/text/qstringview.h @@ -282,7 +282,7 @@ public: { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data + size() - n, int(n)); } Q_REQUIRED_RESULT constexpr QStringView from(qsizetype pos) const { Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QStringView(m_data + pos, size() - int(pos)); } - Q_REQUIRED_RESULT constexpr QStringView slice(qsizetype pos, qsizetype n) const + Q_REQUIRED_RESULT constexpr QStringView sliced(qsizetype pos, qsizetype n) const { Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QStringView(m_data + pos, int(n)); } 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); } |