summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qchar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/text/qchar.cpp')
-rw-r--r--src/corelib/text/qchar.cpp39
1 files changed, 21 insertions, 18 deletions
diff --git a/src/corelib/text/qchar.cpp b/src/corelib/text/qchar.cpp
index f4c5ab969a..63296a92de 100644
--- a/src/corelib/text/qchar.cpp
+++ b/src/corelib/text/qchar.cpp
@@ -1,14 +1,6 @@
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
-// Don't define it while compiling this module, or USERS of Qt will
-// not be able to link.
-#ifdef QT_NO_CAST_FROM_ASCII
-# undef QT_NO_CAST_FROM_ASCII
-#endif
-#ifdef QT_NO_CAST_TO_ASCII
-# undef QT_NO_CAST_TO_ASCII
-#endif
#include "qchar.h"
#include "qdatastream.h"
@@ -63,6 +55,13 @@ QT_BEGIN_NAMESPACE
\ingroup string-processing
\reentrant
+ \compares strong
+ \compareswith strong char16_t QString QStringView QLatin1StringView QUtf8StringView
+ \endcompareswith
+ \compareswith strong {const char *} QByteArray QByteArrayView
+ The contents of the byte array is interpreted as utf-8.
+ \endcompareswith
+
In Qt, Unicode characters are 16-bit entities without any markup
or structure. This class represents such an entity. It is
lightweight, so it can be used everywhere. Most compilers treat
@@ -164,6 +163,8 @@ QT_BEGIN_NAMESPACE
\value [since 5.15] Unicode_12_1 Version 12.1
\value [since 5.15] Unicode_13_0 Version 13.0
\value [since 6.3] Unicode_14_0 Version 14.0
+ \value [since 6.5] Unicode_15_0 Version 15.0
+ \value [since 6.8] Unicode_15_1 Version 15.1
\value Unicode_Unassigned The value is not assigned to any character
in version 8.0 of Unicode.
@@ -323,6 +324,7 @@ QT_BEGIN_NAMESPACE
\value Script_Kaithi
\value Script_Kannada
\value Script_Katakana
+ \value [since 6.5] Script_Kawi
\value Script_KayahLi
\value Script_Kharoshthi
\value [since 5.15] Script_KhitanSmallScript
@@ -357,6 +359,7 @@ QT_BEGIN_NAMESPACE
\value [since 5.6] Script_Multani
\value Script_Myanmar
\value [since 5.5] Script_Nabataean
+ \value [since 6.3] Script_NagMundari
\value [since 5.15] Script_Nandinagari
\value [since 5.11] Script_Newa
\value Script_NewTaiLue
@@ -1744,42 +1747,42 @@ QDataStream &operator>>(QDataStream &in, QChar &chr)
*****************************************************************************/
/*!
- \fn bool QChar::operator==(QChar c1, QChar c2)
+ \fn bool QChar::operator==(const QChar &c1, const QChar &c2)
Returns \c true if \a c1 and \a c2 are the same Unicode character;
otherwise returns \c false.
*/
/*!
- \fn int QChar::operator!=(QChar c1, QChar c2)
+ \fn bool QChar::operator!=(const QChar &c1, const QChar &c2)
Returns \c true if \a c1 and \a c2 are not the same Unicode
character; otherwise returns \c false.
*/
/*!
- \fn int QChar::operator<=(QChar c1, QChar c2)
+ \fn bool QChar::operator<=(const QChar &c1, const QChar &c2)
Returns \c true if the numeric Unicode value of \a c1 is less than
or equal to that of \a c2; otherwise returns \c false.
*/
/*!
- \fn int QChar::operator>=(QChar c1, QChar c2)
+ \fn bool QChar::operator>=(const QChar &c1, const QChar &c2)
Returns \c true if the numeric Unicode value of \a c1 is greater than
or equal to that of \a c2; otherwise returns \c false.
*/
/*!
- \fn int QChar::operator<(QChar c1, QChar c2)
+ \fn bool QChar::operator<(const QChar &c1, const QChar &c2)
Returns \c true if the numeric Unicode value of \a c1 is less than
that of \a c2; otherwise returns \c false.
*/
/*!
- \fn int QChar::operator>(QChar c1, QChar c2)
+ \fn bool QChar::operator>(const QChar &c1, const QChar &c2)
Returns \c true if the numeric Unicode value of \a c1 is greater than
that of \a c2; otherwise returns \c false.
@@ -2057,8 +2060,8 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo
enum { NFQC_YES = 0, NFQC_NO = 1, NFQC_MAYBE = 3 };
- const ushort *string = reinterpret_cast<const ushort *>(str->constData());
- qsizetype length = str->length();
+ const auto *string = reinterpret_cast<const char16_t *>(str->constData());
+ qsizetype length = str->size();
// this avoids one out of bounds check in the loop
while (length > from && QChar::isHighSurrogate(string[length - 1]))
@@ -2101,8 +2104,8 @@ static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationFo
*lastStable = pos;
}
- if (length != str->length()) // low surrogate parts at the end of text
- *lastStable = str->length() - 1;
+ if (length != str->size()) // low surrogate parts at the end of text
+ *lastStable = str->size() - 1;
return true;
}