summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstring.cpp
diff options
context:
space:
mode:
authorSona Kurazyan <sona.kurazyan@qt.io>2022-03-09 19:28:01 +0100
committerSona Kurazyan <sona.kurazyan@qt.io>2022-03-23 18:06:51 +0100
commit76db8a0b1b80ae4b6741a72c7e8f5048c155c5b2 (patch)
tree82d4db44b5da744937d8edd076e4172c87b7d6e0 /src/corelib/text/qstring.cpp
parent4167a920ed36a5756a07668c3993d723ffbc60bf (diff)
Use QLatin1StringView in QString/QLatin1String APIs and docs
- Replaced QLatin1String with QLatin1StringView in QString/QLatin1String APIs and docs (except for QLatin1String class declaration and ctor names). - Made the docs look like QLatin1StringView is "The Real Thing". [ChangeLog][QtCore] Made QLatin1StringView the recommended name for referring to a Latin-1 string view (instead of QLatin1String). Task-number: QTBUG-98434 Change-Id: I6d9a85cc956c6da0c910ad7d23be7956e4bd94ac Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/text/qstring.cpp')
-rw-r--r--src/corelib/text/qstring.cpp540
1 files changed, 276 insertions, 264 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index edc2773707..de4df9fff3 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -79,7 +79,7 @@
#include "qstringalgorithms_p.h"
#include "qthreadstorage.h"
-#include "qbytearraymatcher.h" // Helper for comparison of QLatin1String
+#include "qbytearraymatcher.h" // Helper for comparison of QLatin1StringView
#include <algorithm>
#include <functional>
@@ -732,7 +732,7 @@ bool qt_is_ascii(const char *&ptr, const char *end) noexcept
return true;
}
-bool QtPrivate::isAscii(QLatin1String s) noexcept
+bool QtPrivate::isAscii(QLatin1StringView s) noexcept
{
const char *ptr = s.begin();
const char *end = s.end();
@@ -1053,7 +1053,7 @@ Q_NEVER_INLINE static int ucstricmp(qsizetype alen, const char16_t *a, qsizetype
return 1;
}
-// Case-insensitive comparison between a QStringView and a QLatin1String
+// Case-insensitive comparison between a QStringView and a QLatin1StringView
// (argument order matches those types)
Q_NEVER_INLINE static int ucstricmp(qsizetype alen, const char16_t *a, qsizetype blen, const char *b)
{
@@ -1398,7 +1398,7 @@ static constexpr uchar latin1Lower[256] = {
};
static int latin1nicmp(const char *lhsChar, qsizetype lSize, const char *rhsChar, qsizetype rSize)
{
- // We're called with QLatin1String's .data() and .size():
+ // We're called with QLatin1StringView's .data() and .size():
Q_ASSERT(lSize >= 0 && rSize >= 0);
if (!lSize)
return rSize ? -1 : 0;
@@ -1420,17 +1420,17 @@ bool QtPrivate::equalStrings(QStringView lhs, QStringView rhs) noexcept
return ucstreq(lhs.utf16(), lhs.size(), rhs.utf16(), rhs.size());
}
-bool QtPrivate::equalStrings(QStringView lhs, QLatin1String rhs) noexcept
+bool QtPrivate::equalStrings(QStringView lhs, QLatin1StringView rhs) noexcept
{
return ucstreq(lhs.utf16(), lhs.size(), rhs.latin1(), rhs.size());
}
-bool QtPrivate::equalStrings(QLatin1String lhs, QStringView rhs) noexcept
+bool QtPrivate::equalStrings(QLatin1StringView lhs, QStringView rhs) noexcept
{
return QtPrivate::equalStrings(rhs, lhs);
}
-bool QtPrivate::equalStrings(QLatin1String lhs, QLatin1String rhs) noexcept
+bool QtPrivate::equalStrings(QLatin1StringView lhs, QLatin1StringView rhs) noexcept
{
return lhs.size() == rhs.size() && (!lhs.size() || memcmp(lhs.data(), rhs.data(), lhs.size()) == 0);
}
@@ -1445,13 +1445,13 @@ bool QtPrivate::equalStrings(QStringView lhs, QBasicUtf8StringView<false> rhs) n
return QtPrivate::equalStrings(rhs, lhs);
}
-bool QtPrivate::equalStrings(QLatin1String lhs, QBasicUtf8StringView<false> rhs) noexcept
+bool QtPrivate::equalStrings(QLatin1StringView lhs, QBasicUtf8StringView<false> rhs) noexcept
{
QString r = rhs.toString();
return QtPrivate::equalStrings(lhs, r); // ### optimize!
}
-bool QtPrivate::equalStrings(QBasicUtf8StringView<false> lhs, QLatin1String rhs) noexcept
+bool QtPrivate::equalStrings(QBasicUtf8StringView<false> lhs, QLatin1StringView rhs) noexcept
{
return QtPrivate::equalStrings(rhs, lhs);
}
@@ -1512,7 +1512,7 @@ int QtPrivate::compareStrings(QStringView lhs, QStringView rhs, Qt::CaseSensitiv
\sa {Comparing Strings}
*/
-int QtPrivate::compareStrings(QStringView lhs, QLatin1String rhs, Qt::CaseSensitivity cs) noexcept
+int QtPrivate::compareStrings(QStringView lhs, QLatin1StringView rhs, Qt::CaseSensitivity cs) noexcept
{
if (cs == Qt::CaseSensitive)
return ucstrcmp(lhs.utf16(), lhs.size(), rhs.latin1(), rhs.size());
@@ -1536,7 +1536,7 @@ int QtPrivate::compareStrings(QStringView lhs, QBasicUtf8StringView<false> rhs,
\since 5.10
\overload
*/
-int QtPrivate::compareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensitivity cs) noexcept
+int QtPrivate::compareStrings(QLatin1StringView lhs, QStringView rhs, Qt::CaseSensitivity cs) noexcept
{
return -compareStrings(rhs, lhs, cs);
}
@@ -1558,7 +1558,7 @@ int QtPrivate::compareStrings(QLatin1String lhs, QStringView rhs, Qt::CaseSensit
\sa {Comparing Strings}
*/
-int QtPrivate::compareStrings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSensitivity cs) noexcept
+int QtPrivate::compareStrings(QLatin1StringView lhs, QLatin1StringView rhs, Qt::CaseSensitivity cs) noexcept
{
if (lhs.isEmpty())
return lencmp(qsizetype(0), rhs.size());
@@ -1575,7 +1575,7 @@ int QtPrivate::compareStrings(QLatin1String lhs, QLatin1String rhs, Qt::CaseSens
\since 6.0
\overload
*/
-int QtPrivate::compareStrings(QLatin1String lhs, QBasicUtf8StringView<false> rhs, Qt::CaseSensitivity cs) noexcept
+int QtPrivate::compareStrings(QLatin1StringView lhs, QBasicUtf8StringView<false> rhs, Qt::CaseSensitivity cs) noexcept
{
return compareStrings(lhs, rhs.toString(), cs); // ### optimize!
}
@@ -1599,7 +1599,7 @@ int QtPrivate::compareStrings(QBasicUtf8StringView<false> lhs, QStringView rhs,
\since 6.0
\overload
*/
-int QtPrivate::compareStrings(QBasicUtf8StringView<false> lhs, QLatin1String rhs, Qt::CaseSensitivity cs) noexcept
+int QtPrivate::compareStrings(QBasicUtf8StringView<false> lhs, QLatin1StringView rhs, Qt::CaseSensitivity cs) noexcept
{
return -compareStrings(rhs, lhs, cs);
}
@@ -1679,7 +1679,7 @@ void qtWarnAboutInvalidRegularExpression(const QString &pattern, const char *whe
and the \c{QString::operator=(const char (&ch)[N])} assignment operator.
This gives most of the type-safety benefits of \l QT_NO_CAST_FROM_ASCII
but does not require user code to wrap character and string literals
- with QLatin1Char, QLatin1String or similar.
+ with QLatin1Char, QLatin1StringView or similar.
Using this macro together with source strings outside the 7-bit range,
non-literals, or literals with embedded NUL characters is undefined.
@@ -1984,7 +1984,7 @@ void qtWarnAboutInvalidRegularExpression(const QString &pattern, const char *whe
You then need to explicitly call fromUtf8(), fromLatin1(),
or fromLocal8Bit() to construct a QString from an
- 8-bit string, or use the lightweight QLatin1String class, for
+ 8-bit string, or use the lightweight QLatin1StringView class, for
example:
\snippet code/src_corelib_text_qstring.cpp 1
@@ -2066,7 +2066,7 @@ void qtWarnAboutInvalidRegularExpression(const QString &pattern, const char *whe
time. Constructing a QString out of the literal does then not cause
any overhead at runtime.
- A slightly less efficient way is to use QLatin1String. This class wraps
+ A slightly less efficient way is to use QLatin1StringView. This class wraps
a C string literal, precalculates it length at compile time and can
then be used for faster comparison with QStrings and conversion to
QStrings than a regular C string literal.
@@ -2145,7 +2145,7 @@ void qtWarnAboutInvalidRegularExpression(const QString &pattern, const char *whe
Such considerations, the configuration of such behavior or any mitigation
are outside the scope of the Qt API.
- \sa fromRawData(), QChar, QStringView, QLatin1String, QByteArray
+ \sa fromRawData(), QChar, QStringView, QLatin1StringView, QByteArray
*/
/*! \typedef QString::ConstIterator
@@ -2552,7 +2552,7 @@ QString::QString(qsizetype size, Qt::Initialization)
}
}
-/*! \fn QString::QString(QLatin1String str)
+/*! \fn QString::QString(QLatin1StringView str)
Constructs a copy of the Latin-1 string \a str.
@@ -2825,13 +2825,13 @@ QString &QString::operator=(const QString &other) noexcept
\since 5.2
*/
-/*! \fn QString &QString::operator=(QLatin1String str)
+/*! \fn QString &QString::operator=(QLatin1StringView str)
\overload operator=()
Assigns the Latin-1 string \a str to this string.
*/
-QString &QString::operator=(QLatin1String other)
+QString &QString::operator=(QLatin1StringView other)
{
const qsizetype capacityAtEnd = capacity() - d.freeSpaceAtBegin();
if (isDetached() && other.size() <= capacityAtEnd) { // assumes d->alloc == 0 -> !isDetached() (sharedNull)
@@ -2951,14 +2951,14 @@ QString &QString::operator=(QChar ch)
*/
/*!
- \fn QString &QString::insert(qsizetype position, QLatin1String str)
+ \fn QString &QString::insert(qsizetype position, QLatin1StringView str)
\overload insert()
Inserts the Latin-1 string \a str at the given index \a position.
\include qstring.cpp string-grow-at-insertion
*/
-QString &QString::insert(qsizetype i, QLatin1String str)
+QString &QString::insert(qsizetype i, QLatin1StringView str)
{
const char *s = str.latin1();
if (i < 0 || !s || !(*s))
@@ -3092,7 +3092,7 @@ QString &QString::append(const QChar *str, qsizetype len)
Appends the Latin-1 string \a str to this string.
*/
-QString &QString::append(QLatin1String str)
+QString &QString::append(QLatin1StringView str)
{
const char *s = str.latin1();
const qsizetype len = str.size();
@@ -3165,7 +3165,7 @@ QString &QString::append(QChar ch)
\sa append(), insert()
*/
-/*! \fn QString &QString::prepend(QLatin1String str)
+/*! \fn QString &QString::prepend(QLatin1StringView str)
\overload prepend()
@@ -3325,7 +3325,7 @@ QString &QString::remove(const QString &str, Qt::CaseSensitivity cs)
\sa replace()
*/
-QString &QString::remove(QLatin1String str, Qt::CaseSensitivity cs)
+QString &QString::remove(QLatin1StringView str, Qt::CaseSensitivity cs)
{
removeStringImpl(*this, str, cs);
return *this;
@@ -3723,7 +3723,7 @@ QString& QString::replace(QChar before, QChar after, Qt::CaseSensitivity cs)
\note The text is not rescanned after a replacement.
*/
-QString &QString::replace(QLatin1String before, QLatin1String after, Qt::CaseSensitivity cs)
+QString &QString::replace(QLatin1StringView before, QLatin1StringView after, Qt::CaseSensitivity cs)
{
qsizetype alen = after.size();
qsizetype blen = before.size();
@@ -3746,7 +3746,7 @@ QString &QString::replace(QLatin1String before, QLatin1String after, Qt::CaseSen
\note The text is not rescanned after a replacement.
*/
-QString &QString::replace(QLatin1String before, const QString &after, Qt::CaseSensitivity cs)
+QString &QString::replace(QLatin1StringView before, const QString &after, Qt::CaseSensitivity cs)
{
qsizetype blen = before.size();
QVarLengthArray<char16_t> b(blen);
@@ -3766,7 +3766,7 @@ QString &QString::replace(QLatin1String before, const QString &after, Qt::CaseSe
\note The text is not rescanned after a replacement.
*/
-QString &QString::replace(const QString &before, QLatin1String after, Qt::CaseSensitivity cs)
+QString &QString::replace(const QString &before, QLatin1StringView after, Qt::CaseSensitivity cs)
{
qsizetype alen = after.size();
QVarLengthArray<char16_t> a(alen);
@@ -3786,7 +3786,7 @@ QString &QString::replace(const QString &before, QLatin1String after, Qt::CaseSe
\note The text is not rescanned after a replacement.
*/
-QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
+QString &QString::replace(QChar c, QLatin1StringView after, Qt::CaseSensitivity cs)
{
qsizetype alen = after.size();
QVarLengthArray<char16_t> a(alen);
@@ -3806,7 +3806,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator==(const QString &s1, QLatin1String s2)
+ \fn bool QString::operator==(const QString &s1, QLatin1StringView s2)
\overload operator==()
@@ -3815,7 +3815,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator==(QLatin1String s1, const QString &s2)
+ \fn bool QString::operator==(QLatin1StringView s1, const QString &s2)
\overload operator==()
@@ -3864,7 +3864,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator<(const QString &s1, QLatin1String s2)
+ \fn bool QString::operator<(const QString &s1, QLatin1StringView s2)
\overload operator<()
@@ -3873,7 +3873,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator<(QLatin1String s1, const QString &s2)
+ \fn bool QString::operator<(QLatin1StringView s1, const QString &s2)
\overload operator<()
@@ -3920,7 +3920,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator<=(const QString &s1, QLatin1String s2)
+ \fn bool QString::operator<=(const QString &s1, QLatin1StringView s2)
\overload operator<=()
@@ -3929,7 +3929,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator<=(QLatin1String s1, const QString &s2)
+ \fn bool QString::operator<=(QLatin1StringView s1, const QString &s2)
\overload operator<=()
@@ -3973,7 +3973,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator>(const QString &s1, QLatin1String s2)
+ \fn bool QString::operator>(const QString &s1, QLatin1StringView s2)
\overload operator>()
@@ -3982,7 +3982,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator>(QLatin1String s1, const QString &s2)
+ \fn bool QString::operator>(QLatin1StringView s1, const QString &s2)
\overload operator>()
@@ -4026,7 +4026,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator>=(const QString &s1, QLatin1String s2)
+ \fn bool QString::operator>=(const QString &s1, QLatin1StringView s2)
\overload operator>=()
@@ -4035,7 +4035,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
*/
/*!
- \fn bool QString::operator>=(QLatin1String s1, const QString &s2)
+ \fn bool QString::operator>=(QLatin1StringView s1, const QString &s2)
\overload operator>=()
@@ -4078,7 +4078,7 @@ QString &QString::replace(QChar c, QLatin1String after, Qt::CaseSensitivity cs)
\sa {Comparing Strings}
*/
-/*! \fn bool QString::operator!=(const QString &s1, QLatin1String s2)
+/*! \fn bool QString::operator!=(const QString &s1, QLatin1StringView s2)
Returns \c true if string \a s1 is not equal to string \a s2.
Otherwise returns \c false.
@@ -4174,7 +4174,7 @@ qsizetype QString::indexOf(const QString &str, qsizetype from, Qt::CaseSensitivi
\sa lastIndexOf(), contains(), count()
*/
-qsizetype QString::indexOf(QLatin1String str, qsizetype from, Qt::CaseSensitivity cs) const
+qsizetype QString::indexOf(QLatin1StringView str, qsizetype from, Qt::CaseSensitivity cs) const
{
return QtPrivate::findString(QStringView(unicode(), size()), from, str, cs);
}
@@ -4266,13 +4266,13 @@ qsizetype QString::lastIndexOf(const QString &str, qsizetype from, Qt::CaseSensi
\sa indexOf(), contains(), count()
*/
-qsizetype QString::lastIndexOf(QLatin1String str, qsizetype from, Qt::CaseSensitivity cs) const
+qsizetype QString::lastIndexOf(QLatin1StringView str, qsizetype from, Qt::CaseSensitivity cs) const
{
return QtPrivate::lastIndexOf(*this, from, str, cs);
}
/*!
- \fn qsizetype QString::lastIndexOf(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ \fn qsizetype QString::lastIndexOf(QLatin1StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
\since 6.2
\overload lastIndexOf()
@@ -4546,7 +4546,7 @@ qsizetype QString::count(QStringView str, Qt::CaseSensitivity cs) const
*/
#endif // QT_STRINGVIEW_LEVEL < 2
-/*! \fn bool QString::contains(QLatin1String str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+/*! \fn bool QString::contains(QLatin1StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
\since 5.3
\overload contains()
@@ -5091,7 +5091,7 @@ bool QString::startsWith(const QString& s, Qt::CaseSensitivity cs) const
/*!
\overload startsWith()
*/
-bool QString::startsWith(QLatin1String s, Qt::CaseSensitivity cs) const
+bool QString::startsWith(QLatin1StringView s, Qt::CaseSensitivity cs) const
{
return qt_starts_with_impl(QStringView(*this), s, cs);
}
@@ -5159,7 +5159,7 @@ bool QString::endsWith(const QString &s, Qt::CaseSensitivity cs) const
/*!
\overload endsWith()
*/
-bool QString::endsWith(QLatin1String s, Qt::CaseSensitivity cs) const
+bool QString::endsWith(QLatin1StringView s, Qt::CaseSensitivity cs) const
{
return qt_ends_with_impl(QStringView(*this), s, cs);
}
@@ -5774,7 +5774,7 @@ namespace {
/*!
\fn QStringView QtPrivate::trimmed(QStringView s)
- \fn QLatin1String QtPrivate::trimmed(QLatin1String s)
+ \fn QLatin1StringView QtPrivate::trimmed(QLatin1StringView s)
\internal
\relates QStringView
\since 5.10
@@ -5785,14 +5785,14 @@ namespace {
\c true. This includes the ASCII characters '\\t', '\\n', '\\v',
'\\f', '\\r', and ' '.
- \sa QString::trimmed(), QStringView::trimmed(), QLatin1String::trimmed()
+ \sa QString::trimmed(), QStringView::trimmed(), QLatin1StringView::trimmed()
*/
QStringView QtPrivate::trimmed(QStringView s) noexcept
{
return qt_trimmed(s);
}
-QLatin1String QtPrivate::trimmed(QLatin1String s) noexcept
+QLatin1StringView QtPrivate::trimmed(QLatin1StringView s) noexcept
{
return qt_trimmed(s);
}
@@ -6050,7 +6050,7 @@ QString& QString::fill(QChar ch, qsizetype size)
\sa append(), prepend()
*/
-/*! \fn QString &QString::operator+=(QLatin1String str)
+/*! \fn QString &QString::operator+=(QLatin1StringView str)
\overload operator+=()
@@ -6211,7 +6211,7 @@ QString& QString::fill(QChar ch, qsizetype size)
*/
/*!
- \fn int QString::compare(const QString &s1, QLatin1String s2, Qt::CaseSensitivity cs)
+ \fn int QString::compare(const QString &s1, QLatin1StringView s2, Qt::CaseSensitivity cs)
\since 4.2
\overload compare()
@@ -6220,7 +6220,7 @@ QString& QString::fill(QChar ch, qsizetype size)
*/
/*!
- \fn int QString::compare(QLatin1String s1, const QString &s2, Qt::CaseSensitivity cs = Qt::CaseSensitive)
+ \fn int QString::compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs = Qt::CaseSensitive)
\since 4.2
\overload compare()
@@ -6287,7 +6287,7 @@ int QString::compare_helper(const QChar *data1, qsizetype length1, const QChar *
Same as compare(*this, \a other, \a cs).
*/
-int QString::compare(QLatin1String other, Qt::CaseSensitivity cs) const noexcept
+int QString::compare(QLatin1StringView other, Qt::CaseSensitivity cs) const noexcept
{
return QtPrivate::compareStrings(*this, other, cs);
}
@@ -6323,8 +6323,8 @@ int QString::compare_helper(const QChar *data1, qsizetype length1, const char *d
\internal
\since 4.5
*/
-int QLatin1String::compare_helper(const QChar *data1, qsizetype length1, QLatin1String s2,
- Qt::CaseSensitivity cs) noexcept
+int QLatin1StringView::compare_helper(const QChar *data1, qsizetype length1, QLatin1StringView s2,
+ Qt::CaseSensitivity cs) noexcept
{
Q_ASSERT(length1 >= 0);
Q_ASSERT(data1 || length1 == 0);
@@ -6890,7 +6890,7 @@ QString QString::vasprintf(const char *cformat, va_list ap)
uint flags = parse_flag_characters(c);
if (*c == '\0') {
- result.append(QLatin1String(escape_start)); // incomplete escape, treat as non-escape text
+ result.append(QLatin1StringView(escape_start)); // incomplete escape, treat as non-escape text
break;
}
@@ -6906,7 +6906,7 @@ QString QString::vasprintf(const char *cformat, va_list ap)
}
if (*c == '\0') {
- result.append(QLatin1String(escape_start)); // incomplete escape, treat as non-escape text
+ result.append(QLatin1StringView(escape_start)); // incomplete escape, treat as non-escape text
break;
}
@@ -6925,14 +6925,14 @@ QString QString::vasprintf(const char *cformat, va_list ap)
}
if (*c == '\0') {
- result.append(QLatin1String(escape_start)); // incomplete escape, treat as non-escape text
+ result.append(QLatin1StringView(escape_start)); // incomplete escape, treat as non-escape text
break;
}
const LengthMod length_mod = parse_length_modifier(c);
if (*c == '\0') {
- result.append(QLatin1String(escape_start)); // incomplete escape, treat as non-escape text
+ result.append(QLatin1StringView(escape_start)); // incomplete escape, treat as non-escape text
break;
}
@@ -8222,7 +8222,7 @@ QString QString::arg(QStringView a, int fieldWidth, QChar fillChar) const
is printed and the result is undefined. Place-marker numbers must be
in the range 1 to 99.
*/
-QString QString::arg(QLatin1String a, int fieldWidth, QChar fillChar) const
+QString QString::arg(QLatin1StringView a, int fieldWidth, QChar fillChar) const
{
QVarLengthArray<char16_t> utf16(a.size());
qt_from_latin1(utf16.data(), a.data(), a.size());
@@ -8596,11 +8596,11 @@ struct Part
Part() = default; // for QVarLengthArray; do not use
constexpr Part(QStringView s, int num = -1)
: tag{QtPrivate::ArgBase::U16}, number{num}, data{s.utf16()}, size{s.size()} {}
- constexpr Part(QLatin1String s, int num = -1)
+ constexpr Part(QLatin1StringView s, int num = -1)
: tag{QtPrivate::ArgBase::L1}, number{num}, data{s.data()}, size{s.size()} {}
void reset(QStringView s) noexcept { *this = {s, number}; }
- void reset(QLatin1String s) noexcept { *this = {s, number}; }
+ void reset(QLatin1StringView s) noexcept { *this = {s, number}; }
QtPrivate::ArgBase::Tag tag;
int number;
@@ -8695,7 +8695,7 @@ static qsizetype resolveStringRefsAndReturnTotalSize(ParseResult &parts, const A
} // unnamed namespace
-Q_ALWAYS_INLINE QString to_string(QLatin1String s) noexcept { return s; }
+Q_ALWAYS_INLINE QString to_string(QLatin1StringView s) noexcept { return s; }
Q_ALWAYS_INLINE QString to_string(QStringView s) noexcept { return s.toString(); }
template <typename StringView>
@@ -8747,7 +8747,7 @@ QString QtPrivate::argToQString(QStringView pattern, size_t n, const ArgBase **a
return argToQStringImpl(pattern, n, args);
}
-QString QtPrivate::argToQString(QLatin1String pattern, size_t n, const ArgBase **args)
+QString QtPrivate::argToQString(QLatin1StringView pattern, size_t n, const ArgBase **args)
{
return argToQStringImpl(pattern, n, args);
}
@@ -9004,9 +9004,9 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa toUcs4(), toStdWString(), toStdU16String()
*/
-/*! \class QLatin1String
+/*! \class QLatin1StringView
\inmodule QtCore
- \brief The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
+ \brief The QLatin1StringView class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
\ingroup string-processing
\reentrant
@@ -9032,9 +9032,9 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
Applications that define \l QT_NO_CAST_FROM_ASCII (as explained
in the QString documentation) don't have access to QString's
\c{const char *} API. To provide an efficient way of specifying
- constant Latin-1 strings, Qt provides the QLatin1String, which is
+ constant Latin-1 strings, Qt provides the QLatin1StringView, which is
just a very thin wrapper around a \c{const char *}. Using
- QLatin1String, the example code above becomes
+ QLatin1StringView, the example code above becomes
\snippet code/src_corelib_text_qstring.cpp 5
@@ -9042,16 +9042,16 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
benefits as the first version of the code, and is faster than
converting the Latin-1 strings using QString::fromLatin1().
- Thanks to the QString(QLatin1String) constructor,
- QLatin1String can be used everywhere a QString is expected. For
+ Thanks to the QString(QLatin1StringView) constructor,
+ QLatin1StringView can be used everywhere a QString is expected. For
example:
\snippet code/src_corelib_text_qstring.cpp 6
- \note If the function you're calling with a QLatin1String
- argument isn't actually overloaded to take QLatin1String, the
+ \note If the function you're calling with a QLatin1StringView
+ argument isn't actually overloaded to take QLatin1StringView, the
implicit conversion to QString will trigger a memory allocation,
- which is usually what you want to avoid by using QLatin1String
+ which is usually what you want to avoid by using QLatin1StringView
in the first place. In those cases, using QStringLiteral may be
the better option.
@@ -9060,112 +9060,124 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \typedef QLatin1String::value_type
+ \class QLatin1String
+ \inmodule QtCore
+ \brief QLatin1String is the same as QLatin1StringView.
+
+ QLatin1String is a view to a Latin-1 string. It's the same as
+ QLatin1StringView and is kept for compatibility reasons. It is
+ recommended to use QLatin1StringView instead.
+
+ Please see the QLatin1StringView documentation for details.
+*/
+
+/*!
+ \typedef QLatin1StringView::value_type
\since 5.10
Alias for \c{const char}. Provided for compatibility with the STL.
*/
/*!
- \typedef QLatin1String::difference_type
+ \typedef QLatin1StringView::difference_type
\since 5.10
Alias for \c{qsizetype}. Provided for compatibility with the STL.
*/
/*!
- \typedef QLatin1String::size_type
+ \typedef QLatin1StringView::size_type
\since 5.10
Alias for \c{qsizetype}. Provided for compatibility with the STL.
\note In version prior to Qt 6, this was an alias for \c{int},
- restricting the amount of data that could be held in a QLatin1String
+ restricting the amount of data that could be held in a QLatin1StringView
on 64-bit architectures.
*/
/*!
- \typedef QLatin1String::reference
+ \typedef QLatin1StringView::reference
\since 5.10
Alias for \c{value_type &}. Provided for compatibility with the STL.
*/
/*!
- \typedef QLatin1String::const_reference
+ \typedef QLatin1StringView::const_reference
\since 5.11
Alias for \c{reference}. Provided for compatibility with the STL.
*/
/*!
- \typedef QLatin1String::iterator
+ \typedef QLatin1StringView::iterator
\since 5.10
- QLatin1String does not support mutable iterators, so this is the same
+ QLatin1StringView does not support mutable iterators, so this is the same
as const_iterator.
\sa const_iterator, reverse_iterator
*/
/*!
- \typedef QLatin1String::const_iterator
+ \typedef QLatin1StringView::const_iterator
\since 5.10
\sa iterator, const_reverse_iterator
*/
/*!
- \typedef QLatin1String::reverse_iterator
+ \typedef QLatin1StringView::reverse_iterator
\since 5.10
- QLatin1String does not support mutable reverse iterators, so this is the
+ QLatin1StringView does not support mutable reverse iterators, so this is the
same as const_reverse_iterator.
\sa const_reverse_iterator, iterator
*/
/*!
- \typedef QLatin1String::const_reverse_iterator
+ \typedef QLatin1StringView::const_reverse_iterator
\since 5.10
\sa reverse_iterator, const_iterator
*/
-/*! \fn QLatin1String::QLatin1String()
+/*! \fn QLatin1StringView::QLatin1StringView()
\since 5.6
- Constructs a QLatin1String object that stores a \nullptr.
+ Constructs a QLatin1StringView object that stores a \nullptr.
\sa data(), isEmpty(), isNull(), {Distinction Between Null and Empty Strings}
*/
-/*! \fn QLatin1String::QLatin1String(std::nullptr_t)
+/*! \fn QLatin1StringView::QLatin1StringView(std::nullptr_t)
\since 6.4
- Constructs a QLatin1String object that stores a \nullptr.
+ Constructs a QLatin1StringView object that stores a \nullptr.
\sa data(), isEmpty(), isNull(), {Distinction Between Null and Empty Strings}
*/
-/*! \fn QLatin1String::QLatin1String(const char *str)
+/*! \fn QLatin1StringView::QLatin1StringView(const char *str)
- Constructs a QLatin1String object that stores \a str.
+ Constructs a QLatin1StringView object that stores \a str.
The string data is \e not copied. The caller must be able to
guarantee that \a str will not be deleted or modified as long as
- the QLatin1String object exists.
+ the QLatin1StringView object exists.
\sa latin1()
*/
-/*! \fn QLatin1String::QLatin1String(const char *str, qsizetype size)
+/*! \fn QLatin1StringView::QLatin1StringView(const char *str, qsizetype size)
- Constructs a QLatin1String object that stores \a str with \a size.
+ Constructs a QLatin1StringView object that stores \a str with \a size.
The string data is \e not copied. The caller must be able to
guarantee that \a str will not be deleted or modified as long as
- the QLatin1String object exists.
+ the QLatin1StringView object exists.
\note: any null ('\\0') bytes in the byte array will be included in this
string, which will be converted to Unicode null characters (U+0000) if this
@@ -9175,10 +9187,10 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::QLatin1String(const char *first, const char *last)
+ \fn QLatin1StringView::QLatin1StringView(const char *first, const char *last)
\since 5.10
- Constructs a QLatin1String object that stores \a first with length
+ Constructs a QLatin1StringView object that stores \a first with length
(\a last - \a first).
The range \c{[first,last)} must remain valid for the lifetime of
@@ -9192,25 +9204,25 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
INT_MAX}.
*/
-/*! \fn QLatin1String::QLatin1String(const QByteArray &str)
+/*! \fn QLatin1StringView::QLatin1StringView(const QByteArray &str)
- Constructs a QLatin1String object that stores \a str.
+ Constructs a QLatin1StringView object that stores \a str.
The string data is \e not copied. The caller must be able to
guarantee that \a str will not be deleted or modified as long as
- the QLatin1String object exists.
+ the QLatin1StringView object exists.
\sa latin1()
*/
-/*! \fn QLatin1String::QLatin1String(QByteArrayView str)
+/*! \fn QLatin1StringView::QLatin1StringView(QByteArrayView str)
\since 6.3
- Constructs a QLatin1String object that stores \a str.
+ Constructs a QLatin1StringView object that stores \a str.
The string data is \e not copied. The caller must be able to
guarantee that the data which \a str is pointing to will not
- be deleted or modified as long as the QLatin1String object
+ be deleted or modified as long as the QLatin1StringView object
exists. The size is obtained from \a str as-is, without checking
for a null-terminator.
@@ -9222,7 +9234,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QString QLatin1String::toString() const
+ \fn QString QLatin1StringView::toString() const
\since 6.0
Converts this Latin-1 string into a QString. Equivalent to
@@ -9231,17 +9243,17 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\endcode
*/
-/*! \fn const char *QLatin1String::latin1() const
+/*! \fn const char *QLatin1StringView::latin1() const
Returns the start of the Latin-1 string referenced by this object.
*/
-/*! \fn const char *QLatin1String::data() const
+/*! \fn const char *QLatin1StringView::data() const
Returns the start of the Latin-1 string referenced by this object.
*/
-/*! \fn const char *QLatin1String::constData() const
+/*! \fn const char *QLatin1StringView::constData() const
\since 6.4
Returns the start of the Latin-1 string referenced by this object.
@@ -9251,16 +9263,16 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa data()
*/
-/*! \fn qsizetype QLatin1String::size() const
+/*! \fn qsizetype QLatin1StringView::size() const
Returns the size of the Latin-1 string referenced by this object.
\note In version prior to Qt 6, this function returned \c{int},
- restricting the amount of data that could be held in a QLatin1String
+ restricting the amount of data that could be held in a QLatin1StringView
on 64-bit architectures.
*/
-/*! \fn qsizetype QLatin1String::length() const
+/*! \fn qsizetype QLatin1StringView::length() const
\since 6.4
Same as size().
@@ -9268,7 +9280,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
This function is provided for compatibility with other Qt containers.
*/
-/*! \fn bool QLatin1String::isNull() const
+/*! \fn bool QLatin1StringView::isNull() const
\since 5.10
Returns whether the Latin-1 string referenced by this object is null
@@ -9277,7 +9289,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa isEmpty(), data()
*/
-/*! \fn bool QLatin1String::isEmpty() const
+/*! \fn bool QLatin1StringView::isEmpty() const
\since 5.10
Returns whether the Latin-1 string referenced by this object is empty
@@ -9286,7 +9298,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa isNull(), size()
*/
-/*! \fn bool QLatin1String::empty() const
+/*! \fn bool QLatin1StringView::empty() const
\since 6.4
Returns whether the Latin-1 string referenced by this object is empty
@@ -9297,7 +9309,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa isEmpty(), isNull(), size()
*/
-/*! \fn QLatin1Char QLatin1String::at(qsizetype pos) const
+/*! \fn QLatin1Char QLatin1StringView::at(qsizetype pos) const
\since 5.8
Returns the character at position \a pos in this object.
@@ -9308,7 +9320,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa operator[]()
*/
-/*! \fn QLatin1Char QLatin1String::operator[](qsizetype pos) const
+/*! \fn QLatin1Char QLatin1StringView::operator[](qsizetype pos) const
\since 5.8
Returns the character at position \a pos in this object.
@@ -9320,7 +9332,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1Char QLatin1String::front() const
+ \fn QLatin1Char QLatin1StringView::front() const
\since 5.10
Returns the first character in the string.
@@ -9335,7 +9347,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1Char QLatin1String::first() const
+ \fn QLatin1Char QLatin1StringView::first() const
\since 6.4
Returns the first character in the string.
@@ -9350,7 +9362,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1Char QLatin1String::back() const
+ \fn QLatin1Char QLatin1StringView::back() const
\since 5.10
Returns the last character in the string.
@@ -9365,7 +9377,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1Char QLatin1String::last() const
+ \fn QLatin1Char QLatin1StringView::last() const
\since 6.4
Returns the last character in the string.
@@ -9380,10 +9392,10 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn int QLatin1String::compare(QStringView str, Qt::CaseSensitivity cs) const
- \fn int QLatin1String::compare(QLatin1String l1, Qt::CaseSensitivity cs) const
- \fn int QLatin1String::compare(QChar ch) const
- \fn int QLatin1String::compare(QChar ch, Qt::CaseSensitivity cs) const
+ \fn int QLatin1StringView::compare(QStringView str, Qt::CaseSensitivity cs) const
+ \fn int QLatin1StringView::compare(QLatin1StringView l1, Qt::CaseSensitivity cs) const
+ \fn int QLatin1StringView::compare(QChar ch) const
+ \fn int QLatin1StringView::compare(QChar ch, Qt::CaseSensitivity cs) const
\since 5.14
Returns an integer that compares to zero as this Latin-1 string compares to the
@@ -9397,13 +9409,13 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
/*!
- \fn bool QLatin1String::startsWith(QStringView str, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::startsWith(QStringView str, Qt::CaseSensitivity cs) const
\since 5.10
- \fn bool QLatin1String::startsWith(QLatin1String l1, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::startsWith(QLatin1StringView l1, Qt::CaseSensitivity cs) const
\since 5.10
- \fn bool QLatin1String::startsWith(QChar ch) const
+ \fn bool QLatin1StringView::startsWith(QChar ch) const
\since 5.10
- \fn bool QLatin1String::startsWith(QChar ch, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::startsWith(QChar ch, Qt::CaseSensitivity cs) const
\since 5.10
Returns \c true if this Latin-1 string starts with string-view \a str,
@@ -9417,13 +9429,13 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::endsWith(QStringView str, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::endsWith(QStringView str, Qt::CaseSensitivity cs) const
\since 5.10
- \fn bool QLatin1String::endsWith(QLatin1String l1, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::endsWith(QLatin1StringView l1, Qt::CaseSensitivity cs) const
\since 5.10
- \fn bool QLatin1String::endsWith(QChar ch) const
+ \fn bool QLatin1StringView::endsWith(QChar ch) const
\since 5.10
- \fn bool QLatin1String::endsWith(QChar ch, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::endsWith(QChar ch, Qt::CaseSensitivity cs) const
\since 5.10
Returns \c true if this Latin-1 string ends with string-view \a str,
@@ -9437,9 +9449,9 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn qsizetype QLatin1String::indexOf(QStringView str, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
- \fn qsizetype QLatin1String::indexOf(QLatin1String l1, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
- \fn qsizetype QLatin1String::indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ \fn qsizetype QLatin1StringView::indexOf(QStringView str, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ \fn qsizetype QLatin1StringView::indexOf(QLatin1StringView l1, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ \fn qsizetype QLatin1StringView::indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
\since 5.14
Returns the index position of the first occurrence of the string-view
@@ -9457,9 +9469,9 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::contains(QStringView str, Qt::CaseSensitivity cs) const
- \fn bool QLatin1String::contains(QLatin1String l1, Qt::CaseSensitivity cs) const
- \fn bool QLatin1String::contains(QChar c, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::contains(QStringView str, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::contains(QLatin1StringView l1, Qt::CaseSensitivity cs) const
+ \fn bool QLatin1StringView::contains(QChar c, Qt::CaseSensitivity cs) const
\since 5.14
Returns \c true if this Latin-1 string contains an occurrence of the
@@ -9474,9 +9486,9 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn qsizetype QLatin1String::lastIndexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs) const
- \fn qsizetype QLatin1String::lastIndexOf(QLatin1String l1, qsizetype from, Qt::CaseSensitivity cs) const
- \fn qsizetype QLatin1String::lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) const
+ \fn qsizetype QLatin1StringView::lastIndexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs) const
+ \fn qsizetype QLatin1StringView::lastIndexOf(QLatin1StringView l1, qsizetype from, Qt::CaseSensitivity cs) const
+ \fn qsizetype QLatin1StringView::lastIndexOf(QChar c, qsizetype from, Qt::CaseSensitivity cs) const
\since 5.14
Returns the index position of the last occurrence of the string-view \a str,
@@ -9503,8 +9515,8 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn qsizetype QLatin1String::lastIndexOf(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
- \fn qsizetype QLatin1String::lastIndexOf(QLatin1String l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ \fn qsizetype QLatin1StringView::lastIndexOf(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
+ \fn qsizetype QLatin1StringView::lastIndexOf(QLatin1StringView l1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
\since 6.2
\overload lastIndexOf()
@@ -9517,15 +9529,15 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn qsizetype QLatin1String::lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const
+ \fn qsizetype QLatin1StringView::lastIndexOf(QChar ch, Qt::CaseSensitivity cs) const
\since 6.3
\overload
*/
/*!
- \fn qsizetype QLatin1String::count(QStringView str, Qt::CaseSensitivity cs) const
- \fn qsizetype QLatin1String::count(QLatin1String l1, Qt::CaseSensitivity cs) const
- \fn qsizetype QLatin1String::count(QChar ch, Qt::CaseSensitivity cs) const
+ \fn qsizetype QLatin1StringView::count(QStringView str, Qt::CaseSensitivity cs) const
+ \fn qsizetype QLatin1StringView::count(QLatin1StringView l1, Qt::CaseSensitivity cs) const
+ \fn qsizetype QLatin1StringView::count(QChar ch, Qt::CaseSensitivity cs) const
\since 6.4
Returns the number of (potentially overlapping) occurrences of the
@@ -9539,7 +9551,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::const_iterator QLatin1String::begin() const
+ \fn QLatin1StringView::const_iterator QLatin1StringView::begin() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the
@@ -9551,7 +9563,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::const_iterator QLatin1String::cbegin() const
+ \fn QLatin1StringView::const_iterator QLatin1StringView::cbegin() const
\since 5.10
Same as begin().
@@ -9562,7 +9574,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::const_iterator QLatin1String::constBegin() const
+ \fn QLatin1StringView::const_iterator QLatin1StringView::constBegin() const
\since 6.4
Same as begin().
@@ -9573,7 +9585,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::const_iterator QLatin1String::end() const
+ \fn QLatin1StringView::const_iterator QLatin1StringView::end() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style iterator} pointing just
@@ -9584,7 +9596,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa begin(), cend(), rend()
*/
-/*! \fn QLatin1String::const_iterator QLatin1String::cend() const
+/*! \fn QLatin1StringView::const_iterator QLatin1StringView::cend() const
\since 5.10
Same as end().
@@ -9594,7 +9606,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
\sa cbegin(), end(), crend()
*/
-/*! \fn QLatin1String::const_iterator QLatin1String::constEnd() const
+/*! \fn QLatin1StringView::const_iterator QLatin1StringView::constEnd() const
\since 6.4
Same as end().
@@ -9605,7 +9617,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::const_reverse_iterator QLatin1String::rbegin() const
+ \fn QLatin1StringView::const_reverse_iterator QLatin1StringView::rbegin() const
\since 5.10
Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing
@@ -9617,7 +9629,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::const_reverse_iterator QLatin1String::crbegin() const
+ \fn QLatin1StringView::const_reverse_iterator QLatin1StringView::crbegin() const
\since 5.10
Same as rbegin().
@@ -9628,7 +9640,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::const_reverse_iterator QLatin1String::rend() const
+ \fn QLatin1StringView::const_reverse_iterator QLatin1StringView::rend() const
\since 5.10
Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing just
@@ -9640,7 +9652,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String::const_reverse_iterator QLatin1String::crend() const
+ \fn QLatin1StringView::const_reverse_iterator QLatin1StringView::crend() const
\since 5.10
Same as rend().
@@ -9651,7 +9663,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::mid(qsizetype start, qsizetype length) const
+ \fn QLatin1StringView QLatin1StringView::mid(qsizetype start, qsizetype length) const
\since 5.8
Returns the substring of length \a length starting at position
@@ -9670,7 +9682,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::left(qsizetype length) const
+ \fn QLatin1StringView QLatin1StringView::left(qsizetype length) const
\since 5.8
If you know that \a length cannot be out of bounds, use first() instead in
@@ -9686,7 +9698,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::right(qsizetype length) const
+ \fn QLatin1StringView QLatin1StringView::right(qsizetype length) const
\since 5.8
If you know that \a length cannot be out of bounds, use last() instead in
@@ -9702,7 +9714,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::first(qsizetype n) const
+ \fn QLatin1StringView QLatin1StringView::first(qsizetype n) const
\since 6.0
Returns a Latin-1 string that contains the first \a n characters
@@ -9714,7 +9726,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::last(qsizetype n) const
+ \fn QLatin1StringView QLatin1StringView::last(qsizetype n) const
\since 6.0
Returns a Latin-1 string that contains the last \a n characters
@@ -9726,7 +9738,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::sliced(qsizetype pos, qsizetype n) const
+ \fn QLatin1StringView QLatin1StringView::sliced(qsizetype pos, qsizetype n) const
\since 6.0
Returns a Latin-1 string that points to \a n characters of this
@@ -9739,7 +9751,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::sliced(qsizetype pos) const
+ \fn QLatin1StringView QLatin1StringView::sliced(qsizetype pos) const
\since 6.0
Returns a Latin-1 string starting at position \a pos in this
@@ -9751,7 +9763,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::chopped(qsizetype length) const
+ \fn QLatin1StringView QLatin1StringView::chopped(qsizetype length) const
\since 5.10
Returns the substring of length size() - \a length starting at the
@@ -9765,7 +9777,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn void QLatin1String::truncate(qsizetype length)
+ \fn void QLatin1StringView::truncate(qsizetype length)
\since 5.10
Truncates this string to length \a length.
@@ -9778,7 +9790,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn void QLatin1String::chop(qsizetype length)
+ \fn void QLatin1StringView::chop(qsizetype length)
\since 5.10
Truncates this string by \a length characters.
@@ -9791,7 +9803,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn QLatin1String QLatin1String::trimmed() const
+ \fn QLatin1StringView QLatin1StringView::trimmed() const
\since 5.10
Strips leading and trailing whitespace and returns the result.
@@ -9802,7 +9814,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator==(const char *other) const
+ \fn bool QLatin1StringView::operator==(const char *other) const
\since 4.3
Returns \c true if the string is equal to const char pointer \a other;
@@ -9820,7 +9832,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator==(const QByteArray &other) const
+ \fn bool QLatin1StringView::operator==(const QByteArray &other) const
\since 5.0
\overload
@@ -9834,7 +9846,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator!=(const char *other) const
+ \fn bool QLatin1StringView::operator!=(const char *other) const
\since 4.3
Returns \c true if this string is not equal to const char pointer \a other;
@@ -9852,7 +9864,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator!=(const QByteArray &other) const
+ \fn bool QLatin1StringView::operator!=(const QByteArray &other) const
\since 5.0
\overload operator!=()
@@ -9866,7 +9878,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator>(const char *other) const
+ \fn bool QLatin1StringView::operator>(const char *other) const
\since 4.3
Returns \c true if this string is lexically greater than const char pointer
@@ -9884,7 +9896,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator>(const QByteArray &other) const
+ \fn bool QLatin1StringView::operator>(const QByteArray &other) const
\since 5.0
\overload
@@ -9898,7 +9910,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator<(const char *other) const
+ \fn bool QLatin1StringView::operator<(const char *other) const
\since 4.3
Returns \c true if this string is lexically less than const char pointer
@@ -9916,7 +9928,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator<(const QByteArray &other) const
+ \fn bool QLatin1StringView::operator<(const QByteArray &other) const
\since 5.0
\overload
@@ -9930,7 +9942,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator>=(const char *other) const
+ \fn bool QLatin1StringView::operator>=(const char *other) const
\since 4.3
Returns \c true if this string is lexically greater than or equal to
@@ -9948,7 +9960,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator>=(const QByteArray &other) const
+ \fn bool QLatin1StringView::operator>=(const QByteArray &other) const
\since 5.0
\overload
@@ -9962,7 +9974,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator<=(const char *other) const
+ \fn bool QLatin1StringView::operator<=(const char *other) const
\since 4.3
Returns \c true if this string is lexically less than or equal to
@@ -9980,7 +9992,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn bool QLatin1String::operator<=(const QByteArray &other) const
+ \fn bool QLatin1StringView::operator<=(const QByteArray &other) const
\since 5.0
\overload
@@ -9993,204 +10005,204 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
go through QObject::tr(), for example.
*/
-/*! \fn bool QLatin1String::operator==(QLatin1String s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator==(QLatin1StringView s1, QLatin1StringView s2)
Returns \c true if string \a s1 is lexically equal to string \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator!=(QLatin1String s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator!=(QLatin1StringView s1, QLatin1StringView s2)
Returns \c true if string \a s1 is lexically not equal to string \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<(QLatin1String s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator<(QLatin1StringView s1, QLatin1StringView s2)
Returns \c true if string \a s1 is lexically less than string \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<=(QLatin1String s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator<=(QLatin1StringView s1, QLatin1StringView s2)
Returns \c true if string \a s1 is lexically less than or equal to
string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>(QLatin1String s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator>(QLatin1StringView s1, QLatin1StringView s2)
Returns \c true if string \a s1 is lexically greater than string \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>=(QLatin1String s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator>=(QLatin1StringView s1, QLatin1StringView s2)
Returns \c true if string \a s1 is lexically greater than or equal
to string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator==(QChar ch, QLatin1String s)
+/*! \fn bool QLatin1StringView::operator==(QChar ch, QLatin1StringView s)
Returns \c true if char \a ch is lexically equal to string \a s;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<(QChar ch, QLatin1String s)
+/*! \fn bool QLatin1StringView::operator<(QChar ch, QLatin1StringView s)
Returns \c true if char \a ch is lexically less than string \a s;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>(QChar ch, QLatin1String s)
+/*! \fn bool QLatin1StringView::operator>(QChar ch, QLatin1StringView s)
Returns \c true if char \a ch is lexically greater than string \a s;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator!=(QChar ch, QLatin1String s)
+/*! \fn bool QLatin1StringView::operator!=(QChar ch, QLatin1StringView s)
Returns \c true if char \a ch is lexically not equal to string \a s;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<=(QChar ch, QLatin1String s)
+/*! \fn bool QLatin1StringView::operator<=(QChar ch, QLatin1StringView s)
Returns \c true if char \a ch is lexically less than or equal to
string \a s; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>=(QChar ch, QLatin1String s)
+/*! \fn bool QLatin1StringView::operator>=(QChar ch, QLatin1StringView s)
Returns \c true if char \a ch is lexically greater than or equal to
string \a s; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator==(QLatin1String s, QChar ch)
+/*! \fn bool QLatin1StringView::operator==(QLatin1StringView s, QChar ch)
Returns \c true if string \a s is lexically equal to char \a ch;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<(QLatin1String s, QChar ch)
+/*! \fn bool QLatin1StringView::operator<(QLatin1StringView s, QChar ch)
Returns \c true if string \a s is lexically less than char \a ch;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>(QLatin1String s, QChar ch)
+/*! \fn bool QLatin1StringView::operator>(QLatin1StringView s, QChar ch)
Returns \c true if string \a s is lexically greater than char \a ch;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator!=(QLatin1String s, QChar ch)
+/*! \fn bool QLatin1StringView::operator!=(QLatin1StringView s, QChar ch)
Returns \c true if string \a s is lexically not equal to char \a ch;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<=(QLatin1String s, QChar ch)
+/*! \fn bool QLatin1StringView::operator<=(QLatin1StringView s, QChar ch)
Returns \c true if string \a s is lexically less than or equal to
char \a ch; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>=(QLatin1String s, QChar ch)
+/*! \fn bool QLatin1StringView::operator>=(QLatin1StringView s, QChar ch)
Returns \c true if string \a s is lexically greater than or equal to
char \a ch; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator==(QStringView s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator==(QStringView s1, QLatin1StringView s2)
Returns \c true if string view \a s1 is lexically equal to string \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<(QStringView s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator<(QStringView s1, QLatin1StringView s2)
Returns \c true if string view \a s1 is lexically less than string \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>(QStringView s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator>(QStringView s1, QLatin1StringView s2)
Returns \c true if string view \a s1 is lexically greater than string \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator!=(QStringView s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator!=(QStringView s1, QLatin1StringView s2)
Returns \c true if string view \a s1 is lexically not equal to string \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<=(QStringView s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator<=(QStringView s1, QLatin1StringView s2)
Returns \c true if string view \a s1 is lexically less than or equal to
string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>=(QStringView s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator>=(QStringView s1, QLatin1StringView s2)
Returns \c true if string view \a s1 is lexically greater than or equal to
string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator==(QLatin1String s1, QStringView s2)
+/*! \fn bool QLatin1StringView::operator==(QLatin1StringView s1, QStringView s2)
Returns \c true if string \a s1 is lexically equal to string view \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<(QLatin1String s1, QStringView s2)
+/*! \fn bool QLatin1StringView::operator<(QLatin1StringView s1, QStringView s2)
Returns \c true if string \a s1 is lexically less than string view \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>(QLatin1String s1, QStringView s2)
+/*! \fn bool QLatin1StringView::operator>(QLatin1StringView s1, QStringView s2)
Returns \c true if string \a s1 is lexically greater than string view \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator!=(QLatin1String s1, QStringView s2)
+/*! \fn bool QLatin1StringView::operator!=(QLatin1StringView s1, QStringView s2)
Returns \c true if string \a s1 is lexically not equal to string view \a s2;
otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<=(QLatin1String s1, QStringView s2)
+/*! \fn bool QLatin1StringView::operator<=(QLatin1StringView s1, QStringView s2)
Returns \c true if string \a s1 is lexically less than or equal to
string view \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>=(QLatin1String s1, QStringView s2)
+/*! \fn bool QLatin1StringView::operator>=(QLatin1StringView s1, QStringView s2)
Returns \c true if string \a s1 is lexically greater than or equal to
string view \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator==(const char *s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator==(const char *s1, QLatin1StringView s2)
Returns \c true if const char pointer \a s1 is lexically equal to
string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<(const char *s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator<(const char *s1, QLatin1StringView s2)
Returns \c true if const char pointer \a s1 is lexically less than
string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>(const char *s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator>(const char *s1, QLatin1StringView s2)
Returns \c true if const char pointer \a s1 is lexically greater than
string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator!=(const char *s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator!=(const char *s1, QLatin1StringView s2)
Returns \c true if const char pointer \a s1 is lexically not equal to
string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator<=(const char *s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator<=(const char *s1, QLatin1StringView s2)
Returns \c true if const char pointer \a s1 is lexically less than or
equal to string \a s2; otherwise returns \c false.
*/
-/*! \fn bool QLatin1String::operator>=(const char *s1, QLatin1String s2)
+/*! \fn bool QLatin1StringView::operator>=(const char *s1, QLatin1StringView s2)
Returns \c true if const char pointer \a s1 is lexically greater than or
equal to string \a s2; otherwise returns \c false.
*/
/*!
- \fn qlonglong QLatin1String::toLongLong(bool *ok, int base) const
- \fn qulonglong QLatin1String::toULongLong(bool *ok, int base) const
- \fn int QLatin1String::toInt(bool *ok, int base) const
- \fn uint QLatin1String::toUInt(bool *ok, int base) const
- \fn long QLatin1String::toLong(bool *ok, int base) const
- \fn ulong QLatin1String::toULong(bool *ok, int base) const
- \fn short QLatin1String::toShort(bool *ok, int base) const
- \fn ushort QLatin1String::toUShort(bool *ok, int base) const
+ \fn qlonglong QLatin1StringView::toLongLong(bool *ok, int base) const
+ \fn qulonglong QLatin1StringView::toULongLong(bool *ok, int base) const
+ \fn int QLatin1StringView::toInt(bool *ok, int base) const
+ \fn uint QLatin1StringView::toUInt(bool *ok, int base) const
+ \fn long QLatin1StringView::toLong(bool *ok, int base) const
+ \fn ulong QLatin1StringView::toULong(bool *ok, int base) const
+ \fn short QLatin1StringView::toShort(bool *ok, int base) const
+ \fn ushort QLatin1StringView::toUShort(bool *ok, int base) const
\since 6.4
- Returns this QLatin1String converted to a corresponding numeric value using
+ Returns this QLatin1StringView converted to a corresponding numeric value using
base \a base, which is ten by default. Bases 0 and 2 through 36 are supported,
using letters for digits beyond 9; A is ten, B is eleven and so on.
@@ -10214,11 +10226,11 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
*/
/*!
- \fn double QLatin1String::toDouble(bool *ok) const
- \fn float QLatin1String::toFloat(bool *ok) const
+ \fn double QLatin1StringView::toDouble(bool *ok) const
+ \fn float QLatin1StringView::toFloat(bool *ok) const
\since 6.4
- Returns this QLatin1String converted to a corresponding floating-point value.
+ Returns this QLatin1StringView converted to a corresponding floating-point value.
Returns an infinity if the conversion overflows or 0.0 if the
conversion fails for other reasons (e.g. underflow).
@@ -10226,7 +10238,7 @@ QString &QString::setRawData(const QChar *unicode, qsizetype size)
If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true.
- \warning The QLatin1String content may only contain valid numerical
+ \warning The QLatin1StringView content may only contain valid numerical
characters which includes the plus/minus sign, the character e used in
scientific notation, and the decimal point. Including the unit or additional
characters leads to a conversion error.
@@ -10316,7 +10328,7 @@ QDataStream &operator>>(QDataStream &in, QString &str)
qbswap<sizeof(*data)>(data, len, data);
}
} else {
- str = QString(QLatin1String(""));
+ str = QString(QLatin1StringView(""));
}
}
return in;
@@ -10428,7 +10440,7 @@ qsizetype QtPrivate::count(QStringView haystack, QChar ch, Qt::CaseSensitivity c
return num;
}
-qsizetype QtPrivate::count(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs)
+qsizetype QtPrivate::count(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs)
{
qsizetype num = 0;
qsizetype i = -1;
@@ -10446,7 +10458,7 @@ qsizetype QtPrivate::count(QLatin1String haystack, QLatin1String needle, Qt::Cas
return num;
}
-qsizetype QtPrivate::count(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs)
+qsizetype QtPrivate::count(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs)
{
if (haystack.size() < needle.size())
return 0;
@@ -10473,7 +10485,7 @@ qsizetype QtPrivate::count(QLatin1String haystack, QStringView needle, Qt::CaseS
return num;
}
-qsizetype QtPrivate::count(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs)
+qsizetype QtPrivate::count(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs)
{
if (haystack.size() < needle.size())
return -1;
@@ -10484,7 +10496,7 @@ qsizetype QtPrivate::count(QStringView haystack, QLatin1String needle, Qt::CaseS
return QtPrivate::count(haystack, QStringView(s.data(), s.size()), cs);
}
-qsizetype QtPrivate::count(QLatin1String haystack, QChar needle, Qt::CaseSensitivity cs) noexcept
+qsizetype QtPrivate::count(QLatin1StringView haystack, QChar needle, Qt::CaseSensitivity cs) noexcept
{
// non-L1 needles cannot possibly match in L1-only haystacks
if (needle.unicode() > 0xff)
@@ -10511,11 +10523,11 @@ qsizetype QtPrivate::count(QLatin1String haystack, QChar needle, Qt::CaseSensiti
/*!
\fn bool QtPrivate::startsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs)
\since 5.10
- \fn bool QtPrivate::startsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs)
+ \fn bool QtPrivate::startsWith(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs)
\since 5.10
- \fn bool QtPrivate::startsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs)
+ \fn bool QtPrivate::startsWith(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs)
\since 5.10
- \fn bool QtPrivate::startsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs)
+ \fn bool QtPrivate::startsWith(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs)
\since 5.10
\internal
\relates QStringView
@@ -10526,7 +10538,7 @@ qsizetype QtPrivate::count(QLatin1String haystack, QChar needle, Qt::CaseSensiti
If \a cs is Qt::CaseSensitive (the default), the search is case-sensitive;
otherwise the search is case-insensitive.
- \sa QtPrivate::endsWith(), QString::endsWith(), QStringView::endsWith(), QLatin1String::endsWith()
+ \sa QtPrivate::endsWith(), QString::endsWith(), QStringView::endsWith(), QLatin1StringView::endsWith()
*/
bool QtPrivate::startsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept
@@ -10534,17 +10546,17 @@ bool QtPrivate::startsWith(QStringView haystack, QStringView needle, Qt::CaseSen
return qt_starts_with_impl(haystack, needle, cs);
}
-bool QtPrivate::startsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs) noexcept
+bool QtPrivate::startsWith(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs) noexcept
{
return qt_starts_with_impl(haystack, needle, cs);
}
-bool QtPrivate::startsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept
+bool QtPrivate::startsWith(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept
{
return qt_starts_with_impl(haystack, needle, cs);
}
-bool QtPrivate::startsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs) noexcept
+bool QtPrivate::startsWith(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs) noexcept
{
return qt_starts_with_impl(haystack, needle, cs);
}
@@ -10552,11 +10564,11 @@ bool QtPrivate::startsWith(QLatin1String haystack, QLatin1String needle, Qt::Cas
/*!
\fn bool QtPrivate::endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs)
\since 5.10
- \fn bool QtPrivate::endsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs)
+ \fn bool QtPrivate::endsWith(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs)
\since 5.10
- \fn bool QtPrivate::endsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs)
+ \fn bool QtPrivate::endsWith(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs)
\since 5.10
- \fn bool QtPrivate::endsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs)
+ \fn bool QtPrivate::endsWith(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs)
\since 5.10
\internal
\relates QStringView
@@ -10567,7 +10579,7 @@ bool QtPrivate::startsWith(QLatin1String haystack, QLatin1String needle, Qt::Cas
If \a cs is Qt::CaseSensitive (the default), the search is case-sensitive;
otherwise the search is case-insensitive.
- \sa QtPrivate::startsWith(), QString::endsWith(), QStringView::endsWith(), QLatin1String::endsWith()
+ \sa QtPrivate::startsWith(), QString::endsWith(), QStringView::endsWith(), QLatin1StringView::endsWith()
*/
bool QtPrivate::endsWith(QStringView haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept
@@ -10575,17 +10587,17 @@ bool QtPrivate::endsWith(QStringView haystack, QStringView needle, Qt::CaseSensi
return qt_ends_with_impl(haystack, needle, cs);
}
-bool QtPrivate::endsWith(QStringView haystack, QLatin1String needle, Qt::CaseSensitivity cs) noexcept
+bool QtPrivate::endsWith(QStringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs) noexcept
{
return qt_ends_with_impl(haystack, needle, cs);
}
-bool QtPrivate::endsWith(QLatin1String haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept
+bool QtPrivate::endsWith(QLatin1StringView haystack, QStringView needle, Qt::CaseSensitivity cs) noexcept
{
return qt_ends_with_impl(haystack, needle, cs);
}
-bool QtPrivate::endsWith(QLatin1String haystack, QLatin1String needle, Qt::CaseSensitivity cs) noexcept
+bool QtPrivate::endsWith(QLatin1StringView haystack, QLatin1StringView needle, Qt::CaseSensitivity cs) noexcept
{
return qt_ends_with_impl(haystack, needle, cs);
}
@@ -10665,7 +10677,7 @@ qsizetype QtPrivate::findString(QStringView haystack0, qsizetype from, QStringVi
return -1;
}
-qsizetype QtPrivate::findString(QStringView haystack, qsizetype from, QLatin1String needle, Qt::CaseSensitivity cs) noexcept
+qsizetype QtPrivate::findString(QStringView haystack, qsizetype from, QLatin1StringView needle, Qt::CaseSensitivity cs) noexcept
{
if (haystack.size() < needle.size())
return -1;
@@ -10675,7 +10687,7 @@ qsizetype QtPrivate::findString(QStringView haystack, qsizetype from, QLatin1Str
return QtPrivate::findString(haystack, from, QStringView(reinterpret_cast<const QChar*>(s.constData()), s.size()), cs);
}
-qsizetype QtPrivate::findString(QLatin1String haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs) noexcept
+qsizetype QtPrivate::findString(QLatin1StringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs) noexcept
{
if (haystack.size() < needle.size())
return -1;
@@ -10685,15 +10697,15 @@ qsizetype QtPrivate::findString(QLatin1String haystack, qsizetype from, QStringV
if (needle.size() == 1) {
const char n = needle.front().toLatin1();
- return QtPrivate::findString(haystack, from, QLatin1String(&n, 1), cs);
+ return QtPrivate::findString(haystack, from, QLatin1StringView(&n, 1), cs);
}
QVarLengthArray<char> s(needle.size());
qt_to_latin1_unchecked(reinterpret_cast<uchar *>(s.data()), needle.utf16(), needle.size());
- return QtPrivate::findString(haystack, from, QLatin1String(s.data(), s.size()), cs);
+ return QtPrivate::findString(haystack, from, QLatin1StringView(s.data(), s.size()), cs);
}
-qsizetype QtPrivate::findString(QLatin1String haystack, qsizetype from, QLatin1String needle, Qt::CaseSensitivity cs) noexcept
+qsizetype QtPrivate::findString(QLatin1StringView haystack, qsizetype from, QLatin1StringView needle, Qt::CaseSensitivity cs) noexcept
{
if (from < 0)
from += haystack.size();
@@ -10743,7 +10755,7 @@ qsizetype QtPrivate::findString(QLatin1String haystack, qsizetype from, QLatin1S
for (auto it = std::find_if(begin + from, end, ciMatch); it < end;
it = std::find_if(it + 1, end, ciMatch)) {
// In this comparison we skip the first character because we know it's a match
- if (!nlen1 || QLatin1String(it + 1, nlen1).compare(needle.sliced(1), cs) == 0)
+ if (!nlen1 || QLatin1StringView(it + 1, nlen1).compare(needle.sliced(1), cs) == 0)
return std::distance(begin, it);
}
return -1;
@@ -10777,17 +10789,17 @@ qsizetype QtPrivate::lastIndexOf(QStringView haystack, qsizetype from, QStringVi
return qLastIndexOf(haystack, from, needle, cs);
}
-qsizetype QtPrivate::lastIndexOf(QStringView haystack, qsizetype from, QLatin1String needle, Qt::CaseSensitivity cs) noexcept
+qsizetype QtPrivate::lastIndexOf(QStringView haystack, qsizetype from, QLatin1StringView needle, Qt::CaseSensitivity cs) noexcept
{
return qLastIndexOf(haystack, from, needle, cs);
}
-qsizetype QtPrivate::lastIndexOf(QLatin1String haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs) noexcept
+qsizetype QtPrivate::lastIndexOf(QLatin1StringView haystack, qsizetype from, QStringView needle, Qt::CaseSensitivity cs) noexcept
{
return qLastIndexOf(haystack, from, needle, cs);
}
-qsizetype QtPrivate::lastIndexOf(QLatin1String haystack, qsizetype from, QLatin1String needle, Qt::CaseSensitivity cs) noexcept
+qsizetype QtPrivate::lastIndexOf(QLatin1StringView haystack, qsizetype from, QLatin1StringView needle, Qt::CaseSensitivity cs) noexcept
{
return qLastIndexOf(haystack, from, needle, cs);
}
@@ -10931,10 +10943,10 @@ QString QString::toHtmlEscaped() const
significantly speed up creation of QString instances from data known at
compile time.
- \note QLatin1String can still be more efficient than QStringLiteral
+ \note QLatin1StringView can still be more efficient than QStringLiteral
when the string is passed to a function that has an overload taking
- QLatin1String and this overload avoids conversion to QString. For
- instance, QString::operator==() can compare to a QLatin1String
+ QLatin1StringView and this overload avoids conversion to QString. For
+ instance, QString::operator==() can compare to a QLatin1StringView
directly:
\snippet code/src_corelib_text_qstring.cpp 11
@@ -10972,13 +10984,13 @@ QString QString::toHtmlEscaped() const
/*!
\fn Qt::Literals::StringLiterals::operator""_L1(const char *str, size_t size)
- \relates QLatin1String
+ \relates QLatin1StringView
\since 6.4
- Literal operator that creates a QLatin1String out of the first \a size
+ Literal operator that creates a QLatin1StringView out of the first \a size
characters in the char string literal \a str.
- The following code creates a QLatin1String:
+ The following code creates a QLatin1StringView:
\code
using namespace Qt::Literals::StringLiterals;
@@ -10991,7 +11003,7 @@ QString QString::toHtmlEscaped() const
/*!
\internal
*/
-void QAbstractConcatenable::appendLatin1To(QLatin1String in, QChar *out) noexcept
+void QAbstractConcatenable::appendLatin1To(QLatin1StringView in, QChar *out) noexcept
{
qt_from_latin1(reinterpret_cast<char16_t *>(out), in.data(), size_t(in.size()));
}