summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qbytearray.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-07-01 15:01:58 +0300
committerAhmad Samir <a.samirh78@gmail.com>2024-02-29 00:27:25 +0200
commit9bf68a47e1ba8790fca9d24bcb7b45cd56e79320 (patch)
tree7ce4b7644ce8e5e8d315e774d9bc37c8f19602e2 /src/corelib/text/qbytearray.cpp
parentb2ec2e1137ceb0b83978a7fa35485b1b97c73648 (diff)
QString/QByteArray: add slice() methods
[ChangeLog][QtCore][QString/QByteArray] Added slice() methods that work like sliced(), but modify the string/byte-array they are called on. Task-number: QTBUG-99218 Change-Id: I3075562983ef123d9aa022a2304c7e774cf2ea42 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/text/qbytearray.cpp')
-rw-r--r--src/corelib/text/qbytearray.cpp43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index 8e34ab0742..38789f5583 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -3068,7 +3068,7 @@ bool QByteArray::isLower() const
Returns an empty QByteArray if \a len is smaller than 0.
- \sa endsWith(), last(), first(), sliced(), chopped(), chop(), truncate()
+ \sa endsWith(), last(), first(), sliced(), chopped(), chop(), truncate(), slice()
*/
/*!
@@ -3085,7 +3085,7 @@ bool QByteArray::isLower() const
returns a byte array containing all bytes starting at position \a
pos until the end of the byte array.
- \sa first(), last(), sliced(), chopped(), chop(), truncate()
+ \sa first(), last(), sliced(), chopped(), chop(), truncate(), slice()
*/
QByteArray QByteArray::mid(qsizetype pos, qsizetype len) const &
@@ -3139,7 +3139,7 @@ QByteArray QByteArray::mid(qsizetype pos, qsizetype len) &&
Example:
\snippet code/src_corelib_text_qbytearray.cpp 27
- \sa last(), sliced(), startsWith(), chopped(), chop(), truncate()
+ \sa last(), sliced(), startsWith(), chopped(), chop(), truncate(), slice()
*/
/*!
@@ -3154,7 +3154,7 @@ QByteArray QByteArray::mid(qsizetype pos, qsizetype len) &&
Example:
\snippet code/src_corelib_text_qbytearray.cpp 28
- \sa first(), sliced(), endsWith(), chopped(), chop(), truncate()
+ \sa first(), sliced(), endsWith(), chopped(), chop(), truncate(), slice()
*/
/*!
@@ -3171,7 +3171,7 @@ QByteArray QByteArray::mid(qsizetype pos, qsizetype len) &&
Example:
\snippet code/src_corelib_text_qbytearray.cpp 29
- \sa first(), last(), chopped(), chop(), truncate()
+ \sa first(), last(), chopped(), chop(), truncate(), slice()
*/
QByteArray QByteArray::sliced_helper(QByteArray &a, qsizetype pos, qsizetype n)
{
@@ -3193,7 +3193,36 @@ QByteArray QByteArray::sliced_helper(QByteArray &a, qsizetype pos, qsizetype n)
\note The behavior is undefined when \a pos < 0 or \a pos > size().
- \sa first(), last(), sliced(), chopped(), chop(), truncate()
+ \sa first(), last(), chopped(), chop(), truncate(), slice()
+*/
+
+/*!
+ \fn QByteArray &QByteArray::slice(qsizetype pos, qsizetype n)
+ \since 6.8
+
+ Modifies this byte array to start at position \a pos, extending for \a n
+ bytes, and returns a reference to this byte array.
+
+ \note The behavior is undefined if \a pos < 0, \a n < 0,
+ or \a pos + \a n > size().
+
+ Example:
+ \snippet code/src_corelib_text_qbytearray.cpp 57
+
+ \sa sliced(), first(), last(), chopped(), chop(), truncate()
+*/
+
+/*!
+ \fn QByteArray &QByteArray::slice(qsizetype pos)
+ \since 6.8
+ \overload
+
+ Modifies this byte array to start at position \a pos, extending to its
+ end, and returns a reference to this byte array.
+
+ \note The behavior is undefined if \a pos < 0 or \a pos > size().
+
+ \sa sliced(), first(), last(), chopped(), chop(), truncate()
*/
/*!
@@ -3206,7 +3235,7 @@ QByteArray QByteArray::sliced_helper(QByteArray &a, qsizetype pos, qsizetype n)
\note The behavior is undefined if \a len is negative or greater than size().
- \sa endsWith(), first(), last(), sliced(), chop(), truncate()
+ \sa endsWith(), first(), last(), sliced(), chop(), truncate(), slice()
*/
/*!