summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qutf8stringview.qdoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/text/qutf8stringview.qdoc')
-rw-r--r--src/corelib/text/qutf8stringview.qdoc91
1 files changed, 54 insertions, 37 deletions
diff --git a/src/corelib/text/qutf8stringview.qdoc b/src/corelib/text/qutf8stringview.qdoc
index deac0882fe..b433e5b995 100644
--- a/src/corelib/text/qutf8stringview.qdoc
+++ b/src/corelib/text/qutf8stringview.qdoc
@@ -1,29 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*!
\class QUtf8StringView
@@ -35,6 +11,14 @@
\ingroup tools
\ingroup string-processing
+ \compares strong
+ \compareswith strong char16_t QChar {const char16_t *} QString QStringView \
+ QLatin1StringView
+ \endcompareswith
+ \compareswith strong {const char *} QByteArray QByteArrayView
+ The contents of byte arrays is interpreted as utf-8.
+ \endcompareswith
+
A QUtf8StringView references a contiguous portion of a UTF-8
string it does not own. It acts as an interface type to all kinds
of UTF-8 string, without the need to construct a QString or
@@ -228,6 +212,11 @@
*/
/*!
+ \fn QUtf8StringView::QUtf8StringView(const storage_type *d, qsizetype n)
+ \internal
+*/
+
+/*!
\fn QUtf8StringView::QUtf8StringView(std::nullptr_t)
Constructs a null string view.
@@ -236,7 +225,7 @@
*/
/*!
- \fn template <typename Char> QUtf8StringView::QUtf8StringView(const Char *str, qsizetype len)
+ \fn template <typename Char, QUtf8StringView::if_compatible_char<Char> = true> QUtf8StringView::QUtf8StringView(const Char *str, qsizetype len)
Constructs a string view on \a str with length \a len.
@@ -252,7 +241,7 @@
*/
/*!
- \fn template <typename Char> QUtf8StringView::QUtf8StringView(const Char *first, const Char *last)
+ \fn template <typename Char, QUtf8StringView::if_compatible_char<Char> = true> QUtf8StringView::QUtf8StringView(const Char *first, const Char *last)
Constructs a string view on \a first with length (\a last - \a first).
@@ -306,26 +295,26 @@
*/
/*!
- \fn template <typename Container, if_compatible_container<Container>> QUtf8StringView::QUtf8StringView(const Container &str)
+ \fn template <typename Container, QUtf8StringView::if_compatible_container<Container>> QUtf8StringView::QUtf8StringView(const Container &str)
- Constructs a string view on \a str. The length is taken from \c{str.size()}.
+ Constructs a string view on \a str. The length is taken from \c{std::size(str)}.
- \c{str.data()} must remain valid for the lifetime of this string view object.
+ \c{std::data(str)} must remain valid for the lifetime of this string view object.
- This constructor only participates in overload resolution if \c Container is an
- instantiation of \c std::basic_string with a compatible character type. The
+ This constructor only participates in overload resolution if \c Container is a
+ container with a compatible character type as \c{value_type}. The
compatible character types are: \c char8_t, \c char, \c{signed char} and
\c{unsigned char}.
- The string view will be empty if and only if \c{str.empty()}. It is unspecified
- whether this constructor can result in a null string view (\c{str.data()} would
+ The string view will be empty if and only if \c{std::size(str) == 0}. It is unspecified
+ whether this constructor can result in a null string view (\c{std::data(str)} would
have to return \nullptr for this).
\sa isNull(), isEmpty()
*/
/*!
- \fn template <typename Char, size_t Size, if_compatible_char<Char>> QUtf8StringView::fromArray(const Char (&string)[Size])
+ \fn template <typename Char, size_t Size, QUtf8StringView::if_compatible_char<Char>> QUtf8StringView::fromArray(const Char (&string)[Size])
Constructs a string view on the full character string literal \a string,
including any trailing \c{Char(0)}. If you don't want the
@@ -497,7 +486,7 @@
*/
/*!
- \fn int QUtf8StringView::length() const
+ \fn QUtf8StringView::length() const
Same as size().
@@ -624,8 +613,10 @@
Returns a string view containing \a n code points of this string 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()
*/
@@ -636,7 +627,9 @@
Returns a string 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()
*/
@@ -679,6 +672,20 @@
*/
/*!
+ \fn int QUtf8StringView::compare(QLatin1StringView str, Qt::CaseSensitivity cs) const
+ \fn int QUtf8StringView::compare(QUtf8StringView str, Qt::CaseSensitivity cs) const
+ \fn int QUtf8StringView::compare(QStringView str, Qt::CaseSensitivity cs) const
+ \since 6.5
+
+ Compares this string view with \a str and returns a negative integer if
+ this string view is less than \a str, a positive integer if it is greater than
+ \a str, and zero if they are equal.
+
+ \include qstring.qdocinc {search-comparison-case-sensitivity} {comparison}
+*/
+
+
+/*!
\fn QUtf8StringView::isValidUtf8() const
Returns \c true if this string contains valid UTF-8 encoded data,
@@ -701,3 +708,13 @@
\sa QByteArray::isNull(), QUtf8StringView
*/
+
+
+/*! \fn QUtf8StringView::operator std::basic_string_view<storage_type>() const
+ \since 6.7
+
+ Converts this QUtf8StringView object to a
+ \c{std::basic_string_view} object. The returned view will have the
+ same data pointer and length of this view. The character type of
+ the returned view will be \c{storage_type}.
+*/