summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qutf8stringview.qdoc
Commit message (Collapse)AuthorAgeFilesLines
* Add isValidUtf8() methods to QUtf8StringView and QByteArray{,View}Ievgenii Meshcheriakov2021-09-221-0/+9
| | | | | | | | | | | | | | | The new methods return true if the string contains valid UTF-8 encoded data, or false otherwise. [ChangeLog][QtCore][QByteArray] Added isValidUtf8() method. [ChangeLog][QtCore][QByteArrayView] Added isValidUtf8() method. [ChangeLog][QtCore][QUtf8StringView] Added isValidUtf8() method. Task-number: QTBUG-92021 Change-Id: I5d0cb613265d98b1f189c5f5cc09c1f7db302272 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix some errors in docs of string-related classesSona Kurazyan2021-08-161-14/+14
| | | | | | | | | | | | | | | | | | - Fixed various texts in docs for QStringView, QUtf8StringView and QAnyStringView copied from QString, that are still talking about string or string reference instead of string view. - Replaced 'string-view' with 'string view', which is the more commonly used form. - Fixed the wrong usage of uppercase 'If' in some places. - Did minor adjusments, to make the docs consistent with docs of QByteArray/QByteArrayView. Change-Id: Ifb905e00957e869a8befad5a36d6b00b6e621a04 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Use \deprecated instead of \obsoletePaul Wicking2021-05-261-3/+3
| | | | | | Task-number: QTBUG-93990 Change-Id: I4e512354a49dde6678ca89cabc56bc76ba666bb3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QUtf8StringView: ensure binary compatibility throughout 6.xThiago Macieira2021-04-201-31/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't depend on whether the user compiles with -std=c++17 or -std=c++20. So select what we can depend on and make that permanent. Prior to this change: $ cat /tmp/test.cpp #include <QtCore/QUtf8StringView> void f(QUtf8StringView) {} $ qcd include $ g++ -S -o - -I. /tmp/test.cpp | grep globl | c++filt .globl f(QBasicUtf8StringView<false>) $ g++ -fPIC -std=c++20 -S -o - -I. /tmp/test.cpp | grep globl | c++filt .globl f(QBasicUtf8StringView<true>) After this change, they're both "false". QUtf8StringView should have been a concrete class that derived from QBsicUtf8StringView<whichever> and inherited all its constructors. We'd cause ODR violations in C++20, but nothing worse than what we usually do for BC reasons. That solution is too late for Qt 6.x. Let's revisit in 7.0. Change-Id: I6bcbe88c072a438b8b4efffd166e77199ecb39e3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit c7deb3400faa1d9389137fe63ffbffade8203850) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Q{*String,ByteArray}View::length(): use qsizetype, not intGiuseppe D'Angelo2021-04-151-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Looks like these ones have been forgotten in the Qt 5 -> 6 upgrade to qsizetype. Change them to return qsizetype as well, and fix the docs. Being entirely inline, non-exported classes, we should be able to get away with it without affecting binary compatibility. Moreover, there's no reason for keeping them deprecated. Requires some minor adjustments, just like the ones done for size()'s changes. [ChangeLog][QtCore][QStringView] The length() function now returns `qsizetype`, not `int`, for consistency with the other string and container classes in Qt. Following this change, it has been un-deprecated. [ChangeLog][QtCore][QAnyStringView] The length() function now returns `qsizetype`, not `int`, for consistency with the other string and container classes in Qt. Following this change, it has been un-deprecated. [ChangeLog][QtCore][QUtf8StringView] The length() function now returns `qsizetype`, not `int`, for consistency with the other string and container classes in Qt. Following this change, it has been un-deprecated. [ChangeLog][QtCore][QByteArrayView] The length() function now returns `qsizetype`, not `int`, for consistency with the other string and container classes in Qt. Following this change, it has been un-deprecated. Fixes: QTBUG-92496 Change-Id: Ie0f4939d1083884e95d4725f891b6c6764532cb8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add a workaround for QUtf8StringView's missing docsTopi Reinio2020-11-061-46/+36
| | | | | | | | | | | | QUtf8StringView is a specialization of QBasicUtf8StringView but we only want to document the former. Add a workaround when Q_CLANG_QDOC is defined to rename the base type, so the documentation in the .qdoc file is matched correctly. Fixes: QTBUG-88030 Task-number: QTBUG-86295 Change-Id: Id6e3d6fd5c28603bebf30771b7a47c3f76ca709d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Doc: Add notes on how to use View classes in Qt6Karsten Heimrich2020-10-271-4/+4
| | | | | | | Task-number: QTBUG-87168 Change-Id: I631937ebaf7cfa3ed54c6c8a3641693fda910b36 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Q(Any|Utf8)StringView: move array size deduction feature to fromArrayMÃ¥rten Nordheim2020-09-181-5/+23
| | | | | | | | | | | | | The constructor taking an array literal will now stop at the first null-terminator encountered. And fromArray is introduced which only supports array literals. Constructs a view of the full size. Explicit so it shouldn't be surprising. Change-Id: I1497c33a5c12453a95e87c990abe6335b2817081 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Long live Q{Any,Utf8}StringView!Marc Mutz2020-08-311-0/+720
We need to add these two classes at the same time, because QAnyStringView makes all QUtf8StringView relational operators moot. We might want to add some later, esp. for UTF-8/UTf-8 comparisons, to avoid the pessimization that we can't early-out on size() mismatch in QAnyStringView equality operators, but that's an optimization, not a correctness issue, and can be fixed in a source-compatible way even after Qt 6 is released. To deal with the char8_t problem in C++20, make QUtf8StringView a class template out of which two UTF-8 views can be instantiated: the Qt 7 version, which depends on C++20 char8_t as value_type, and the Qt 6 version where value_type is a char. Use inline namespaces to map the QUtf8StringView identifier to one or the other, depending on the C++ version used to compile the user code. The inline namespace names must needs be a bit ugly, as their inline'ness depends on __cpp_char8_t. If we simply used q_v1/q_v2 we'd be blocking these names for Qt inline namespaces forever, because it's likely that inline'ness of other users of inline namespaces in Qt depends on things other than __cpp_char8_t. While inline'ness of namespaces is, theoretically speaking, a compile-time-only property, at least Clang warns about mixed use of inline on a given namespace, so we need to bite the bullet here. This is also the reason for the QT_BEGIN_..._NAMESPACE macros: GCC is ok with the first declaration making a namespace inline, while Clang warns upon re-opening an inline namespace as a non-inline one. [ChangeLog][QtCore][QUtf8StringView] New class. [ChangeLog][QtCore][QAnyStringView] New class. Change-Id: Ia7179760fca0e0b67d52f5accb0a62e389b17913 Reviewed-by: Lars Knoll <lars.knoll@qt.io>