summaryrefslogtreecommitdiffstats
path: root/src/corelib/text
Commit message (Collapse)AuthorAgeFilesLines
* QStaticLatin1StringMatcher: add indexIn(QStringView)Ahmad Samir6 days2-3/+21
| | | | | | | | ... mirroring the same change in QLatin1StringMatcher. Task-number: QTBUG-117054 Change-Id: I8d1f4ed01ee75a51e3d99a165dbb35ae7dae5886 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QLatin1StringMatcher: add indexIn(QStringView) overloadAhmad Samir6 days2-5/+46
| | | | | | | | | | | | Drive-by changes, remove a redundant typedef. [ChangeLog][QtCore][QLatin1StringMatcher] Added indexIn(QStringView) overload. Task-number: QTBUG-117054 Change-Id: I5a8426cb0f9d9111f086015902ffe2185a267c86 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
* QRegularExpression: use modernize comparisonsTatiana Borisova8 days2-25/+26
| | | | | | | | | | | | | Replace class operators operator==(), operator!=() of QRegularExpression to friend method comparesEqual() and Q_DECLARE_EQUALITY_COMPARABLE macro. Use QT_CORE_REMOVED_SINCE and removed_api.cpp to get rid of current comparison methods and replace them with a friend. Task-number: QTBUG-120304 Change-Id: Ib6fc83d29ad9bc710c2fdf32a3d60131fbf298b6 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QLocale: use new comparison helper macrosTatiana Borisova13 days2-2/+6
| | | | | | | | | | Replace public friend operators operator==(), operator!=() of QLocale to friend method comparesEqual() and Q_DECLARE_EQUALITY_COMPARABLE macro. Task-number: QTBUG-120304 Change-Id: I759ef08269abe3b40e0dce3fd408a86cc3f34857 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QRegularExpressionMatch: port API from QString to QAnyStringView keysMatthias Rauter2024-04-292-57/+45
| | | | | | | | | | | | | | The QRegularExpression capture-by-name keys are currently QStringViews, but are only ever used to compare them against a const char16_t*, so this API is a perfect candidate for replacing all of these overload sets with a single QAnyStringView function. [ChangeLog][QtCore][QRegularExpression] Keys can now be passed as QAnyStringView (was QStringView). Fixes: QTBUG-103097 Change-Id: I1a80e85f301cc08370d70b3b5eb0ae10c6a51f33 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* QString{En,De}coder: add constructors with QString parametersThiago Macieira2024-04-272-0/+26
| | | | | | | | | | | | | Because QStringConverter::availableCodecs() returns QString. Added as Q_WEAK_OVERLOAD so this doesn't create ambiguous overloads when passing QByteArrays. Fixes: QTBUG-123919 Change-Id: If1bf59ecbe014b569ba1fffd17c29a253ac22abe Reviewed-by: Sune Vuorela <sune@vuorela.dk> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* MSVC: improve QASV(const char(&str)[N]) compilation timeIvan Solovev2024-04-261-1/+10
| | | | | | | | | | | | | | | | | | | | | | | The lengthHelperContainer() implementation for sizeof(Char) == 1 case is using qstrnlen() for the non-constexpr case. qstrnlen() is an inline function which is effectively a nullptr check and a memchr() call. For some reason, on MSVC this combination resulted in very slow compilation for the user projects, where each call to QObject::setObjectName() was hitting this codepath. Fix it by replacing the qstrnlen() call with strnlen_s() for MSVC. It seems that for now all versions of MSVC are affected. However, introduce a new Q_COMPILER_SLOW_QSTRNLEN_COMPILATION definition, which will allow us to check for the compiler version later on. For now this definition is set for all MSVC versions unconditionally. Fixes: QTBUG-124376 Pick-to: 6.7 6.7.1 Change-Id: Id769bef1e950ffa756acf7af39d362fd8b112019 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Revise UCD-generated data files' SPDX headersEdward Welbourne2024-04-224-50/+6
| | | | | | | | | | | | | | | | | | | The existing data comes under Unicode-DFS-2016 but future updates shall come under Unicode-3.0, so update the existing headers with the former and the generator script with the latter. Leave a note in the attribution file about this transitional state and how to resolve it. Replaced UNICODE_LICENSE.txt from src/corelib/text/ with LICENSES/Unicode-DFS-2016.txt, as fetched using reuse download. This doesn't look like a rename but only actually adds some irrelevant lines about where on the Unicode website the upstream files (to which we do not apply this license) come from and changes some spacing. Pick-to: 6.7 6.5 Fixes: QTBUG-121653 Change-Id: I50c9f4badc77a9aa402af946561aff58ae9e3e7a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Kai Köhne <kai.koehne@qt.io>
* Assert consistency between locale and calendar dataEdward Welbourne2024-04-221-4/+14
| | | | | | | | They're indexed by the same key and should have the same language, script and country. Just to be sure, assert that. Change-Id: I9d4d9c0ef7078d6dcbb6ceccafdfaff671737689 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve fidelity of approximation to CLDR zone representationsEdward Welbourne2024-04-222-712/+726
| | | | | | | | | | | | | | | | | | | | I neglected to update the CLDR dateconverter code when I expanded the range of forms we support for display of a timezone. Even that expanded range doesn't cover all the cases CLDR does, but we can at least approximate each of CLDR's options by the closest we do support. Make matching changes to how the Darwin backend for the system locale maps its ICU-derived formats to ours. This in practice changes all locales previously using t (abbreviation) as zone format to use tttt (IANA ID) instead. Test data updated to match. [ChangeLog][QtCore][QLocale] Date-time formats now more faithfully follow the CLDR data in handling timezones. In most cases this means the IANA ID is used in place of the abbreviation. Change-Id: I0276843085839ba9a7855a78922cffe285174643 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QString: ensure multi-arg arg() parses replacement like single-arg arg()Thiago Macieira2024-04-211-10/+9
| | | | | | | | | | | | | | | | | | | There was a discrepancy that the multi-arg arg() overload would accept any number of digits in the placeholder, resolving up to value 999 (e.g., %000001 was interpreted as placeholder #1), but the single-arg arg() overload only supported exactly one or two digits. The single-arg behavior was documented, so use it. [ChangeLog][Important Behavior Changes] The QString::arg() overload taking multiple QString-like arguments is now fixed to interpret placeholders like the other arg() overloads: it will find at most two digits after the '%' character. That is, the sequence "%123" is now interpreted as placeholder #12 followed by character '3' (verbatim). Pick-to: 6.7 Fixes: QTBUG-118581 Change-Id: I455fe22ef4ad4b2f9b01fffd17c767a948d41138 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Correct handling of 'u' in CLDR date format stringsEdward Welbourne2024-04-191-1/+4
| | | | | | | | | | | It explicitly excludes having a two-digit special case like 'yy'. Correct that in qlocale_mac.mm, add support in dateconverter.py No current locale actually uses the 'u' format, so this makes no change to data. Change-Id: I16dfed2d3a7d2054b4b86f9a246bff297df9fc0a Reviewed-by: Dennis Oberst <dennis.oberst@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix handling of am/pm indicators in mapping from CLDR to Qt formatsEdward Welbourne2024-04-192-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Both qlocale_mac.mm and dateconverter.py were mapping the CLDR am/pm indicator, 'a', to the Qt format token 'AP', forcing the indicator to uppercase. The LDML spec [0] says: May be upper or lowercase depending on the locale and other options. [0] https://www.unicode.org/reports/tr35/tr35-68/tr35-dates.html#Date_Field_Symbol_Table We don't support the "other options" mentioned, but we can at least (since 6.3) preserve the the locale-appropriate case, instead of forcing upper-case. As such, this change is a follow-up to commit 4641ff0f6a1b0da6f55db5e33c58a77be2032808 Changes locale data, as expected, to use "Ap" in place of "AP" in various formats in the time_format_data[] array. [ChangeLog][QtCore][QLocale] Where CLDR specifies an am/pm indicator, the case of the CLDR-supplied indicator is used, where previously QLocale forced it to upper-case. Change-Id: Iee7d55e6f3c78372659668b9798c8e24a1fa8982 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cope with CLDR's "day period" format specifiersEdward Welbourne2024-04-192-39/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The LDML spec includes a 'b' pattern character which is like the 'a' pattern, for AM and PM, but would rather use noon and midnight indicators for those specific times. We don't support those and using am/pm will be right enough of the time to be better than simply discarding this option, if it ever gets used (which it currently isn't), so treat as an alias for 'a'. No locale in CLDR currently uses this. CLDR also has a 'B' specifiers for "flexible day periods", including things like "at night" and "in the day". At present only zh_Hant uses 'B'. As a result, this change only affects zh_Hant's formats for time and datetime, which only zh_Hant_TW uses - zh_Hant_HK overrides them to use am/pm markers and zh_Hant_MO inherits that from zh_Hant_HK. Based on this and user feed-back, I've opted to treat 'B' as another synonym of 'a'. This removes an entry from the time_format_data[] table (it happened to occupy one whole twelve-character row), causing many other locales' offsets into that table to be shifted by 12. Only zh_Hant_TW has an actual change to which entry in the table it uses. Added a test-case. [ChangeLog][QtCore][QLocale] CLDR's 'B' (flexible day period, e.g. "at night" &c.) field, not currently supported, is now handled as a synonym for the AM/PM field 'a', instead of leaving the B as literal text. Only affects zh_TW at present. Fixes: QTBUG-123872 Change-Id: I6ba008c0a048190bf7af8c7df7629a885b05804f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Tidy up macToQtFormat() in Darwin system locale backendEdward Welbourne2024-04-191-89/+86
| | | | | | | | | | | | | | | | | | | Impose standard Qt indent. Within each set of cases grouped together, impose alphabetic order. Made formatting of ranges in comments terser, for two-value ranges. Fix errors: * the 'j' field should not arise and has a 'J' partner * The 'c', 'e' and 'E' forms' numeric variants are still day of the week, so should not be mapped to 'd' or 'dd', which are day of the month. Qt date formats only actually support long and short, not narrow, despite the QLocale::Format having a NarrowFormat. Other errors and infelicities shall be addressed in later work, in tandem with changes to dateconverter.py that are coming. Task-number: QTBUG-123872 Change-Id: I61bf363d2598502f8bfc0d67245eae1b41858147 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QStringConverterICU: Pass correct pointer to callbackFabian Kosmale2024-04-191-2/+2
| | | | | | | | | | | | | | | Pass the pointer to the current state, not a pointer to a pointer to it. [ChangeLog][QtCore][QStringConverter] Fixed a bug involving moved QStringEncoder/QStringDecoder objects accessing invalid state. Amends 122270d6bea164e6df4357f4d4d77aacfa430470. Done-with: Marc Mutz <marc.mutz@qt.io> Pick-to: 6.7 6.5 Change-Id: I70d4dc00e3e0db6cad964579662bcf6d185a4c34 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QStringBuilder: DRY: use the Concatenable typedefThiago Macieira2024-04-181-3/+3
| | | | | | | | | Instead of repeating the full template expansion. Task-number: QTBUG-124117 Pick-to: 6.7 Change-Id: I40526efc4e93413794c3fffd17c4f9e200733660 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QStringBuilder: DRY: simplify the if constexpr conditionals a bitThiago Macieira2024-04-181-10/+9
| | | | | | | | | | Both sides of it were calling the same appendTo(), so we can avoid repeating ourselves. This MAY fix a warning with VS2019. Fixes: QTBUG-124117 Pick-to: 6.7 Change-Id: I40526efc4e93413794c3fffd17c4f9c96ee187f9 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QStringConverter/Doc: add more details about additional codecsThiago Macieira2024-04-181-1/+9
| | | | | | | | Fixes: QTBUG-124221 Pick-to: 6.7 Change-Id: If1bf59ecbe014b569ba1fffd17c4d113d02425eb Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QXmlStreamWriter: decode UTF-8 into code pointsThiago Macieira2024-04-181-0/+9
| | | | | | | | | | | | | | | | | | | | | We were iterating over code *units* and that yielded wrong results. The one from the bug report was simply caused by the fact that QUtf8StringView::value_type is char, which is signed on x86, so the expression: *it <= u'\x1F' was true for all non-Latin1 content. But in attempting to fix this, I needed to do the proper UTF-8 decoding, as otherwise we wouldn't catch non-Latin1 sequences and such. [ChangeLog][QtCore][QXmlStreamWriter] Fixed a bug that caused the class to fail to write UTF-8 strings with non-US-ASCII content when passed as a QUtf8StringView. Fixes: QTBUG-122241 Pick-to: 6.5 6.6 6.7 Change-Id: I83dda2d36c904517b3c0fffd17b42bbf09a493d0 Reviewed-by: Mate Barany <mate.barany@qt.io>
* Revise CLDR-generated data header files to use Unicode-3.0 for SPDXEdward Welbourne2024-04-171-1/+1
| | | | | | | | | | This is the correct license for the data they contain. The types that are used to package them can be made available under the same. Pick-to: 6.7 6.5 Task-number: QTBUG-121653 Change-Id: I7fb5f332f9e7f4f6db0f1f0c3964a36ce03bccb2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QByteArrayView: make starts/endsWith(char) constexprMarc Mutz2024-04-171-2/+2
| | | | | | | | | | | Their implementations call only constexpr functions, so they should be constexpr, too. [ChangeLog][QtCore][QByteArrayView] The startsWith(char) and endsWith(char) functions are now constexpr. Change-Id: I41f57ce3428a8de441e3c230aafc7bf426651c9f Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* QStringTokenizer: Add a missing includeMartin Storsjö2024-04-101-0/+1
| | | | | | | | | | | | | This header uses std::forward_iterator_tag, which requires including the <iterator> header. This fixes building with libc++ with _LIBCPP_REMOVE_TRANSITIVE_INCLUDES enabled. Pick-to: 6.7 6.5 6.2 Change-Id: Id2ce97e158c87dab1efe30e54a93f0bc9351de5a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Pass trivially-copyable types by value, not by const refEdward Welbourne2024-04-091-2/+2
| | | | | | | | | The LikelyPair and QLocaleId types are small enough to pass by value. Pick-to: 6.7 6.5 Task-number: QTBUG-122619 Change-Id: I1502efcf69ac82d9c49b673975502882c59a4fd0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale: pass 64-bit LanguageCodeEntry by value, not const refEdward Welbourne2024-04-091-5/+5
| | | | | | | | | | | | Probably makes no difference, since it's all in lambdas being passed to a standard algorithm, but the static analyser noticed this would be cleaner. Pick-to: 6.7 6.5 Task-number: QTBUG-122619 Change-Id: I23093254e4857131b7be87aeff1e7ba79ea2b674 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Initialize QTextBoundaryFinder::pos to zeroEdward Welbourne2024-04-092-5/+1
| | | | | | | | | | | | One constructor neglected to do so. Use NSDMI to make sure all constructors do, if they don't override this with something else. Also remove fatuous setting, by constructors, of member attributes to its default. Pick-to: 6.7 Task-number: QTBUG-122619 Change-Id: I9b726898b85e21d841b9af5b4dc72ee322829d50 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Pass QVariant to QSystemLocale::query() as rvalue referenceEdward Welbourne2024-04-096-8/+9
| | | | | | | | | | QVariant is rather big for passing by value; and no caller has any further use for the QVariant it's passing in. Pick-to: 6.7 6.5 Task-number: QTBUG-122619 Change-Id: I2751745e715aacfa8982ac97b4ae777fde5e88de Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSystemLocale(): disable copy and moveEdward Welbourne2024-04-091-0/+1
| | | | | | | | | | | | | Axivion (SV546) points out (based on a clazy "rule of three" that might be rule of five by now) the lack of move and copy assignment and construction. We don't want those anyway, so tell the compiler not to create them. Pick-to: 6.7 6.5 Task-number: QTBUG-122619 Change-Id: Ie951a2c3d60d76ad3448310d3f9bbda22190015b Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale: silence fallthrough warningTim Blechmann2024-04-051-0/+1
| | | | | | | | | clang doesn't seem to consider `Q_ASSERT(false)` as empty statement. Pick-to: 6.7 Change-Id: If99c7d4874450d781182491ef3963f1ee96285a6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QCollatorSortKey: Rule of Five: add missing move constructorEdward Welbourne2024-04-042-8/+21
| | | | | | | | | | | | | It has move assign, so should have move-construct. This turns out to need QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT() and QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QCollatorSortKeyPrivate). In the process, make the move assignment and constructor docs in qcollator.cpp conform to the usual pattern. Fixes: QTBUG-123326 Change-Id: I6fc9ed254dc396ff6130df09826b993e98dcf101 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Add the note about data size to QByteArray::operator=(const char*)Alexey Edelev2024-03-271-0/+3
| | | | | | | | | | Add the note about the way the str size is determined when using QByteArray::operator=(const char*). Pick-to: 6.7 6.6 6.5 Change-Id: I39b2d0fc2967832622fbf0c11b3ff6c7ff99b8f2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* QString::arg: apply the Qt 7 Unicode digit semantics to the bootstrapThiago Macieira2024-03-261-6/+6
| | | | | Change-Id: I01ec3c774d9943adb903fffd17b7ef0a106944ca Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* QByteArrayView: use new qdoc commands to document relational operatorsIvan Solovev2024-03-181-0/+9
| | | | | | | | | | Do not remove the existing documentation for now, because the new commands do not contain any links to explain what the types of ordering actually mean. Fixes: QTBUG-108805 Change-Id: I1297c435d700d02968f0d7d3a922af78a61d7e45 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_qstringapisymmetry: add qCompareThreeWay() checksIvan Solovev2024-03-181-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | Check that all string-like types implement compareThreeWay() as a (hidden) friend function. This test revealed some problems: because QByteArrayView is implicitly constructible from QLatin1StringView, the qCompareThreeWay() call sometimes picked the compareThreeWay() overloads with QByteArrayView instead of picking the "reversed" overloads that use QLatin1StringView. This was leading to wrong results, because QByteArrayView is interpreted as utf-8 data, not latin-1. Explicitly add the missing compareThreeWay() and comparesEqual() overloads. Note that relational operators were never affected by this problem, because in C++17 mode we explicitly generate the reversed versions, and in C++20 mode the compiler does that for us. Task-number: QTBUG-117661 Change-Id: Ia96af59c60ebf2fae6cf2a49231d6b6f401aceaa Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Rework QByteArrayView comparison helpersIvan Solovev2024-03-184-14/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit fb50ab700600cbcdf21e5d06321f357eae4303bb replaced relational operators in QByteArrayView with comparison helper macros. That commit had to implement the helper methods as static members instead of hidden friends, because otherwise it broke the construction of QByteArrayView from QLatin1StringView. The reason for that is the conditional noexcept on the relational operators. The noexcept(noexcept(comparesEqual)) check inside the class declaration expands before the class is complete, and as a result discards the QByteArrayView constructor, which is restricted by the QtPrivate::IsContainerCompatibleWithQByteArrayView trait. Back then I could not find a proper solution, so just decided to declare the helper functions for QByteArrayView as private static members. Such approach has two drawbacks: - all new helper functions for QBAV vs other type T relational operators should also be static member functions, because the compiler always prefers member functions over friend functions, even if the argument types do not match. - QBAV helper functions cannot be used in generic code. Also, qCompareThreeWay() would not work for QBAV. To fix the issue this patch explicitly adds a QByteArrayView(QLatin1StringView) constructor which is not restricted by any trait. To keep the constructor constexpr, we have to move the actual definition into qlatin1stringview.h header file. Integrity compiler also complains about QByteArrayView(QUtf8StringView) constructors, so the same approach is used to enable them. This allows to convert all the private static member helpers in QByteArrayView to hidden friends. The extended tests will be added in a follow-up commit, because they require some more changes. Amends fb50ab700600cbcdf21e5d06321f357eae4303bb and a08bafc9205d0b67f71a1896ad84272eeb294374. This patch removes some exported methods and adds new ones, but it is not BiC, because the aforementioned patches are only merged into dev branch at this point. Task-number: QTBUG-108805 Change-Id: Iee6526a71d859c4fcb2e95bf20fe84ddead6dfb0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Bootstrap: remove the UTF-16 and UTF-32 codecsThiago Macieira2024-03-134-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Unlike most of everything else in the Bootstrap lib, this is code that couldn't be eliminated by the linker because they were referenced in one static array. Maybe an exceptionally smart whole-program analysis could do it, but GCC and Clang LTO modes don't do that now. I removed the code that performed detection from HTML and from data too. I could have left the detection of UTF-8 and "other" but this code wasn't necessary. In particular, QTextStream couldn't benefit from it because it already defaults to UTF-8, so the detection code would never determine anything different from the input. Drive-by removed QStringConverter::availableCodecs() too because it was in the middle of functions #ifdef'ed out to. This reduced the size of release-mode moc text data bss dec hex filename 1079858 5440 640 1085938 1091f2 original/moc 1074386 5200 640 1080226 107ba2 updated/moc -5472 -240 0 -5712 difference Change-Id: I01ec3c774d9943adb903fffd17b7f114c42874ac Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Bootstrap: remove qnumeric.cpp by using qnumeric_p.hThiago Macieira2024-03-133-18/+14
| | | | | | | | | That is, use the inline functions that refer to <numeric_limits> and <cmath> directly, instead of the out-of-line wrappers. Someone should verify if the hacks for QNX's <math.h> are still required. Change-Id: I01ec3c774d9943adb903fffd17b7ee560b4b71b9 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Use canonical capitalization of Unicode-3.0 SPDX tagKai Köhne2024-03-131-2/+2
| | | | | | | | | | | | | | | | | | | | The SPDX database lists the license as 'Unicode-3.0', and 'Unicode License v3'. Now, the SPDX standard actually says that License identifiers (including license exception identifiers) used in SPDX documents or source code files should be matched in a case- insensitive manner. But the website at https://spdx.org/licenses/ doesn't treat it this way, so the link we generate out of the identifier actually gives a 404. So it's just easier to use the 'original' capitalization. Amends 063026cc503 Pick-to: 6.5 6.6 6.7 Change-Id: I826077a914721b7b9499ad62c08fdf20be94e88d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Bootstrap: remove QDataStreamThiago Macieira2024-03-132-2/+2
| | | | | | | | | | | It was only used by the cmake_automoc_parser so it would write a 64-bit in big-endian format. So bypass QDataStream and write it native endianness. Change-Id: I01ec3c774d9943adb903fffd17b79c78e56db4cf Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* QString/QByteArray: add explicit constructors for Q{String,ByteArray}ViewThiago Macieira2024-03-122-2/+4
| | | | | | | | | | | | | | | | | | | std::string has them too, see constructor 10 in [1]. There, they are StringViewLike, something we may want to do here too, which would also lower the precedence of the constructor in the overload resolution. This will be needed for the non-const heterogeneous QHash::operator[]. [ChangeLog][QtCore][QByteArray] Added a constructor to create a QByteArray from QByteArrayView. [ChangeLog][QtCore][QString] Added a constructor to create a QString from QStringView. [1] https://en.cppreference.com/w/cpp/string/basic_string/basic_string Change-Id: I6818d78a57394e37857bfffd17b9ab03bd0253e6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* qstringalgorithms: include <iterator> in favor of <string.h>Dennis Oberst2024-03-121-2/+1
| | | | | | | | | | | | The switch from <string> to <string.h> dropped the definition of std::size. Include <iterator> since <string.h> is no longer used to pull in std::size. Amends: dc2ae08e02730ab795445bc047221aa56914f723. Pick-to: 6.7 Change-Id: Ib742538eb5d21c77fcae7ee9abb6d5329bbcfd63 Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* QtPrivate::equalStrings(): enforce matching size where applicableThiago Macieira2024-03-061-7/+15
| | | | | | | | | | | | | | | | Commit 8a7b74f6e71d6b8264f365148bf5a04db4038617 added these functions and already placed the checking for the size in the inline code. Aside from the operators==, the only other place that calls equalStrings() directly is QAnyStringView::equal() and that also checks the size for the non-UTF-8 string views do match. Unfortunately, the size checking for UTF-8 was only added in 52e0a91fbc187ca09d3ea6279e8bdce982edc586. This reverts commit e0eb93d9a2b104ac8d7596c419d1f13dc9db9b1b ("QLatin1StringView: delegate operator== to QByteArrayView") because that would compare the sizes again. Change-Id: I83dda2d36c904517b3c0fffd17b38e422b5e2c25 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
* Revert "QStringView: simplify the constructor from QString"Marc Mutz2024-03-062-8/+10
| | | | | | | | | | | | | | | This reverts commit 7d18ad49a37440835bb38bd77bc4e0991387ada0. Reason for revert: This changes the constructor from being a template to being a normal function, so changes overload resolution. The commit message gave no indication on why this is safe. Since it's just a nice to have, revert instead of running the risk of breaking code. Pick-to: 6.7 Change-Id: Icd506e7221bb50c99f276f6a43c15403ec0be7a9 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Replace some QString::fromUtf16() with QStringView::toString()Thiago Macieira2024-03-042-3/+6
| | | | | | | | | | | | | | The QStringView counterpart is somewhat faster because it doesn't go through the UTF-16 codec in QUtf16::convertToUnicode(), which tries to detect the BOM. I've included QString::fromWCharArray in this because: a) it's used extensively in Windows code b) wide chars in memory probably don't have BOMs anyway Change-Id: I01ec3c774d9943adb903fffd17b815be4d2ab8ba Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
* Move QLocaleData::convertDoubleToFloat to qnumeric_p.hThiago Macieira2024-03-041-16/+7
| | | | | | | So others can use it too. Change-Id: I01ec3c774d9943adb903fffd17b86236d06a948c Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Remove qbytearray_p.hGiuseppe D'Angelo2024-03-041-28/+0
| | | | | | | It's unused now. Change-Id: I948650abdbcc0dc0f7925c56e326762ba66e8ee9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocal8Bit::convertToUnicode[win]: rewrite remainingChars handling as recursiveMårten Nordheim2024-03-021-52/+62
| | | | | | | | | | | | | Then we will automatically handle invalid leading characters instead of throwing away the whole sequence when it cannot be converted. Added a test that was failing before. Drive-by change: add a comment explaining why we have the stack allocated buffer. Task-number: QTBUG-118834 Change-Id: I647a58f2ba95e2e7ed4ea6a964d99ecc0c91fad3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename qIsConstantEvaluated() to q20::is_constant_evaluated()Marc Mutz2024-03-023-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | We should really try to avoid another almost-std-compatible-but-not-quite idiom. When qIsConstantEvaluated() was added, the rationale was given that this cannot be q20, because we can't implement it in all compilers. But we can: returning false is a perfectly legal implementation, and makes most users actually simpler because the #ifdef'ery can be dropped. There are only two users that still require the macro, because either they do different fallbacks depending on whether the implementation is trivial, or because they direct expected test outcomes. The INTEGRITY compiler complains "calling __has_builtin() in a constant expression", which we currently don't understand. To unblock this patch, and therefore the 6.7 release, hard-code INTEGRITY to return false. Amends 95e6fac0a5a1eee3aa23e4da0a93c6c25e32fb98. Pick-to: 6.7 Change-Id: If6cae902ff434f2ccceb6057cb053b7f304a604c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QAnyStringView: use new comparison helper macrosIvan Solovev2024-03-022-23/+21
| | | | | | | | | | | Also extend unit-test to use new test helper functions. Remove the now-redundant test for three-way comparison, because it is covered by the test helper functions. Task-number: QTBUG-117661 Change-Id: I242b560c281245e04e34353c80000a20998fc677 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QUtf8StringView: use more comparison helper macrosIvan Solovev2024-03-021-19/+11
| | | | | | | | Convert the last relational operators to using the macros. Task-number: QTBUG-117661 Change-Id: I5c4c890527d1a3c9500e98f47881d2e17b101ca9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>