summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2020-04-22 12:50:55 +0200
committerMarc Mutz <marc.mutz@kdab.com>2020-04-24 12:45:53 +0200
commit20cdf807b1b6db2189024736047350cdc7be4887 (patch)
tree84f3e22370c11978e4684f332f99f6e1309032e6 /util
parent3238445b270d5fb98f4008cb10a8adcc2d35165c (diff)
QChar: port low-level functions from uint/ushort to char32/16_t
Now that the standard gives us proper types for UTF-16 and UTF-32 characters, use them. Will eventually make the code much easier to read than today, where uint could be an index as well as a char32_t. It also ensures that the result of e.g. QChar::highSurrogate() can still be implicitly converted to a QChar now that the QChar(non-characater-integral-types) ctors are being made explicit. [ChangeLog][QtCore][QChar] All low-level functions (e.g. highSurrogate()) now take and return char16_t instead of ushort and char32_t instead of uint. Change-Id: I9cd8ebf6fb998fe1075dae96c7c4484a057f0b91 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'util')
-rw-r--r--util/unicode/main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/util/unicode/main.cpp b/util/unicode/main.cpp
index cde9f40a48..6434d784fe 100644
--- a/util/unicode/main.cpp
+++ b/util/unicode/main.cpp
@@ -2533,11 +2533,21 @@ static QByteArray createPropertyInfo()
" return uc_properties + GET_PROP_INDEX(ucs4);\n"
"}\n"
"\n"
+ "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(char32_t ucs4) noexcept\n"
+ "{\n"
+ " return qGetProp(uint{ucs4});\n"
+ "}\n"
+ "\n"
"Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(ushort ucs2) noexcept\n"
"{\n"
" return uc_properties + GET_PROP_INDEX_UCS2(ucs2);\n"
"}\n"
"\n"
+ "Q_DECL_CONST_FUNCTION static inline const Properties *qGetProp(char16_t ucs2) noexcept\n"
+ "{\n"
+ " return qGetProp(ushort{ucs2});\n"
+ "}\n"
+ "\n"
"Q_DECL_CONST_FUNCTION Q_CORE_EXPORT const Properties * QT_FASTCALL properties(uint ucs4) noexcept\n"
"{\n"
" return qGetProp(ucs4);\n"