summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-06-27 11:26:42 +0200
committerLars Knoll <lars.knoll@qt.io>2020-07-06 21:31:35 +0200
commit9117e3850b9d395a9741fa4b63c5b59ea7767390 (patch)
tree8a30c1c8654724e6cd3270e8d679024390c58186 /src
parente5fbe10647d35e4c27413a29a08376e3335e16b0 (diff)
Rename from() to sliced()
After API discussions, agreement was that from(n) is a bad name for the method. Let's go with sliced(n) instead. Change-Id: I0338cc150148a5008c3ee72bd8fda96fb93e9c35 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/text/qbytearray.cpp9
-rw-r--r--src/corelib/text/qbytearray.h2
-rw-r--r--src/corelib/text/qstring.cpp7
-rw-r--r--src/corelib/text/qstring.h2
-rw-r--r--src/corelib/text/qstringview.cpp3
-rw-r--r--src/corelib/text/qstringview.h2
6 files changed, 14 insertions, 11 deletions
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index c138765e15..299c723a55 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -2902,7 +2902,7 @@ QByteArray QByteArray::mid(int pos, int len) const
\note The behavior is undefined when \a n < 0 or \a n > size().
- \sa last(), sliced(), from(), startsWith(), chopped(), chop(), truncate()
+ \sa last(), sliced(), startsWith(), chopped(), chop(), truncate()
*/
/*!
@@ -2913,7 +2913,7 @@ QByteArray QByteArray::mid(int pos, int len) const
\note The behavior is undefined when \a n < 0 or \a n > size().
- \sa first(), sliced(), from(), endsWith(), chopped(), chop(), truncate()
+ \sa first(), sliced(), endsWith(), chopped(), chop(), truncate()
*/
/*!
@@ -2926,12 +2926,13 @@ QByteArray QByteArray::mid(int pos, int len) const
\note The behavior is undefined when \a pos < 0, \a n < 0,
or \a pos + \a n > size().
- \sa first(), last(), from(), chopped(), chop(), truncate()
+ \sa first(), last(), chopped(), chop(), truncate()
*/
/*!
- \fn QByteArray QByteArray::from(qsizetype pos) const
+ \fn QByteArray QByteArray::sliced(qsizetype pos) const
\since 6.0
+ \overload
Returns a byte array containing the bytes starting at position \a pos
in this object, and extending to the end of this object.
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index f4d4bf0745..045a05c54a 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -226,7 +226,7 @@ public:
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QByteArray(data(), int(n)); }
Q_REQUIRED_RESULT QByteArray last(qsizetype n) const
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QByteArray(data() + size() - n, int(n)); }
- Q_REQUIRED_RESULT QByteArray from(qsizetype pos) const
+ Q_REQUIRED_RESULT QByteArray sliced(qsizetype pos) const
{ Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QByteArray(data() + pos, size() - int(pos)); }
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)); }
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index 36f61aed7d..ae39823df2 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -4554,7 +4554,7 @@ QString QString::mid(qsizetype position, qsizetype n) const
\note The behavior is undefined when \a n < 0 or \a n > size().
- \sa last(), sliced(), from(), startsWith(), chopped(), chop(), truncate()
+ \sa last(), sliced(), startsWith(), chopped(), chop(), truncate()
*/
/*!
@@ -4565,7 +4565,7 @@ QString QString::mid(qsizetype position, qsizetype n) const
\note The behavior is undefined when \a n < 0 or \a n > size().
- \sa first(), sliced(), from(), endsWith(), chopped(), chop(), truncate()
+ \sa first(), sliced(), endsWith(), chopped(), chop(), truncate()
*/
/*!
@@ -4582,8 +4582,9 @@ QString QString::mid(qsizetype position, qsizetype n) const
*/
/*!
- \fn QString QString::from(qsizetype pos) const
+ \fn QString QString::sliced(qsizetype pos) const
\since 6.0
+ \overload
Returns a string that contains the portion of this string starting at
position \a pos and extending to its end.
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index f3222155b8..45578debd6 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -441,7 +441,7 @@ public:
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QString(data(), n); }
Q_REQUIRED_RESULT QString last(qsizetype n) const
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QString(data() + size() - n, n); }
- Q_REQUIRED_RESULT QString from(qsizetype pos) const
+ Q_REQUIRED_RESULT QString sliced(qsizetype pos) const
{ Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QString(data() + pos, size() - pos); }
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, n); }
diff --git a/src/corelib/text/qstringview.cpp b/src/corelib/text/qstringview.cpp
index 985d87ac51..4ad8a8f38f 100644
--- a/src/corelib/text/qstringview.cpp
+++ b/src/corelib/text/qstringview.cpp
@@ -692,8 +692,9 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QStringView QStringView::from(qsizetype pos) const
+ \fn QStringView QStringView::sliced(qsizetype pos) const
\since 6.0
+ \overload
Returns a string view starting at position \a pos in this object,
and extending to its end.
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index 17b60fdc42..58412974bc 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -280,7 +280,7 @@ public:
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data, n); }
Q_REQUIRED_RESULT constexpr QStringView last(qsizetype n) const
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data + size() - n, n); }
- Q_REQUIRED_RESULT constexpr QStringView from(qsizetype pos) const
+ Q_REQUIRED_RESULT constexpr QStringView sliced(qsizetype pos) const
{ Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QStringView(m_data + pos, size() - pos); }
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, n); }