summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qbytearrayview.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/text/qbytearrayview.qdoc')
-rw-r--r--src/corelib/text/qbytearrayview.qdoc101
1 files changed, 86 insertions, 15 deletions
diff --git a/src/corelib/text/qbytearrayview.qdoc b/src/corelib/text/qbytearrayview.qdoc
index f9f4664e39..eb890917eb 100644
--- a/src/corelib/text/qbytearrayview.qdoc
+++ b/src/corelib/text/qbytearrayview.qdoc
@@ -14,6 +14,15 @@
\reentrant
+ \compares strong
+ \compareswith strong QByteArray {const char *}
+ \endcompareswith
+ \compareswith strong QString QStringView QUtf8StringView QLatin1StringView \
+ QChar char16_t
+ When comparing with string and Unicode character types, the content is
+ interpreted as UTF-8.
+ \endcompareswith
+
A QByteArrayView references a contiguous portion of raw bytes it does
not own. It acts as an interface type to all kinds of byte-array-like data,
without the need to construct a QByteArray first.
@@ -184,7 +193,7 @@
*/
/*!
- \fn template <typename Byte> QByteArrayView::QByteArrayView(const Byte *data, qsizetype len)
+ \fn template <typename Byte, QByteArrayView::if_compatible_byte<Byte> = true> QByteArrayView::QByteArrayView(const Byte *data, qsizetype len)
Constructs a byte array view on \a data with length \a len.
@@ -202,7 +211,7 @@
*/
/*!
- \fn template <typename Byte> QByteArrayView::QByteArrayView(const Byte *first, const Byte *last)
+ \fn template <typename Byte, QByteArrayView::if_compatible_byte<Byte> = true> QByteArrayView::QByteArrayView(const Byte *first, const Byte *last)
Constructs a byte array view on \a first with length (\a last - \a first).
@@ -270,7 +279,7 @@
*/
/*!
- \fn template <typename Container> QByteArrayView::QByteArrayView(const Container &c)
+ \fn template <typename Container, QByteArrayView::if_compatible_container<Container> = true> QByteArrayView::QByteArrayView(const Container &c)
Constructs a byte array view on the array-like container \a c. The length and data
are set via \c{std::size(c)} and \c{std::data(c)} respectively.
@@ -278,7 +287,7 @@
The container's data must remain valid for the lifetime of this byte array view object.
This constructor participates in overload resolution if \a c is any contiguous
- container container with elements of a compatible byte type.
+ container with elements of a compatible byte type.
\sa {Compatible Byte Types}
*/
@@ -332,12 +341,12 @@
*/
/*! //! friend
- \fn int QByteArrayView::operator==(QByteArrayView lhs, QByteArrayView rhs)
- \fn int QByteArrayView::operator!=(QByteArrayView lhs, QByteArrayView rhs)
- \fn int QByteArrayView::operator< (QByteArrayView lhs, QByteArrayView rhs)
- \fn int QByteArrayView::operator<=(QByteArrayView lhs, QByteArrayView rhs)
- \fn int QByteArrayView::operator> (QByteArrayView lhs, QByteArrayView rhs)
- \fn int QByteArrayView::operator>=(QByteArrayView lhs, QByteArrayView rhs)
+ \fn int QByteArrayView::operator==(const QByteArrayView &lhs, const QByteArrayView &rhs)
+ \fn int QByteArrayView::operator!=(const QByteArrayView &lhs, const QByteArrayView &rhs)
+ \fn int QByteArrayView::operator< (const QByteArrayView &lhs, const QByteArrayView &rhs)
+ \fn int QByteArrayView::operator<=(const QByteArrayView &lhs, const QByteArrayView &rhs)
+ \fn int QByteArrayView::operator> (const QByteArrayView &lhs, const QByteArrayView &rhs)
+ \fn int QByteArrayView::operator>=(const QByteArrayView &lhs, const QByteArrayView &rhs)
Comparison operators for QByteArrayView.
*/
@@ -481,7 +490,7 @@
*/
/*!
- \fn int QByteArrayView::length() const
+ \fn QByteArrayView::length() const
Same as size().
@@ -562,8 +571,10 @@
Returns a byte array view that points to \a n bytes of this byte array
view, starting at position \a pos.
+//! [UB-sliced-index-length]
\note The behavior is undefined when \a pos < 0, \a n < 0,
or \a pos + \a n > size().
+//! [UB-sliced-index-length]
\sa first(), last(), chopped(), chop(), truncate()
*/
@@ -574,7 +585,9 @@
Returns a byte array view starting at position \a pos in this object,
and extending to its end.
+//! [UB-sliced-index-only]
\note The behavior is undefined when \a pos < 0 or \a pos > size().
+//! [UB-sliced-index-only]
\sa first(), last(), chopped(), chop(), truncate()
*/
@@ -618,6 +631,54 @@
*/
/*!
+ \fn QByteArrayView QByteArrayView::mid(qsizetype start, qsizetype length) const
+ \since 6.5
+
+ \deprecated Use sliced() instead in new code.
+
+ Returns the subarray of length \a length starting at position
+ \a start in this object.
+
+ Returns an empty byte array view if \a start exceeds the
+ length of the byte array view. If there are less than \a length characters
+ available in the byte array view starting at \a start, or if
+ \a length is negative (default), the function returns all characters that
+ are available from \a start.
+
+ \sa first(), last(), sliced(), chopped(), chop(), truncate()
+*/
+
+/*!
+ \fn QByteArrayView QByteArrayView::left(qsizetype length) const
+ \since 6.5
+
+ \deprecated Use first() instead in new code.
+
+ Returns the subarray of length \a length starting at position
+ 0 in this object.
+
+ The entire byte array view is returned if \a length is greater than or equal
+ to size(), or less than zero.
+
+ \sa first(), last(), sliced(), startsWith(), chopped(), chop(), truncate()
+*/
+
+/*!
+ \fn QByteArrayView QByteArrayView::right(qsizetype length) const
+ \since 6.5
+
+ \deprecated Use last() instead in new code.
+
+ Returns the subarray of length \a length starting at position
+ size() - \a length in this object.
+
+ The entire byte array view is returned if \a length is greater than or equal
+ to size(), or less than zero.
+
+ \sa first(), last(), sliced(), endsWith(), chopped(), chop(), truncate()
+*/
+
+/*!
\fn QByteArrayView QByteArrayView::trimmed() const noexcept
\since 6.3
@@ -901,8 +962,7 @@
respectively, in this byte array view, searching forward from index position
\a from.Returns -1 if no match is found.
- If \a from is -1, the search starts at the last character; if it is
- -2, at the next to last character and so on.
+ \include qstring.qdocinc negative-index-start-search-from-end
\sa lastIndexOf(), contains()
*/
@@ -925,8 +985,10 @@
Returns the index position of either the start of the last occurrence of
the sequence of bytes viewed by \a bv or the last occurrence of byte \a ch,
respectively, in this byte array view, searching backward from index position
- \a from. If \a from is -1, the search starts at the last character;
- if \a from is -2, at the next to last character and so on.
+ \a from.
+
+ \include qstring.qdocinc negative-index-start-search-from-end
+
Returns -1 if no match is found.
\note When searching for a 0-length \a bv, the match at the end of
@@ -983,3 +1045,12 @@
\sa QByteArray::isNull(), QByteArrayView
*/
+
+/*!
+ \fn QByteArrayView::operator std::string_view() const
+ \since 6.7
+
+ Converts this QByteArrayView object to a \c{std::string_view} object.
+ The returned view will have the same data pointer and length of
+ this view.
+*/