summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qstringview.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2023-01-17 08:13:04 +0100
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-03-09 11:36:42 +0000
commitbbb9cf225fd030a87818cb867c24ab651f797100 (patch)
tree4a791e3e4d2991702224402ecfb5529ae2c9b6da /src/corelib/text/qstringview.h
parenta0313c85a9b8ab6ba0ec273f0c8638e2f7b8cc18 (diff)
Make compare(QU8SV) a non-template, document it
Templates have different overload characteristics from normal functions, and treating q_no_char8_t and q_has_char8_t::QUtf8StingView separately is never necessary, as one implicitly converts into the other. Add docs for the new UTF-8 compare() functions. Amends b977ae371a753a82e1d0bb32c5b62099da663721. Found in API review. Pick-to: 6.5 6.5.0 Change-Id: I58b4b28a3eccde1976d71cfa3412b734d46f314d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/text/qstringview.h')
-rw-r--r--src/corelib/text/qstringview.h20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/corelib/text/qstringview.h b/src/corelib/text/qstringview.h
index 20b61f1865..3dc8b5ce0b 100644
--- a/src/corelib/text/qstringview.h
+++ b/src/corelib/text/qstringview.h
@@ -8,7 +8,6 @@
#include <QtCore/qbytearray.h>
#include <QtCore/qstringliteral.h>
#include <QtCore/qstringalgorithms.h>
-#include <QtCore/qutf8stringview.h>
#include <string>
#include <QtCore/q20type_traits.h>
@@ -24,6 +23,9 @@ class QString;
class QStringView;
class QRegularExpression;
class QRegularExpressionMatch;
+#ifdef Q_QDOC
+class QUtf8StringView;
+#endif
namespace QtPrivate {
template <typename Char>
@@ -261,12 +263,7 @@ public:
[[nodiscard]] int compare(QStringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::compareStrings(*this, other, cs); }
[[nodiscard]] inline int compare(QLatin1StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
- template<bool UseChar8T>
- [[nodiscard]] int compare(QBasicUtf8StringView<UseChar8T> other,
- Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
- {
- return QtPrivate::compareStrings(*this, other, cs);
- }
+ [[nodiscard]] inline int compare(QUtf8StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
[[nodiscard]] constexpr int compare(QChar c) const noexcept
{ return size() >= 1 ? compare_single_char_helper(*utf16() - c.unicode()) : -1; }
[[nodiscard]] int compare(QChar c, Qt::CaseSensitivity cs) const noexcept
@@ -467,15 +464,6 @@ inline QStringView qToStringViewIgnoringNull(const QStringLike &s) noexcept
R{{char16_t(c), u'\0'}} ;
}
-// QBasicUtf8StringView functions:
-
-template<bool UseChar8T>
-[[nodiscard]] int QBasicUtf8StringView<UseChar8T>::compare(QStringView other,
- Qt::CaseSensitivity cs) const noexcept
-{
- return QtPrivate::compareStrings(*this, other, cs);
-}
-
QT_END_NAMESPACE
#endif /* QSTRINGVIEW_H */