Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qchar.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qchar.h"
5
8
9#include <algorithm>
10
11QT_BEGIN_NAMESPACE
12
13#define FLAG(x) (1 << (x))
14
15/*!
16 \class QLatin1Char
17 \inmodule QtCore
18 \reentrant
19 \brief The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
20
21 \ingroup string-processing
22
23 This class is only useful to construct a QChar with 8-bit character.
24
25 \sa QChar, QLatin1StringView, QString
26*/
27
28/*!
29 \fn const char QLatin1Char::toLatin1() const
30
31 Converts a Latin-1 character to an 8-bit ASCII representation of the character.
32*/
33
34/*!
35 \fn QLatin1Char::unicode() const
36
37 Converts a Latin-1 character to an 16-bit-encoded Unicode representation
38 of the character.
39*/
40
41/*!
42 \fn QLatin1Char::QLatin1Char(char c)
43
44 Constructs a Latin-1 character for \a c. This constructor should be
45 used when the encoding of the input character is known to be Latin-1.
46*/
47
48/*!
49 \class QChar
50 \inmodule QtCore
51 \brief The QChar class provides a 16-bit Unicode character.
52
53 \ingroup string-processing
54 \reentrant
55
56 \compares strong
57 \compareswith strong char16_t QString QStringView QLatin1StringView QUtf8StringView
58 \endcompareswith
59 \compareswith strong {const char *} QByteArray QByteArrayView
60 The contents of the byte array is interpreted as UTF-8.
61 \endcompareswith
62
63 In Qt, Unicode characters are 16-bit entities without any markup
64 or structure. This class represents such an entity. It is
65 lightweight, so it can be used everywhere. Most compilers treat
66 it like an \c{unsigned short}.
67
68 QChar provides a full complement of testing/classification
69 functions, converting to and from other formats, converting from
70 composed to decomposed Unicode, and trying to compare and
71 case-convert if you ask it to.
72
73 The classification functions include functions like those in the
74 standard C++ header <cctype> (formerly <ctype.h>), but
75 operating on the full range of Unicode characters, not just for the ASCII
76 range. They all return true if the character is a certain type of character;
77 otherwise they return false. These classification functions are
78 isNull() (returns \c true if the character is '\\0'), isPrint()
79 (true if the character is any sort of printable character,
80 including whitespace), isPunct() (any sort of punctation),
81 isMark() (Unicode Mark), isLetter() (a letter), isNumber() (any
82 sort of numeric character, not just 0-9), isLetterOrNumber(), and
83 isDigit() (decimal digits). All of these are wrappers around
84 category() which return the Unicode-defined category of each
85 character. Some of these also calculate the derived properties
86 (for example isSpace() returns \c true if the character is of category
87 Separator_* or an exceptional code point from Other_Control category).
88
89 QChar also provides direction(), which indicates the "natural"
90 writing direction of this character. The joiningType() function
91 indicates how the character joins with it's neighbors (needed
92 mostly for Arabic or Syriac) and finally hasMirrored(), which indicates
93 whether the character needs to be mirrored when it is printed in
94 it's "unnatural" writing direction.
95
96 Composed Unicode characters (like \a ring) can be converted to
97 decomposed Unicode ("a" followed by "ring above") by using decomposition().
98
99 In Unicode, comparison is not necessarily possible and case
100 conversion is very difficult at best. Unicode, covering the
101 "entire" world, also includes most of the world's case and
102 sorting problems. operator==() and friends will do comparison
103 based purely on the numeric Unicode value (code point) of the
104 characters, and toUpper() and toLower() will do case changes when
105 the character has a well-defined uppercase/lowercase equivalent.
106 For locale-dependent comparisons, use QString::localeAwareCompare().
107
108 The conversion functions include unicode() (to a scalar),
109 toLatin1() (to scalar, but converts all non-Latin-1 characters to
110 0), row() (gives the Unicode row), cell() (gives the Unicode
111 cell), digitValue() (gives the integer value of any of the
112 numerous digit characters), and a host of constructors.
113
114 QChar provides constructors and cast operators that make it easy
115 to convert to and from traditional 8-bit \c{char}s. If you
116 defined \c QT_NO_CAST_FROM_ASCII and \c QT_NO_CAST_TO_ASCII, as
117 explained in the QString documentation, you will need to
118 explicitly call fromLatin1(), or use QLatin1Char,
119 to construct a QChar from an 8-bit \c char, and you will need to
120 call toLatin1() to get the 8-bit value back.
121
122 Starting with Qt 6.0, most QChar constructors are \c explicit. This
123 is done to avoid dangerous mistakes when accidentally mixing
124 integral types and strings.
125
126 For more information see
127 \l{https://www.unicode.org/ucd/}{"About the Unicode Character Database"}.
128
129 \sa Unicode, QString, QLatin1Char
130*/
131
132/*!
133 \enum QChar::UnicodeVersion
134
135 Specifies which version of the \l{Unicode standard} introduced a certain
136 character.
137
138 \value Unicode_1_1 Version 1.1
139 \value Unicode_2_0 Version 2.0
140 \value Unicode_2_1_2 Version 2.1.2
141 \value Unicode_3_0 Version 3.0
142 \value Unicode_3_1 Version 3.1
143 \value Unicode_3_2 Version 3.2
144 \value Unicode_4_0 Version 4.0
145 \value Unicode_4_1 Version 4.1
146 \value Unicode_5_0 Version 5.0
147 \value Unicode_5_1 Version 5.1
148 \value Unicode_5_2 Version 5.2
149 \value Unicode_6_0 Version 6.0
150 \value Unicode_6_1 Version 6.1
151 \value Unicode_6_2 Version 6.2
152 \value [since 5.3] Unicode_6_3 Version 6.3
153 \value [since 5.5] Unicode_7_0 Version 7.0
154 \value [since 5.6] Unicode_8_0 Version 8.0
155 \value [since 5.11] Unicode_9_0 Version 9.0
156 \value [since 5.11] Unicode_10_0 Version 10.0
157 \value [since 5.15] Unicode_11_0 Version 11.0
158 \value [since 5.15] Unicode_12_0 Version 12.0
159 \value [since 5.15] Unicode_12_1 Version 12.1
160 \value [since 5.15] Unicode_13_0 Version 13.0
161 \value [since 6.3] Unicode_14_0 Version 14.0
162 \value [since 6.5] Unicode_15_0 Version 15.0
163 \value [since 6.8] Unicode_15_1 Version 15.1
164 \value [since 6.9] Unicode_16_0 Version 16.0
165 \value Unicode_Unassigned The value is not assigned to any character
166 in version 8.0 of Unicode.
167
168 \sa unicodeVersion(), currentUnicodeVersion()
169*/
170
171/*!
172 \enum QChar::Category
173
174 This enum maps the Unicode character categories.
175
176 The following characters are normative in Unicode:
177
178 \value Mark_NonSpacing Unicode class name Mn
179
180 \value Mark_SpacingCombining Unicode class name Mc
181
182 \value Mark_Enclosing Unicode class name Me
183
184 \value Number_DecimalDigit Unicode class name Nd
185
186 \value Number_Letter Unicode class name Nl
187
188 \value Number_Other Unicode class name No
189
190 \value Separator_Space Unicode class name Zs
191
192 \value Separator_Line Unicode class name Zl
193
194 \value Separator_Paragraph Unicode class name Zp
195
196 \value Other_Control Unicode class name Cc
197
198 \value Other_Format Unicode class name Cf
199
200 \value Other_Surrogate Unicode class name Cs
201
202 \value Other_PrivateUse Unicode class name Co
203
204 \value Other_NotAssigned Unicode class name Cn
205
206
207 The following categories are informative in Unicode:
208
209 \value Letter_Uppercase Unicode class name Lu
210
211 \value Letter_Lowercase Unicode class name Ll
212
213 \value Letter_Titlecase Unicode class name Lt
214
215 \value Letter_Modifier Unicode class name Lm
216
217 \value Letter_Other Unicode class name Lo
218
219 \value Punctuation_Connector Unicode class name Pc
220
221 \value Punctuation_Dash Unicode class name Pd
222
223 \value Punctuation_Open Unicode class name Ps
224
225 \value Punctuation_Close Unicode class name Pe
226
227 \value Punctuation_InitialQuote Unicode class name Pi
228
229 \value Punctuation_FinalQuote Unicode class name Pf
230
231 \value Punctuation_Other Unicode class name Po
232
233 \value Symbol_Math Unicode class name Sm
234
235 \value Symbol_Currency Unicode class name Sc
236
237 \value Symbol_Modifier Unicode class name Sk
238
239 \value Symbol_Other Unicode class name So
240
241 \sa category()
242*/
243
244/*!
245 \enum QChar::Script
246 \since 5.1
247
248 This enum type defines the Unicode script property values.
249
250 For details about the Unicode script property values see
251 \l{https://www.unicode.org/reports/tr24/}{Unicode Standard Annex #24}.
252
253 In order to conform to C/C++ naming conventions "Script_" is prepended
254 to the codes used in the Unicode Standard.
255
256 \value Script_Unknown For unassigned, private-use, noncharacter, and surrogate code points.
257 \value Script_Inherited For characters that may be used with multiple scripts
258 and that inherit their script from the preceding characters.
259 These include nonspacing marks, enclosing marks,
260 and zero width joiner/non-joiner characters.
261 \value Script_Common For characters that may be used with multiple scripts
262 and that do not inherit their script from the preceding characters.
263
264 \value [since 5.11] Script_Adlam
265 \value [since 5.6] Script_Ahom
266 \value [since 5.6] Script_AnatolianHieroglyphs
267 \value Script_Arabic
268 \value Script_Armenian
269 \value Script_Avestan
270 \value Script_Balinese
271 \value Script_Bamum
272 \value [since 5.5] Script_BassaVah
273 \value Script_Batak
274 \value Script_Bengali
275 \value [since 5.11] Script_Bhaiksuki
276 \value Script_Bopomofo
277 \value Script_Brahmi
278 \value Script_Braille
279 \value Script_Buginese
280 \value Script_Buhid
281 \value Script_CanadianAboriginal
282 \value Script_Carian
283 \value [since 5.5] Script_CaucasianAlbanian
284 \value Script_Chakma
285 \value Script_Cham
286 \value Script_Cherokee
287 \value [since 5.15] Script_Chorasmian
288 \value Script_Coptic
289 \value Script_Cuneiform
290 \value Script_Cypriot
291 \value [since 6.3] Script_CyproMinoan
292 \value Script_Cyrillic
293 \value Script_Deseret
294 \value Script_Devanagari
295 \value [since 5.15] Script_DivesAkuru
296 \value [since 5.15] Script_Dogra
297 \value [since 5.5] Script_Duployan
298 \value Script_EgyptianHieroglyphs
299 \value [since 5.5] Script_Elbasan
300 \value [since 5.15] Script_Elymaic
301 \value Script_Ethiopic
302 \value [since 6.9] Script_Garay
303 \value Script_Georgian
304 \value Script_Glagolitic
305 \value Script_Gothic
306 \value [since 5.5] Script_Grantha
307 \value Script_Greek
308 \value Script_Gujarati
309 \value [since 5.15] Script_GunjalaGondi
310 \value Script_Gurmukhi
311 \value [since 6.9] Script_GurungKhema
312 \value Script_Han
313 \value Script_Hangul
314 \value [since 5.15] Script_HanifiRohingya
315 \value Script_Hanunoo
316 \value [since 5.6] Script_Hatran
317 \value Script_Hebrew
318 \value Script_Hiragana
319 \value Script_ImperialAramaic
320 \value Script_InscriptionalPahlavi
321 \value Script_InscriptionalParthian
322 \value Script_Javanese
323 \value Script_Kaithi
324 \value Script_Kannada
325 \value Script_Katakana
326 \value [since 6.5] Script_Kawi
327 \value Script_KayahLi
328 \value Script_Kharoshthi
329 \value [since 5.15] Script_KhitanSmallScript
330 \value Script_Khmer
331 \value [since 5.5] Script_Khojki
332 \value [since 5.5] Script_Khudawadi
333 \value [since 6.9] Script_KiratRai
334 \value Script_Lao
335 \value Script_Latin
336 \value Script_Lepcha
337 \value Script_Limbu
338 \value [since 5.5] Script_LinearA
339 \value Script_LinearB
340 \value Script_Lisu
341 \value Script_Lycian
342 \value Script_Lydian
343 \value [since 5.5] Script_Mahajani
344 \value [since 5.15] Script_Makasar
345 \value Script_Malayalam
346 \value Script_Mandaic
347 \value [since 5.5] Script_Manichaean
348 \value [since 5.11] Script_Marchen
349 \value [since 5.11] Script_MasaramGondi
350 \value [since 5.15] Script_Medefaidrin
351 \value Script_MeeteiMayek
352 \value [since 5.5] Script_MendeKikakui
353 \value Script_MeroiticCursive
354 \value Script_MeroiticHieroglyphs
355 \value Script_Miao
356 \value [since 5.5] Script_Modi
357 \value Script_Mongolian
358 \value [since 5.5] Script_Mro
359 \value [since 5.6] Script_Multani
360 \value Script_Myanmar
361 \value [since 5.5] Script_Nabataean
362 \value [since 6.3] Script_NagMundari
363 \value [since 5.15] Script_Nandinagari
364 \value [since 5.11] Script_Newa
365 \value Script_NewTaiLue
366 \value Script_Nko
367 \value [since 5.11] Script_Nushu
368 \value [since 5.15] Script_NyiakengPuachueHmong
369 \value Script_Ogham
370 \value Script_OlChiki
371 \value [since 6.9] Script_OlOnal
372 \value [since 5.6] Script_OldHungarian
373 \value Script_OldItalic
374 \value [since 5.5] Script_OldNorthArabian
375 \value [since 5.5] Script_OldPermic
376 \value Script_OldPersian
377 \value [since 5.15] Script_OldSogdian
378 \value Script_OldSouthArabian
379 \value Script_OldTurkic
380 \value [since 6.3] Script_OldUyghur
381 \value Script_Oriya
382 \value [since 5.11] Script_Osage
383 \value Script_Osmanya
384 \value [since 5.5] Script_PahawhHmong
385 \value [since 5.5] Script_Palmyrene
386 \value [since 5.5] Script_PauCinHau
387 \value Script_PhagsPa
388 \value Script_Phoenician
389 \value [since 5.5] Script_PsalterPahlavi
390 \value Script_Rejang
391 \value Script_Runic
392 \value Script_Samaritan
393 \value Script_Saurashtra
394 \value Script_Sharada
395 \value Script_Shavian
396 \value [since 5.5] Script_Siddham
397 \value [since 5.6] Script_SignWriting
398 \value Script_Sinhala
399 \value [since 5.15] Script_Sogdian
400 \value Script_SoraSompeng
401 \value [since 5.11] Script_Soyombo
402 \value Script_Sundanese
403 \value [since 6.9] Script_Sunuwar
404 \value Script_SylotiNagri
405 \value Script_Syriac
406 \value Script_Tagalog
407 \value Script_Tagbanwa
408 \value Script_TaiLe
409 \value Script_TaiTham
410 \value Script_TaiViet
411 \value Script_Takri
412 \value Script_Tamil
413 \value [since 5.11] Script_Tangut
414 \value [since 6.3] Script_Tangsa
415 \value Script_Telugu
416 \value Script_Thaana
417 \value Script_Thai
418 \value Script_Tibetan
419 \value Script_Tifinagh
420 \value [since 5.5] Script_Tirhuta
421 \value [since 6.9] Script_Todhri
422 \value [since 6.3] Script_Toto
423 \value [since 6.9] Script_TuluTigalari
424 \value Script_Ugaritic
425 \value Script_Vai
426 \value [since 6.3] Script_Vithkuqi
427 \value [since 5.15] Script_Wancho
428 \value [since 5.5] Script_WarangCiti
429 \value [since 5.15] Script_Yezidi
430 \value Script_Yi
431 \value [since 5.11] Script_ZanabazarSquare
432
433 \omitvalue ScriptCount
434
435 \sa script()
436*/
437
438/*!
439 \enum QChar::Direction
440
441 This enum type defines the Unicode direction attributes. See the
442 \l{https://www.unicode.org/reports/tr9/tr9-35.html#Table_Bidirectional_Character_Types}{Unicode
443 Standard} for a description of the values.
444
445 In order to conform to C/C++ naming conventions "Dir" is prepended
446 to the codes used in the Unicode Standard.
447
448 \value DirAL
449 \value DirAN
450 \value DirB
451 \value DirBN
452 \value DirCS
453 \value DirEN
454 \value DirES
455 \value DirET
456 \value [since 5.3] DirFSI
457 \value DirL
458 \value DirLRE
459 \value [since 5.3] DirLRI
460 \value DirLRO
461 \value DirNSM
462 \value DirON
463 \value DirPDF
464 \value [since 5.3] DirPDI
465 \value DirR
466 \value DirRLE
467 \value [since 5.3] DirRLI
468 \value DirRLO
469 \value DirS
470 \value DirWS
471
472 \sa direction()
473*/
474
475/*!
476 \enum QChar::Decomposition
477
478 This enum type defines the Unicode decomposition attributes. See
479 the \l{Unicode standard} for a description of the values.
480
481 \value NoDecomposition
482 \value Canonical
483 \value Circle
484 \value Compat
485 \value Final
486 \value Font
487 \value Fraction
488 \value Initial
489 \value Isolated
490 \value Medial
491 \value Narrow
492 \value NoBreak
493 \value Small
494 \value Square
495 \value Sub
496 \value Super
497 \value Vertical
498 \value Wide
499
500 \sa decomposition()
501*/
502
503/*!
504 \enum QChar::JoiningType
505 since 5.3
506
507 This enum type defines the Unicode joining type attributes. See the
508 \l{Unicode standard} for a description of the values.
509
510 In order to conform to C/C++ naming conventions "Joining_" is prepended
511 to the codes used in the Unicode Standard.
512
513 \value Joining_None
514 \value Joining_Causing
515 \value Joining_Dual
516 \value Joining_Right
517 \value Joining_Left
518 \value Joining_Transparent
519
520 \sa joiningType()
521*/
522
523/*!
524 \enum QChar::CombiningClass
525
526 \internal
527
528 This enum type defines names for some of the Unicode combining
529 classes. See the \l{Unicode Standard} for a description of the values.
530
531 \value Combining_Above
532 \value Combining_AboveAttached
533 \value Combining_AboveLeft
534 \value Combining_AboveLeftAttached
535 \value Combining_AboveRight
536 \value Combining_AboveRightAttached
537 \value Combining_Below
538 \value Combining_BelowAttached
539 \value Combining_BelowLeft
540 \value Combining_BelowLeftAttached
541 \value Combining_BelowRight
542 \value Combining_BelowRightAttached
543 \value Combining_DoubleAbove
544 \value Combining_DoubleBelow
545 \value Combining_IotaSubscript
546 \value Combining_Left
547 \value Combining_LeftAttached
548 \value Combining_Right
549 \value Combining_RightAttached
550*/
551
552/*!
553 \enum QChar::SpecialCharacter
554
555 \value Null A QChar with this value isNull().
556 \value Tabulation Character tabulation.
557 \value LineFeed
558 \value FormFeed
559 \value CarriageReturn
560 \value Space
561 \value Nbsp Non-breaking space.
562 \value SoftHyphen
563 \value ReplacementCharacter The character shown when a font has no glyph
564 for a certain codepoint. A special question mark character is often
565 used. Codecs use this codepoint when input data cannot be
566 represented in Unicode.
567 \value ObjectReplacementCharacter Used to represent an object such as an
568 image when such objects cannot be presented.
569 \value ByteOrderMark
570 \value ByteOrderSwapped
571 \value ParagraphSeparator
572 \value LineSeparator
573 \value [since 6.2] VisualTabCharacter Used to represent a tabulation as a horizontal arrow.
574 \value LastValidCodePoint
575*/
576
577/*!
578 \fn void QChar::setCell(uchar cell)
579 \internal
580*/
581
582/*!
583 \fn void QChar::setRow(uchar row)
584 \internal
585*/
586
587/*!
588 \fn QChar::QChar()
589
590 Constructs a null QChar ('\\0').
591
592 \sa isNull()
593*/
594
595/*!
596 \fn QChar::QChar(QLatin1Char ch)
597
598 Constructs a QChar corresponding to ASCII/Latin-1 character \a ch.
599
600//![qchar-implicit-conversions]
601 \note Since Qt 6.9, implicit conversions are disabled for this constructor.
602 That means it accepts only the constructor argument type and not everything
603 that implicitly converts to it. A backwards-compatible fix is to explicitly
604 cast to one of the supported argument types of QChar constructors.
605//![qchar-implicit-conversions]
606*/
607
608/*!
609 \fn QChar::QChar(SpecialCharacter ch)
610
611 Constructs a QChar for the predefined character value \a ch.
612
613 \include qchar.cpp qchar-implicit-conversions
614*/
615
616/*!
617 \fn QChar::QChar(char16_t ch)
618 \since 5.10
619
620 Constructs a QChar corresponding to the UTF-16 character \a ch.
621
622 \include qchar.cpp qchar-implicit-conversions
623*/
624
625/*!
626 \fn QChar::QChar(wchar_t ch)
627 \since 5.10
628
629 Constructs a QChar corresponding to the wide character \a ch.
630
631 \note This constructor is only available on Windows.
632
633 \include qchar.cpp qchar-implicit-conversions
634*/
635
636/*!
637 \fn QChar::QChar(char ch)
638
639 Constructs a QChar corresponding to ASCII/Latin-1 character \a ch.
640
641 \note This constructor is not available when \c QT_NO_CAST_FROM_ASCII
642 is defined.
643
644 \include qchar.cpp qchar-implicit-conversions
645
646 \sa QT_NO_CAST_FROM_ASCII
647*/
648
649/*!
650 \fn QChar::QChar(uchar ch)
651
652 Constructs a QChar corresponding to ASCII/Latin-1 character \a ch.
653
654 \note This constructor is not available when \c QT_NO_CAST_FROM_ASCII
655 or \c QT_RESTRICTED_CAST_FROM_ASCII is defined.
656
657 \include qchar.cpp qchar-implicit-conversions
658
659 \sa QT_NO_CAST_FROM_ASCII, QT_RESTRICTED_CAST_FROM_ASCII
660*/
661
662/*!
663 \fn QChar::QChar(uchar cell, uchar row)
664
665 Constructs a QChar for Unicode cell \a cell in row \a row.
666
667 \sa cell(), row()
668*/
669
670/*!
671 \fn QChar::QChar(ushort code)
672
673 Constructs a QChar for the character with Unicode code point \a code.
674
675 \include qchar.cpp qchar-implicit-conversions
676*/
677
678/*!
679 \fn QChar::QChar(short code)
680
681 Constructs a QChar for the character with Unicode code point \a code.
682
683 \include qchar.cpp qchar-implicit-conversions
684*/
685
686/*!
687 \fn QChar::QChar(char32_t code)
688
689 Constructs a QChar for the character with Unicode code point \a code.
690
691 \include qchar.cpp qchar-implicit-conversions
692*/
693
694/*!
695 \fn QChar::QChar(uint code)
696
697 Constructs a QChar for the character with Unicode code point \a code.
698
699 \include qchar.cpp qchar-implicit-conversions
700*/
701
702/*!
703 \fn QChar::QChar(int code)
704
705 Constructs a QChar for the character with Unicode code point \a code.
706
707 \include qchar.cpp qchar-implicit-conversions
708*/
709
710/*!
711 \fn static QChar QChar::fromUcs2(char16_t c)
712 \since 6.0
713
714 Constructs a QChar from UTF-16 character \a c.
715
716 \sa fromUcs4()
717*/
718
719/*!
720 \fn static auto QChar::fromUcs4(char32_t c)
721 \since 6.0
722
723 Returns an anonymous struct that
724 \list
725 \li contains a \c{char16_t chars[2]} array,
726 \li can be implicitly converted to a QStringView, and
727 \li iterated over with a C++11 ranged for loop.
728 \endlist
729
730 If \a c requires surrogates, \c{chars[0]} contains the high surrogate
731 and \c{chars[1]} the low surrogate, and the QStringView has size 2.
732 Otherwise, \c{chars[0]} contains \a c and \c{chars[1]} is
733 \l{QChar::isNull}{null}, and the QStringView has size 1.
734
735 This allows easy use of the result:
736
737 \code
738 QString s;
739 s += QChar::fromUcs4(ch);
740 \endcode
741
742 \code
743 for (char16_t c16 : QChar::fromUcs4(ch))
744 use(c16);
745 \endcode
746
747 \sa fromUcs2(), requiresSurrogates()
748*/
749
750/*!
751 \fn bool QChar::isNull() const
752
753 Returns \c true if the character is the Unicode character 0x0000
754 ('\\0'); otherwise returns \c false.
755*/
756
757/*!
758 \fn uchar QChar::cell() const
759
760 Returns the cell (least significant byte) of the Unicode character.
761
762 \sa row()
763*/
764
765/*!
766 \fn uchar QChar::row() const
767
768 Returns the row (most significant byte) of the Unicode character.
769
770 \sa cell()
771*/
772
773/*!
774 \fn bool QChar::isPrint() const
775
776 Returns \c true if the character is a printable character; otherwise
777 returns \c false. This is any character not of category Other_*.
778
779 Note that this gives no indication of whether the character is
780 available in a particular font.
781*/
782
783/*!
784 \overload
785 \since 5.0
786
787 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
788 a printable character; otherwise returns \c false.
789 This is any character not of category Other_*.
790
791 Note that this gives no indication of whether the character is
792 available in a particular font.
793
794 \note Before Qt 6, this function took a \c uint argument.
795*/
796bool QChar::isPrint(char32_t ucs4) noexcept
797{
798 if (ucs4 > LastValidCodePoint)
799 return false;
800 const int test = FLAG(Other_Control) |
801 FLAG(Other_Format) |
802 FLAG(Other_Surrogate) |
803 FLAG(Other_PrivateUse) |
804 FLAG(Other_NotAssigned);
805 return !(FLAG(qGetProp(ucs4)->category) & test);
806}
807
808/*!
809 \fn bool QChar::isSpace() const
810
811 Returns \c true if the character is a separator character
812 (Separator_* categories or certain code points from Other_Control category);
813 otherwise returns \c false.
814*/
815
816/*!
817 \fn bool QChar::isSpace(char32_t ucs4)
818 \overload
819 \since 5.0
820
821 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
822 a separator character (Separator_* categories or certain code points
823 from Other_Control category); otherwise returns \c false.
824
825 \note Before Qt 6, this function took a \c uint argument.
826*/
827
828/*!
829 \internal
830*/
831bool QT_FASTCALL QChar::isSpace_helper(char32_t ucs4) noexcept
832{
833 if (ucs4 > LastValidCodePoint)
834 return false;
835 const int test = FLAG(Separator_Space) |
836 FLAG(Separator_Line) |
837 FLAG(Separator_Paragraph);
838 return FLAG(qGetProp(ucs4)->category) & test;
839}
840
841/*!
842 \fn bool QChar::isMark() const
843
844 Returns \c true if the character is a mark (Mark_* categories);
845 otherwise returns \c false.
846
847 See QChar::Category for more information regarding marks.
848*/
849
850/*!
851 \overload
852 \since 5.0
853
854 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
855 a mark (Mark_* categories); otherwise returns \c false.
856
857 \note Before Qt 6, this function took a \c uint argument.
858*/
859bool QChar::isMark(char32_t ucs4) noexcept
860{
861 if (ucs4 > LastValidCodePoint)
862 return false;
863 const int test = FLAG(Mark_NonSpacing) |
864 FLAG(Mark_SpacingCombining) |
865 FLAG(Mark_Enclosing);
866 return FLAG(qGetProp(ucs4)->category) & test;
867}
868
869/*!
870 \fn bool QChar::isPunct() const
871
872 Returns \c true if the character is a punctuation mark (Punctuation_*
873 categories); otherwise returns \c false.
874*/
875
876/*!
877 \overload
878 \since 5.0
879
880 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
881 a punctuation mark (Punctuation_* categories); otherwise returns \c false.
882
883 \note Before Qt 6, this function took a \c uint argument.
884*/
885bool QChar::isPunct(char32_t ucs4) noexcept
886{
887 if (ucs4 > LastValidCodePoint)
888 return false;
889 const int test = FLAG(Punctuation_Connector) |
890 FLAG(Punctuation_Dash) |
891 FLAG(Punctuation_Open) |
892 FLAG(Punctuation_Close) |
893 FLAG(Punctuation_InitialQuote) |
894 FLAG(Punctuation_FinalQuote) |
895 FLAG(Punctuation_Other);
896 return FLAG(qGetProp(ucs4)->category) & test;
897}
898
899/*!
900 \fn bool QChar::isSymbol() const
901
902 Returns \c true if the character is a symbol (Symbol_* categories);
903 otherwise returns \c false.
904*/
905
906/*!
907 \overload
908 \since 5.0
909
910 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
911 a symbol (Symbol_* categories); otherwise returns \c false.
912
913 \note Before Qt 6, this function took a \c uint argument.
914*/
915bool QChar::isSymbol(char32_t ucs4) noexcept
916{
917 if (ucs4 > LastValidCodePoint)
918 return false;
919 const int test = FLAG(Symbol_Math) |
920 FLAG(Symbol_Currency) |
921 FLAG(Symbol_Modifier) |
922 FLAG(Symbol_Other);
923 return FLAG(qGetProp(ucs4)->category) & test;
924}
925
926/*!
927 \fn bool QChar::isLetter() const
928
929 Returns \c true if the character is a letter (Letter_* categories);
930 otherwise returns \c false.
931*/
932
933/*!
934 \fn bool QChar::isLetter(char32_t ucs4)
935 \overload
936 \since 5.0
937
938 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
939 a letter (Letter_* categories); otherwise returns \c false.
940
941 \note Before Qt 6, this function took a \c uint argument.
942*/
943
944/*!
945 \internal
946*/
947bool QT_FASTCALL QChar::isLetter_helper(char32_t ucs4) noexcept
948{
949 if (ucs4 > LastValidCodePoint)
950 return false;
951 const int test = FLAG(Letter_Uppercase) |
952 FLAG(Letter_Lowercase) |
953 FLAG(Letter_Titlecase) |
954 FLAG(Letter_Modifier) |
955 FLAG(Letter_Other);
956 return FLAG(qGetProp(ucs4)->category) & test;
957}
958
959/*!
960 \fn bool QChar::isNumber() const
961
962 Returns \c true if the character is a number (Number_* categories,
963 not just 0-9); otherwise returns \c false.
964
965 \sa isDigit()
966*/
967
968/*!
969 \fn bool QChar::isNumber(char32_t ucs4)
970 \overload
971 \since 5.0
972
973 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
974 a number (Number_* categories, not just 0-9); otherwise returns \c false.
975
976 \note Before Qt 6, this function took a \c uint argument.
977
978 \sa isDigit()
979*/
980
981/*!
982 \internal
983*/
984bool QT_FASTCALL QChar::isNumber_helper(char32_t ucs4) noexcept
985{
986 if (ucs4 > LastValidCodePoint)
987 return false;
988 const int test = FLAG(Number_DecimalDigit) |
989 FLAG(Number_Letter) |
990 FLAG(Number_Other);
991 return FLAG(qGetProp(ucs4)->category) & test;
992}
993
994/*!
995 \fn bool QChar::isLetterOrNumber() const
996
997 Returns \c true if the character is a letter or number (Letter_* or
998 Number_* categories); otherwise returns \c false.
999*/
1000
1001/*!
1002 \fn bool QChar::isLetterOrNumber(char32_t ucs4)
1003 \overload
1004 \since 5.0
1005
1006 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
1007 a letter or number (Letter_* or Number_* categories); otherwise returns \c false.
1008
1009 \note Before Qt 6, this function took a \c uint argument.
1010*/
1011
1012/*!
1013 \internal
1014*/
1015bool QT_FASTCALL QChar::isLetterOrNumber_helper(char32_t ucs4) noexcept
1016{
1017 if (ucs4 > LastValidCodePoint)
1018 return false;
1019 const int test = FLAG(Letter_Uppercase) |
1020 FLAG(Letter_Lowercase) |
1021 FLAG(Letter_Titlecase) |
1022 FLAG(Letter_Modifier) |
1023 FLAG(Letter_Other) |
1024 FLAG(Number_DecimalDigit) |
1025 FLAG(Number_Letter) |
1026 FLAG(Number_Other);
1027 return FLAG(qGetProp(ucs4)->category) & test;
1028}
1029
1030/*!
1031 \fn bool QChar::isDigit() const
1032
1033 Returns \c true if the character is a decimal digit
1034 (Number_DecimalDigit); otherwise returns \c false.
1035
1036 \sa isNumber()
1037*/
1038
1039/*!
1040 \fn bool QChar::isDigit(char32_t ucs4)
1041 \overload
1042 \since 5.0
1043
1044 Returns \c true if the UCS-4-encoded character specified by \a ucs4 is
1045 a decimal digit (Number_DecimalDigit); otherwise returns \c false.
1046
1047 \note Before Qt 6, this function took a \c uint argument.
1048
1049 \sa isNumber()
1050*/
1051
1052/*!
1053 \fn bool QChar::isNonCharacter() const
1054 \since 5.0
1055
1056 Returns \c true if the QChar is a non-character; false otherwise.
1057
1058 Unicode has a certain number of code points that are classified
1059 as "non-characters:" that is, they can be used for internal purposes
1060 in applications but cannot be used for text interchange.
1061 Those are the last two entries each Unicode Plane ([0xfffe..0xffff],
1062 [0x1fffe..0x1ffff], etc.) as well as the entries in range [0xfdd0..0xfdef].
1063*/
1064
1065/*!
1066 \fn bool QChar::isHighSurrogate() const
1067
1068 Returns \c true if the QChar is the high part of a UTF16 surrogate
1069 (for example if its code point is in range [0xd800..0xdbff]); false otherwise.
1070*/
1071
1072/*!
1073 \fn bool QChar::isLowSurrogate() const
1074
1075 Returns \c true if the QChar is the low part of a UTF16 surrogate
1076 (for example if its code point is in range [0xdc00..0xdfff]); false otherwise.
1077*/
1078
1079/*!
1080 \fn bool QChar::isSurrogate() const
1081 \since 5.0
1082
1083 Returns \c true if the QChar contains a code point that is in either
1084 the high or the low part of the UTF-16 surrogate range
1085 (for example if its code point is in range [0xd800..0xdfff]); false otherwise.
1086*/
1087
1088/*!
1089 \fn static bool QChar::isNonCharacter(char32_t ucs4)
1090 \overload
1091 \since 5.0
1092
1093 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1094 is a non-character; false otherwise.
1095
1096 Unicode has a certain number of code points that are classified
1097 as "non-characters:" that is, they can be used for internal purposes
1098 in applications but cannot be used for text interchange.
1099 Those are the last two entries each Unicode Plane ([0xfffe..0xffff],
1100 [0x1fffe..0x1ffff], etc.) as well as the entries in range [0xfdd0..0xfdef].
1101
1102 \note Before Qt 6, this function took a \c uint argument.
1103*/
1104
1105/*!
1106 \fn static bool QChar::isHighSurrogate(char32_t ucs4)
1107 \overload
1108
1109 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1110 is the high part of a UTF16 surrogate
1111 (for example if its code point is in range [0xd800..0xdbff]); false otherwise.
1112
1113 \note Before Qt 6, this function took a \c uint argument.
1114*/
1115
1116/*!
1117 \fn static bool QChar::isLowSurrogate(char32_t ucs4)
1118 \overload
1119
1120 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1121 is the low part of a UTF16 surrogate
1122 (for example if its code point is in range [0xdc00..0xdfff]); false otherwise.
1123
1124 \note Before Qt 6, this function took a \c uint argument.
1125*/
1126
1127/*!
1128 \fn static bool QChar::isSurrogate(char32_t ucs4)
1129 \overload
1130 \since 5.0
1131
1132 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1133 contains a code point that is in either the high or the low part of the
1134 UTF-16 surrogate range (for example if its code point is in range [0xd800..0xdfff]);
1135 false otherwise.
1136
1137 \note Before Qt 6, this function took a \c uint argument.
1138*/
1139
1140/*!
1141 \fn static bool QChar::requiresSurrogates(char32_t ucs4)
1142
1143 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1144 can be split into the high and low parts of a UTF16 surrogate
1145 (for example if its code point is greater than or equals to 0x10000);
1146 false otherwise.
1147
1148 \note Before Qt 6, this function took a \c uint argument.
1149*/
1150
1151/*!
1152 \fn static char32_t QChar::surrogateToUcs4(char16_t high, char16_t low)
1153
1154 Converts a UTF16 surrogate pair with the given \a high and \a low values
1155 to it's UCS-4-encoded code point.
1156
1157 \note Before Qt 6, this function took \c ushort arguments and returned \c uint.
1158*/
1159
1160/*!
1161 \fn static char32_t QChar::surrogateToUcs4(QChar high, QChar low)
1162 \overload
1163
1164 Converts a UTF16 surrogate pair (\a high, \a low) to it's UCS-4-encoded code point.
1165
1166 \note Before Qt 6, this function returned \c uint.
1167*/
1168
1169/*!
1170 \fn static char16_t QChar::highSurrogate(char32_t ucs4)
1171
1172 Returns the high surrogate part of a UCS-4-encoded code point.
1173 The returned result is undefined if \a ucs4 is smaller than 0x10000.
1174
1175 \note Before Qt 6, this function took a \c uint argument and returned \c ushort.
1176*/
1177
1178/*!
1179 \fn static char16_t QChar::lowSurrogate(char32_t ucs4)
1180
1181 Returns the low surrogate part of a UCS-4-encoded code point.
1182 The returned result is undefined if \a ucs4 is smaller than 0x10000.
1183
1184 \note Before Qt 6, this function took a \c uint argument and returned \c ushort.
1185*/
1186
1187/*!
1188 \fn int QChar::digitValue() const
1189
1190 Returns the numeric value of the digit, or -1 if the character is not a digit.
1191*/
1192
1193/*!
1194 \overload
1195 Returns the numeric value of the digit specified by the UCS-4-encoded
1196 character, \a ucs4, or -1 if the character is not a digit.
1197
1198 \note Before Qt 6, this function took a \c uint argument.
1199*/
1200int QChar::digitValue(char32_t ucs4) noexcept
1201{
1202 if (ucs4 > LastValidCodePoint)
1203 return -1;
1204 return qGetProp(ucs4)->digitValue;
1205}
1206
1207/*!
1208 \fn QChar::Category QChar::category() const
1209
1210 Returns the character's category.
1211*/
1212
1213/*!
1214 \overload
1215 Returns the category of the UCS-4-encoded character specified by \a ucs4.
1216
1217 \note Before Qt 6, this function took a \c uint argument.
1218*/
1219QChar::Category QChar::category(char32_t ucs4) noexcept
1220{
1221 if (ucs4 > LastValidCodePoint)
1222 return QChar::Other_NotAssigned;
1223 return (QChar::Category) qGetProp(ucs4)->category;
1224}
1225
1226/*!
1227 \fn QChar::Direction QChar::direction() const
1228
1229 Returns the character's direction.
1230*/
1231
1232/*!
1233 \overload
1234 Returns the direction of the UCS-4-encoded character specified by \a ucs4.
1235
1236 \note Before Qt 6, this function took a \c uint argument.
1237*/
1238QChar::Direction QChar::direction(char32_t ucs4) noexcept
1239{
1240 if (ucs4 > LastValidCodePoint)
1241 return QChar::DirL;
1242 return (QChar::Direction) qGetProp(ucs4)->direction;
1243}
1244
1245/*!
1246 \fn QChar::JoiningType QChar::joiningType() const
1247 \since 5.3
1248
1249 Returns information about the joining type attributes of the character
1250 (needed for certain languages such as Arabic or Syriac).
1251*/
1252
1253/*!
1254 \overload
1255 \since 5.3
1256
1257 Returns information about the joining type attributes of the UCS-4-encoded
1258 character specified by \a ucs4
1259 (needed for certain languages such as Arabic or Syriac).
1260
1261 \note Before Qt 6, this function took a \c uint argument.
1262*/
1263QChar::JoiningType QChar::joiningType(char32_t ucs4) noexcept
1264{
1265 if (ucs4 > LastValidCodePoint)
1266 return QChar::Joining_None;
1267 return QChar::JoiningType(qGetProp(ucs4)->joining);
1268}
1269
1270/*!
1271 \fn bool QChar::hasMirrored() const
1272
1273 Returns \c true if the character should be reversed if the text
1274 direction is reversed; otherwise returns \c false.
1275
1276 A bit faster equivalent of (ch.mirroredChar() != ch).
1277
1278 \sa mirroredChar()
1279*/
1280
1281/*!
1282 \overload
1283 \since 5.0
1284
1285 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1286 should be reversed if the text direction is reversed; otherwise returns \c false.
1287
1288 A bit faster equivalent of (QChar::mirroredChar(ucs4) != ucs4).
1289
1290 \note Before Qt 6, this function took a \c uint argument.
1291
1292 \sa mirroredChar()
1293*/
1294bool QChar::hasMirrored(char32_t ucs4) noexcept
1295{
1296 if (ucs4 > LastValidCodePoint)
1297 return false;
1298 return qGetProp(ucs4)->mirrorDiff != 0;
1299}
1300
1301/*!
1302 \fn bool QChar::isLower() const
1303
1304 Returns \c true if the character is a lowercase letter, for example
1305 category() is Letter_Lowercase.
1306
1307 \sa isUpper(), toLower(), toUpper()
1308*/
1309
1310/*!
1311 \fn static bool QChar::isLower(char32_t ucs4)
1312 \overload
1313 \since 5.0
1314
1315 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1316 is a lowercase letter, for example category() is Letter_Lowercase.
1317
1318 \note Before Qt 6, this function took a \c uint argument.
1319
1320 \sa isUpper(), toLower(), toUpper()
1321*/
1322
1323/*!
1324 \fn bool QChar::isUpper() const
1325
1326 Returns \c true if the character is an uppercase letter, for example
1327 category() is Letter_Uppercase.
1328
1329 \sa isLower(), toUpper(), toLower()
1330*/
1331
1332/*!
1333 \fn static bool QChar::isUpper(char32_t ucs4)
1334 \overload
1335 \since 5.0
1336
1337 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1338 is an uppercase letter, for example category() is Letter_Uppercase.
1339
1340 \note Before Qt 6, this function took a \c uint argument.
1341
1342 \sa isLower(), toUpper(), toLower()
1343*/
1344
1345/*!
1346 \fn bool QChar::isTitleCase() const
1347
1348 Returns \c true if the character is a titlecase letter, for example
1349 category() is Letter_Titlecase.
1350
1351 \sa isLower(), toUpper(), toLower(), toTitleCase()
1352*/
1353
1354/*!
1355 \fn static bool QChar::isTitleCase(char32_t ucs4)
1356 \overload
1357 \since 5.0
1358
1359 Returns \c true if the UCS-4-encoded character specified by \a ucs4
1360 is a titlecase letter, for example category() is Letter_Titlecase.
1361
1362 \note Before Qt 6, this function took a \c uint argument.
1363
1364 \sa isLower(), toUpper(), toLower(), toTitleCase()
1365*/
1366/*!
1367 \fn QChar QChar::mirroredChar() const
1368
1369 Returns the mirrored character if this character is a mirrored
1370 character; otherwise returns the character itself.
1371
1372 \sa hasMirrored()
1373*/
1374
1375/*!
1376 \overload
1377 Returns the mirrored character if the UCS-4-encoded character specified
1378 by \a ucs4 is a mirrored character; otherwise returns the character itself.
1379
1380 \note Before Qt 6, this function took a \c uint argument and returned \c uint.
1381
1382 \sa hasMirrored()
1383*/
1384char32_t QChar::mirroredChar(char32_t ucs4) noexcept
1385{
1386 if (ucs4 > LastValidCodePoint)
1387 return ucs4;
1388 return ucs4 + qGetProp(ucs4)->mirrorDiff;
1389}
1390
1391// Constants for Hangul (de)composition, see UAX #15:
1392static constexpr char32_t Hangul_SBase = 0xac00;
1393static constexpr char32_t Hangul_LBase = 0x1100;
1394static constexpr char32_t Hangul_VBase = 0x1161;
1395static constexpr char32_t Hangul_TBase = 0x11a7;
1396static constexpr quint32 Hangul_LCount = 19;
1397static constexpr quint32 Hangul_VCount = 21;
1398static constexpr quint32 Hangul_TCount = 28;
1399static constexpr quint32 Hangul_NCount = Hangul_VCount * Hangul_TCount;
1400static constexpr quint32 Hangul_SCount = Hangul_LCount * Hangul_NCount;
1401
1402// buffer has to have a length of 3. It's needed for Hangul decomposition
1403static const QChar * QT_FASTCALL decompositionHelper(
1404 char32_t ucs4, qsizetype *length, QChar::Decomposition *tag, QChar *buffer)
1405{
1406 if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount) {
1407 // compute Hangul syllable decomposition as per UAX #15
1408 const char32_t SIndex = ucs4 - Hangul_SBase;
1409 buffer[0] = QChar(Hangul_LBase + SIndex / Hangul_NCount); // L
1410 buffer[1] = QChar(Hangul_VBase + (SIndex % Hangul_NCount) / Hangul_TCount); // V
1411 buffer[2] = QChar(Hangul_TBase + SIndex % Hangul_TCount); // T
1412 *length = buffer[2].unicode() == Hangul_TBase ? 2 : 3;
1413 *tag = QChar::Canonical;
1414 return buffer;
1415 }
1416
1417 const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);
1418 if (index == 0xffff) {
1419 *length = 0;
1420 *tag = QChar::NoDecomposition;
1421 return nullptr;
1422 }
1423
1424 const unsigned short *decomposition = uc_decomposition_map+index;
1425 *tag = QChar::Decomposition((*decomposition) & 0xff);
1426 *length = (*decomposition) >> 8;
1427 return reinterpret_cast<const QChar *>(decomposition + 1);
1428}
1429
1430/*!
1431 Decomposes a character into it's constituent parts. Returns an empty string
1432 if no decomposition exists.
1433*/
1434QString QChar::decomposition() const
1435{
1436 return QChar::decomposition(ucs);
1437}
1438
1439/*!
1440 \overload
1441 Decomposes the UCS-4-encoded character specified by \a ucs4 into it's
1442 constituent parts. Returns an empty string if no decomposition exists.
1443
1444 \note Before Qt 6, this function took a \c uint argument.
1445*/
1446QString QChar::decomposition(char32_t ucs4)
1447{
1448 QChar buffer[3];
1449 qsizetype length;
1450 QChar::Decomposition tag;
1451 const QChar *d = decompositionHelper(ucs4, &length, &tag, buffer);
1452 return QString(d, length);
1453}
1454
1455/*!
1456 \fn QChar::Decomposition QChar::decompositionTag() const
1457
1458 Returns the tag defining the composition of the character. Returns
1459 QChar::NoDecomposition if no decomposition exists.
1460*/
1461
1462/*!
1463 \overload
1464 Returns the tag defining the composition of the UCS-4-encoded character
1465 specified by \a ucs4. Returns QChar::NoDecomposition if no decomposition exists.
1466
1467 \note Before Qt 6, this function took a \c uint argument.
1468*/
1469QChar::Decomposition QChar::decompositionTag(char32_t ucs4) noexcept
1470{
1471 if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount)
1472 return QChar::Canonical;
1473 const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);
1474 if (index == 0xffff)
1475 return QChar::NoDecomposition;
1476 return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff);
1477}
1478
1479/*!
1480 \fn unsigned char QChar::combiningClass() const
1481
1482 Returns the combining class for the character as defined in the
1483 Unicode standard. This is mainly useful as a positioning hint for
1484 marks attached to a base character.
1485
1486 The Qt text rendering engine uses this information to correctly
1487 position non-spacing marks around a base character.
1488*/
1489
1490/*!
1491 \overload
1492 Returns the combining class for the UCS-4-encoded character specified by
1493 \a ucs4, as defined in the Unicode standard.
1494
1495 \note Before Qt 6, this function took a \c uint argument.
1496*/
1497unsigned char QChar::combiningClass(char32_t ucs4) noexcept
1498{
1499 if (ucs4 > LastValidCodePoint)
1500 return 0;
1501 return (unsigned char) qGetProp(ucs4)->combiningClass;
1502}
1503
1504/*!
1505 \fn QChar::Script QChar::script() const
1506 \since 5.1
1507
1508 Returns the Unicode script property value for this character.
1509*/
1510
1511/*!
1512 \overload
1513 \since 5.1
1514
1515 Returns the Unicode script property value for the character specified in
1516 its UCS-4-encoded form as \a ucs4.
1517
1518 \note Before Qt 6, this function took a \c uint argument.
1519*/
1520QChar::Script QChar::script(char32_t ucs4) noexcept
1521{
1522 if (ucs4 > LastValidCodePoint)
1523 return QChar::Script_Unknown;
1524 return (QChar::Script) qGetProp(ucs4)->script;
1525}
1526
1527/*!
1528 \fn QChar::UnicodeVersion QChar::unicodeVersion() const
1529
1530 Returns the Unicode version that introduced this character.
1531*/
1532
1533/*!
1534 \overload
1535 Returns the Unicode version that introduced the character specified in
1536 its UCS-4-encoded form as \a ucs4.
1537
1538 \note Before Qt 6, this function took a \c uint argument.
1539*/
1540QChar::UnicodeVersion QChar::unicodeVersion(char32_t ucs4) noexcept
1541{
1542 if (ucs4 > LastValidCodePoint)
1543 return QChar::Unicode_Unassigned;
1544 return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;
1545}
1546
1547/*!
1548 Returns the most recent supported Unicode version.
1549*/
1550QChar::UnicodeVersion QChar::currentUnicodeVersion() noexcept
1551{
1552 return UNICODE_DATA_VERSION;
1553}
1554
1555static auto fullConvertCase(char32_t uc, QUnicodeTables::Case which) noexcept
1556{
1557 struct R {
1558 char16_t chars[MaxSpecialCaseLength + 1];
1559 qint8 sz;
1560
1561 // iterable
1562 auto begin() const { return chars; }
1563 auto end() const { return chars + sz; }
1564 // QStringView-compatible
1565 auto data() const { return chars; }
1566 auto size() const { return sz; }
1567 } result;
1568 Q_ASSERT(uc <= QChar::LastValidCodePoint);
1569
1570 auto pp = result.chars;
1571
1572 const auto fold = qGetProp(uc)->cases[which];
1573 const auto caseDiff = fold.diff;
1574
1575 if (Q_UNLIKELY(fold.special)) {
1576 const auto *specialCase = specialCaseMap + caseDiff;
1577 auto length = *specialCase++;
1578 while (length--)
1579 *pp++ = *specialCase++;
1580 } else {
1581 // so far, case conversion never changes planes (guaranteed by the qunicodetables generator)
1582 for (char16_t c : QChar::fromUcs4(uc + caseDiff))
1583 *pp++ = c;
1584 }
1585 result.sz = pp - result.chars;
1586 return result;
1587}
1588
1589template <typename T>
1590Q_DECL_CONST_FUNCTION static inline T convertCase_helper(T uc, QUnicodeTables::Case which) noexcept
1591{
1592 const auto fold = qGetProp(uc)->cases[which];
1593
1594 if (Q_UNLIKELY(fold.special)) {
1595 const ushort *specialCase = specialCaseMap + fold.diff;
1596 // so far, there are no special cases beyond BMP (guaranteed by the qunicodetables generator)
1597 return *specialCase == 1 ? specialCase[1] : uc;
1598 }
1599
1600 return uc + fold.diff;
1601}
1602
1603/*!
1604 \fn QChar QChar::toLower() const
1605
1606 Returns the lowercase equivalent if the character is uppercase or titlecase;
1607 otherwise returns the character itself.
1608*/
1609
1610/*!
1611 \overload
1612 Returns the lowercase equivalent of the UCS-4-encoded character specified
1613 by \a ucs4 if the character is uppercase or titlecase; otherwise returns
1614 the character itself.
1615
1616 \note Before Qt 6, this function took a \c uint argument and returned \c uint.
1617*/
1618char32_t QChar::toLower(char32_t ucs4) noexcept
1619{
1620 if (ucs4 > LastValidCodePoint)
1621 return ucs4;
1622 return convertCase_helper(ucs4, QUnicodeTables::LowerCase);
1623}
1624
1625/*!
1626 \fn QChar QChar::toUpper() const
1627
1628 Returns the uppercase equivalent if the character is lowercase or titlecase;
1629 otherwise returns the character itself.
1630
1631 \note This function also returns the original character in the rare case of
1632 the uppercase form of the character requiring two or more characters.
1633
1634 \sa QString::toUpper()
1635*/
1636
1637/*!
1638 \overload
1639 Returns the uppercase equivalent of the UCS-4-encoded character specified
1640 by \a ucs4 if the character is lowercase or titlecase; otherwise returns
1641 the character itself.
1642
1643 \note This function also returns the original character in the rare case of
1644 the uppercase form of the character requiring two or more characters.
1645
1646 \note Before Qt 6, this function took a \c uint argument and returned \c uint.
1647
1648 \sa QString::toUpper()
1649*/
1650char32_t QChar::toUpper(char32_t ucs4) noexcept
1651{
1652 if (ucs4 > LastValidCodePoint)
1653 return ucs4;
1654 return convertCase_helper(ucs4, QUnicodeTables::UpperCase);
1655}
1656
1657/*!
1658 \fn QChar QChar::toTitleCase() const
1659
1660 Returns the title case equivalent if the character is lowercase or uppercase;
1661 otherwise returns the character itself.
1662*/
1663
1664/*!
1665 \overload
1666 Returns the title case equivalent of the UCS-4-encoded character specified
1667 by \a ucs4 if the character is lowercase or uppercase; otherwise returns
1668 the character itself.
1669
1670 \note Before Qt 6, this function took a \c uint argument and returned \c uint.
1671*/
1672char32_t QChar::toTitleCase(char32_t ucs4) noexcept
1673{
1674 if (ucs4 > LastValidCodePoint)
1675 return ucs4;
1676 return convertCase_helper(ucs4, QUnicodeTables::TitleCase);
1677}
1678
1679static inline char32_t foldCase(const char16_t *ch, const char16_t *start)
1680{
1681 char32_t ucs4 = *ch;
1682 if (QChar::isLowSurrogate(ucs4) && ch > start && QChar::isHighSurrogate(*(ch - 1)))
1683 ucs4 = QChar::surrogateToUcs4(*(ch - 1), ucs4);
1684 return convertCase_helper(ucs4, QUnicodeTables::CaseFold);
1685}
1686
1687static inline char32_t foldCase(char32_t ch, char32_t &last) noexcept
1688{
1689 char32_t ucs4 = ch;
1690 if (QChar::isLowSurrogate(ucs4) && QChar::isHighSurrogate(last))
1691 ucs4 = QChar::surrogateToUcs4(last, ucs4);
1692 last = ch;
1693 return convertCase_helper(ucs4, QUnicodeTables::CaseFold);
1694}
1695
1696static inline char16_t foldCase(char16_t ch) noexcept
1697{
1698 return convertCase_helper(ch, QUnicodeTables::CaseFold);
1699}
1700
1701static inline QChar foldCase(QChar ch) noexcept
1702{
1703 return QChar(foldCase(ch.unicode()));
1704}
1705
1706/*!
1707 \fn QChar QChar::toCaseFolded() const
1708
1709 Returns the case folded equivalent of the character.
1710 For most Unicode characters this is the same as toLower().
1711*/
1712
1713/*!
1714 \overload
1715 Returns the case folded equivalent of the UCS-4-encoded character specified
1716 by \a ucs4. For most Unicode characters this is the same as toLower().
1717
1718 \note Before Qt 6, this function took a \c uint argument and returned \c uint.
1719*/
1720char32_t QChar::toCaseFolded(char32_t ucs4) noexcept
1721{
1722 if (ucs4 > LastValidCodePoint)
1723 return ucs4;
1724 return convertCase_helper(ucs4, QUnicodeTables::CaseFold);
1725}
1726
1727/*!
1728 \fn char QChar::toLatin1() const
1729
1730 Returns the Latin-1 character equivalent to the QChar, or 0. This
1731 is mainly useful for non-internationalized software.
1732
1733 \note It is not possible to distinguish a non-Latin-1 character from a Latin-1 0
1734 (NUL) character. Prefer to use unicode(), which does not have this ambiguity.
1735
1736 \sa unicode()
1737*/
1738
1739/*!
1740 \fn QChar QChar::fromLatin1(char)
1741
1742 Converts the Latin-1 character \a c to its equivalent QChar. This
1743 is mainly useful for non-internationalized software.
1744
1745 An alternative is to use QLatin1Char.
1746
1747 \sa toLatin1(), unicode()
1748*/
1749
1750/*!
1751 \fn QChar::unicode()
1752
1753 Returns a reference to the numeric Unicode value of the QChar.
1754*/
1755
1756/*!
1757 \fn QChar::unicode() const
1758
1759 Returns the numeric Unicode value of the QChar.
1760*/
1761
1762/*****************************************************************************
1763 Documentation of QChar related functions
1764 *****************************************************************************/
1765
1766/*!
1767 \fn bool QChar::operator==(const QChar &c1, const QChar &c2)
1768
1769 Returns \c true if \a c1 and \a c2 are the same Unicode character;
1770 otherwise returns \c false.
1771*/
1772
1773/*!
1774 \fn bool QChar::operator!=(const QChar &c1, const QChar &c2)
1775
1776 Returns \c true if \a c1 and \a c2 are not the same Unicode
1777 character; otherwise returns \c false.
1778*/
1779
1780/*!
1781 \fn bool QChar::operator<=(const QChar &c1, const QChar &c2)
1782
1783 Returns \c true if the numeric Unicode value of \a c1 is less than
1784 or equal to that of \a c2; otherwise returns \c false.
1785*/
1786
1787/*!
1788 \fn bool QChar::operator>=(const QChar &c1, const QChar &c2)
1789
1790 Returns \c true if the numeric Unicode value of \a c1 is greater than
1791 or equal to that of \a c2; otherwise returns \c false.
1792*/
1793
1794/*!
1795 \fn bool QChar::operator<(const QChar &c1, const QChar &c2)
1796
1797 Returns \c true if the numeric Unicode value of \a c1 is less than
1798 that of \a c2; otherwise returns \c false.
1799*/
1800
1801/*!
1802 \fn bool QChar::operator>(const QChar &c1, const QChar &c2)
1803
1804 Returns \c true if the numeric Unicode value of \a c1 is greater than
1805 that of \a c2; otherwise returns \c false.
1806*/
1807
1808/*!
1809 \fn Qt::Literals::StringLiterals::operator""_L1(char ch)
1810
1811 \relates QLatin1Char
1812 \since 6.4
1813
1814 Literal operator that creates a QLatin1Char out of \a ch.
1815
1816 The following code creates a QLatin1Char:
1817 \code
1818 using namespace Qt::Literals::StringLiterals;
1819
1820 auto ch = 'a'_L1;
1821 \endcode
1822
1823 \sa Qt::Literals::StringLiterals
1824*/
1825
1826// ---------------------------------------------------------------------------
1827
1828
1829static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion version, qsizetype from)
1830{
1831 qsizetype length;
1832 QChar::Decomposition tag;
1833 QChar buffer[3];
1834
1835 QString &s = *str;
1836
1837 const unsigned short *utf16 = reinterpret_cast<unsigned short *>(s.data());
1838 const unsigned short *uc = utf16 + s.size();
1839 while (uc != utf16 + from) {
1840 char32_t ucs4 = *(--uc);
1841 if (QChar(ucs4).isLowSurrogate() && uc != utf16) {
1842 ushort high = *(uc - 1);
1843 if (QChar(high).isHighSurrogate()) {
1844 --uc;
1845 ucs4 = QChar::surrogateToUcs4(high, ucs4);
1846 }
1847 }
1848
1849 if (QChar::unicodeVersion(ucs4) > version)
1850 continue;
1851
1852 const QChar *d = decompositionHelper(ucs4, &length, &tag, buffer);
1853 if (!d || (canonical && tag != QChar::Canonical))
1854 continue;
1855
1856 qsizetype pos = uc - utf16;
1857 s.replace(pos, QChar::requiresSurrogates(ucs4) ? 2 : 1, d, length);
1858 // since the replace invalidates the pointers and we do decomposition recursive
1859 utf16 = reinterpret_cast<unsigned short *>(s.data());
1860 uc = utf16 + pos + length;
1861 }
1862}
1863
1864
1865struct UCS2Pair {
1866 ushort u1;
1867 ushort u2;
1868};
1869
1870inline bool operator<(const UCS2Pair &ligature1, const UCS2Pair &ligature2)
1871{ return ligature1.u1 < ligature2.u1; }
1872inline bool operator<(ushort u1, const UCS2Pair &ligature)
1873{ return u1 < ligature.u1; }
1874inline bool operator<(const UCS2Pair &ligature, ushort u1)
1875{ return ligature.u1 < u1; }
1876
1881
1882inline bool operator<(const UCS2SurrogatePair &ligature1, const UCS2SurrogatePair &ligature2)
1883{ return QChar::surrogateToUcs4(ligature1.p1.u1, ligature1.p1.u2) < QChar::surrogateToUcs4(ligature2.p1.u1, ligature2.p1.u2); }
1884inline bool operator<(char32_t u1, const UCS2SurrogatePair &ligature)
1885{ return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2); }
1886inline bool operator<(const UCS2SurrogatePair &ligature, char32_t u1)
1887{ return QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1; }
1888
1889static char32_t inline ligatureHelper(char32_t u1, char32_t u2)
1890{
1891 if (u1 >= Hangul_LBase && u1 < Hangul_SBase + Hangul_SCount) {
1892 // compute Hangul syllable composition as per UAX #15
1893 // hangul L-V pair
1894 const char32_t LIndex = u1 - Hangul_LBase;
1895 if (LIndex < Hangul_LCount) {
1896 const char32_t VIndex = u2 - Hangul_VBase;
1897 if (VIndex < Hangul_VCount)
1898 return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount;
1899 }
1900 // hangul LV-T pair
1901 const char32_t SIndex = u1 - Hangul_SBase;
1902 if (SIndex < Hangul_SCount && (SIndex % Hangul_TCount) == 0) {
1903 const char32_t TIndex = u2 - Hangul_TBase;
1904 if (TIndex < Hangul_TCount && TIndex)
1905 return u1 + TIndex;
1906 }
1907 }
1908
1909 const unsigned short index = GET_LIGATURE_INDEX(u2);
1910 if (index == 0xffff)
1911 return 0;
1912 const unsigned short *ligatures = uc_ligature_map+index;
1913 ushort length = *ligatures++;
1914 if (QChar::requiresSurrogates(u1)) {
1915 const UCS2SurrogatePair *data = reinterpret_cast<const UCS2SurrogatePair *>(ligatures);
1916 const UCS2SurrogatePair *r = std::lower_bound(data, data + length, u1);
1917 if (r != data + length && QChar::surrogateToUcs4(r->p1.u1, r->p1.u2) == u1)
1918 return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2);
1919 } else {
1920 const UCS2Pair *data = reinterpret_cast<const UCS2Pair *>(ligatures);
1921 const UCS2Pair *r = std::lower_bound(data, data + length, ushort(u1));
1922 if (r != data + length && r->u1 == ushort(u1))
1923 return r->u2;
1924 }
1925
1926 return 0;
1927}
1928
1929static void composeHelper(QString *str, QChar::UnicodeVersion version, qsizetype from)
1930{
1931 QString &s = *str;
1932
1933 if (from < 0 || s.size() - from < 2)
1934 return;
1935
1936 char32_t stcode = 0; // starter code point
1937 qsizetype starter = -1; // starter position
1938 qsizetype next = -1; // to prevent i == next
1939 int lastCombining = 255; // to prevent combining > lastCombining
1940
1941 qsizetype pos = from;
1942 while (pos < s.size()) {
1943 qsizetype i = pos;
1944 char32_t uc = s.at(pos).unicode();
1945 if (QChar(uc).isHighSurrogate() && pos < s.size()-1) {
1946 ushort low = s.at(pos+1).unicode();
1947 if (QChar(low).isLowSurrogate()) {
1948 uc = QChar::surrogateToUcs4(uc, low);
1949 ++pos;
1950 }
1951 }
1952
1953 const QUnicodeTables::Properties *p = qGetProp(uc);
1954 if (p->unicodeVersion > version) {
1955 starter = -1;
1956 next = -1; // to prevent i == next
1957 lastCombining = 255; // to prevent combining > lastCombining
1958 ++pos;
1959 continue;
1960 }
1961
1962 int combining = p->combiningClass;
1963 if ((i == next || combining > lastCombining) && starter >= from) {
1964 // allowed to form ligature with S
1965 char32_t ligature = ligatureHelper(stcode, uc);
1966 if (ligature) {
1967 stcode = ligature;
1968 QChar *d = s.data();
1969 // ligatureHelper() never changes planes
1970 qsizetype j = 0;
1971 for (QChar ch : QChar::fromUcs4(ligature))
1972 d[starter + j++] = ch;
1973 s.remove(i, j);
1974 continue;
1975 }
1976 }
1977 if (combining == 0) {
1978 starter = i;
1979 stcode = uc;
1980 next = pos + 1;
1981 }
1982 lastCombining = combining;
1983
1984 ++pos;
1985 }
1986}
1987
1988
1989static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, qsizetype from)
1990{
1991 QString &s = *str;
1992 const qsizetype l = s.size()-1;
1993
1994 char32_t u1, u2;
1995 char16_t c1, c2;
1996
1997 qsizetype pos = from;
1998 while (pos < l) {
1999 qsizetype p2 = pos+1;
2000 u1 = s.at(pos).unicode();
2001 if (QChar::isHighSurrogate(u1)) {
2002 const char16_t low = s.at(p2).unicode();
2003 if (QChar::isLowSurrogate(low)) {
2004 u1 = QChar::surrogateToUcs4(u1, low);
2005 if (p2 >= l)
2006 break;
2007 ++p2;
2008 }
2009 }
2010 c1 = 0;
2011
2012 advance:
2013 u2 = s.at(p2).unicode();
2014 if (QChar::isHighSurrogate(u2) && p2 < l) {
2015 const char16_t low = s.at(p2+1).unicode();
2016 if (QChar::isLowSurrogate(low)) {
2017 u2 = QChar::surrogateToUcs4(u2, low);
2018 ++p2;
2019 }
2020 }
2021
2022 c2 = 0;
2023 {
2024 const QUnicodeTables::Properties *p = qGetProp(u2);
2025 if (p->unicodeVersion <= version)
2026 c2 = p->combiningClass;
2027 }
2028 if (c2 == 0) {
2029 pos = p2+1;
2030 continue;
2031 }
2032
2033 if (c1 == 0) {
2034 const QUnicodeTables::Properties *p = qGetProp(u1);
2035 if (p->unicodeVersion <= version)
2036 c1 = p->combiningClass;
2037 }
2038
2039 if (c1 > c2) {
2040 QChar *uc = s.data();
2041 qsizetype p = pos;
2042 // exchange characters
2043 for (QChar ch : QChar::fromUcs4(u2))
2044 uc[p++] = ch;
2045 for (QChar ch : QChar::fromUcs4(u1))
2046 uc[p++] = ch;
2047 if (pos > 0)
2048 --pos;
2049 if (pos > 0 && s.at(pos).isLowSurrogate())
2050 --pos;
2051 } else {
2052 ++pos;
2053 if (QChar::requiresSurrogates(u1))
2054 ++pos;
2055
2056 u1 = u2;
2057 c1 = c2; // != 0
2058 p2 = pos + 1;
2059 if (QChar::requiresSurrogates(u1))
2060 ++p2;
2061 if (p2 > l)
2062 break;
2063
2064 goto advance;
2065 }
2066 }
2067}
2068
2069// returns true if the text is in a desired Normalization Form already; false otherwise.
2070// sets lastStable to the position of the last stable code point
2071static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationForm mode, qsizetype from, qsizetype *lastStable)
2072{
2073 static_assert(QString::NormalizationForm_D == 0);
2074 static_assert(QString::NormalizationForm_C == 1);
2075 static_assert(QString::NormalizationForm_KD == 2);
2076 static_assert(QString::NormalizationForm_KC == 3);
2077
2078 enum { NFQC_YES = 0, NFQC_NO = 1, NFQC_MAYBE = 3 };
2079
2080 const auto *string = reinterpret_cast<const char16_t *>(str->constData());
2081 qsizetype length = str->size();
2082
2083 // this avoids one out of bounds check in the loop
2084 while (length > from && QChar::isHighSurrogate(string[length - 1]))
2085 --length;
2086
2087 uchar lastCombining = 0;
2088 for (qsizetype i = from; i < length; ++i) {
2089 qsizetype pos = i;
2090 char32_t uc = string[i];
2091 if (uc < 0x80) {
2092 // ASCII characters are stable code points
2093 lastCombining = 0;
2094 *lastStable = pos;
2095 continue;
2096 }
2097
2098 if (QChar::isHighSurrogate(uc)) {
2099 ushort low = string[i + 1];
2100 if (!QChar::isLowSurrogate(low)) {
2101 // treat surrogate like stable code point
2102 lastCombining = 0;
2103 *lastStable = pos;
2104 continue;
2105 }
2106 ++i;
2107 uc = QChar::surrogateToUcs4(uc, low);
2108 }
2109
2110 const QUnicodeTables::Properties *p = qGetProp(uc);
2111
2112 if (p->combiningClass < lastCombining && p->combiningClass > 0)
2113 return false;
2114
2115 const uchar check = (p->nfQuickCheck >> (mode << 1)) & 0x03;
2116 if (check != NFQC_YES)
2117 return false; // ### can we quick check NFQC_MAYBE ?
2118
2119 lastCombining = p->combiningClass;
2120 if (lastCombining == 0)
2121 *lastStable = pos;
2122 }
2123
2124 if (length != str->size()) // low surrogate parts at the end of text
2125 *lastStable = str->size() - 1;
2126
2127 return true;
2128}
2129
2130QT_END_NAMESPACE
static constexpr unsigned short specialCaseMap[]
constexpr unsigned int MaxSpecialCaseLength
static constexpr unsigned short uc_ligature_map[]
bool operator<(const UCS2SurrogatePair &ligature, char32_t u1)
Definition qchar.cpp:1886
static constexpr quint32 Hangul_VCount
Definition qchar.cpp:1397
static constexpr char32_t Hangul_SBase
Definition qchar.cpp:1392
static constexpr char32_t Hangul_VBase
Definition qchar.cpp:1394
bool operator<(ushort u1, const UCS2Pair &ligature)
Definition qchar.cpp:1872
#define FLAG(x)
Definition qchar.cpp:13
static constexpr quint32 Hangul_LCount
Definition qchar.cpp:1396
static char32_t ligatureHelper(char32_t u1, char32_t u2)
Definition qchar.cpp:1889
bool operator<(const UCS2Pair &ligature, ushort u1)
Definition qchar.cpp:1874
static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, qsizetype from)
Definition qchar.cpp:1989
static constexpr char32_t Hangul_LBase
Definition qchar.cpp:1393
static constexpr char32_t Hangul_TBase
Definition qchar.cpp:1395
bool operator<(char32_t u1, const UCS2SurrogatePair &ligature)
Definition qchar.cpp:1884
static char32_t foldCase(char32_t ch, char32_t &last) noexcept
Definition qchar.cpp:1687
bool operator<(const UCS2SurrogatePair &ligature1, const UCS2SurrogatePair &ligature2)
Definition qchar.cpp:1882
bool operator<(const UCS2Pair &ligature1, const UCS2Pair &ligature2)
Definition qchar.cpp:1870
static auto fullConvertCase(char32_t uc, QUnicodeTables::Case which) noexcept
Definition qchar.cpp:1555
static constexpr quint32 Hangul_NCount
Definition qchar.cpp:1399
static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion version, qsizetype from)
Definition qchar.cpp:1829
static void composeHelper(QString *str, QChar::UnicodeVersion version, qsizetype from)
Definition qchar.cpp:1929
static constexpr quint32 Hangul_SCount
Definition qchar.cpp:1400
static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationForm mode, qsizetype from, qsizetype *lastStable)
Definition qchar.cpp:2071
static QChar foldCase(QChar ch) noexcept
Definition qchar.cpp:1701
static constexpr quint32 Hangul_TCount
Definition qchar.cpp:1398
static char16_t foldCase(char16_t ch) noexcept
Definition qchar.cpp:1696
static char32_t foldCase(const char16_t *ch, const char16_t *start)
Definition qchar.cpp:1679
uint QT_FASTCALL fetch1Pixel< QPixelLayout::BPP1LSB >(const uchar *src, int index)
#define GET_LIGATURE_INDEX(ucs4)
#define GET_DECOMPOSITION_INDEX(ucs4)
#define UNICODE_DATA_VERSION
ushort u1
Definition qchar.cpp:1866
ushort u2
Definition qchar.cpp:1867