7#include <QtCore/qglobal.h>
20 constexpr inline char toLatin1() const noexcept {
return ch; }
21 constexpr inline char16_t unicode() const noexcept {
return char16_t(
uchar(ch)); }
34 friend constexpr inline bool operator< (
char lhs,
QLatin1Char rhs)
noexcept {
return lhs < rhs.toLatin1(); }
35 friend constexpr inline bool operator> (
char lhs,
QLatin1Char rhs)
noexcept {
return lhs > rhs.toLatin1(); }
41 friend constexpr inline bool operator< (
QLatin1Char lhs,
char rhs)
noexcept {
return lhs.toLatin1() < rhs; }
42 friend constexpr inline bool operator> (
QLatin1Char lhs,
char rhs)
noexcept {
return lhs.toLatin1() > rhs; }
55 CarriageReturn = 0x000d,
59 ReplacementCharacter = 0xfffd,
60 ObjectReplacementCharacter = 0xfffc,
61 ByteOrderMark = 0xfeff,
62 ByteOrderSwapped = 0xfffe,
63 ParagraphSeparator = 0x2029,
64 LineSeparator = 0x2028,
65 VisualTabCharacter = 0x2192,
66 LastValidCodePoint = 0x10ffff
69#ifdef QT_IMPLICIT_QCHAR_CONSTRUCTION
70#define QCHAR_MAYBE_IMPLICIT Q_IMPLICIT
72#define QCHAR_MAYBE_IMPLICIT explicit
84#if defined(Q_OS_WIN) || defined(Q_QDOC)
88#ifndef QT_NO_CAST_FROM_ASCII
91#ifndef QT_RESTRICTED_CAST_FROM_ASCII
96#undef QCHAR_MAYBE_IMPLICIT
99 static constexpr inline auto fromUcs4(
char32_t c)
noexcept;
346 DirL, DirR, DirEN, DirES, DirET,
DirAN, DirCS, DirB, DirS, DirWS, DirON,
347 DirLRE, DirLRO,
DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN,
384 Combining_BelowLeftAttached = 200,
385 Combining_BelowAttached = 202,
386 Combining_BelowRightAttached = 204,
387 Combining_LeftAttached = 208,
388 Combining_RightAttached = 210,
389 Combining_AboveLeftAttached = 212,
390 Combining_AboveAttached = 214,
391 Combining_AboveRightAttached = 216,
393 Combining_BelowLeft = 218,
394 Combining_Below = 220,
395 Combining_BelowRight = 222,
396 Combining_Left = 224,
397 Combining_Right = 226,
398 Combining_AboveLeft = 228,
399 Combining_Above = 230,
400 Combining_AboveRight = 232,
402 Combining_DoubleBelow = 233,
403 Combining_DoubleAbove = 234,
404 Combining_IotaSubscript = 240
457 constexpr inline char toLatin1() const noexcept {
return ucs > 0xff ?
'\0' : char(ucs); }
458 constexpr inline char16_t unicode() const noexcept {
return ucs; }
459 constexpr inline char16_t &
unicode() noexcept {
return ucs; }
463 constexpr inline bool isNull() const noexcept {
return ucs == 0; }
484 constexpr inline uchar row() const noexcept {
return uchar((ucs>>8)&0xff); }
485 constexpr inline void setCell(
uchar acell)
noexcept { ucs = char16_t((ucs & 0xff00) + acell); }
486 constexpr inline void setRow(
uchar arow)
noexcept { ucs = char16_t((
char16_t(arow)<<8) + (ucs&0xff)); }
490 return ucs4 >= 0xfdd0 && (ucs4 <= 0xfdef || (ucs4 & 0xfffe) == 0xfffe);
494 return (ucs4 & 0xfffffc00) == 0xd800;
498 return (ucs4 & 0xfffffc00) == 0xdc00;
502 return (ucs4 - 0xd800u < 2048u);
506 return (ucs4 >= 0x10000);
508 static constexpr inline char32_t surrogateToUcs4(
char16_t high,
char16_t low)
noexcept
512 return (
char32_t(high)<<10) + low - 0x35fdc00;
516 return surrogateToUcs4(high.ucs, low.ucs);
520 return char16_t((ucs4>>10) + 0xd7c0);
524 return char16_t(ucs4%0x400 + 0xdc00);
554 return ucs4 == 0x20 || (ucs4 <= 0x0d && ucs4 >= 0x09)
555 || (ucs4 > 127 && (ucs4 == 0x85 || ucs4 == 0xa0 || QChar::isSpace_helper(ucs4)));
562 return (ucs4 >=
'A' && ucs4 <=
'z' && (ucs4 >=
'a' || ucs4 <=
'Z'))
563 || (ucs4 > 127 && QChar::isLetter_helper(ucs4));
566 {
return (ucs4 <=
'9' && ucs4 >=
'0') || (ucs4 > 127 && QChar::isNumber_helper(ucs4)); }
569 return (ucs4 >=
'A' && ucs4 <=
'z' && (ucs4 >=
'a' || ucs4 <=
'Z'))
570 || (ucs4 >=
'0' && ucs4 <=
'9')
571 || (ucs4 > 127 && QChar::isLetterOrNumber_helper(ucs4));
574 {
return (ucs4 <=
'9' && ucs4 >=
'0') || (ucs4 > 127 &&
QChar::category(ucs4) == Number_DecimalDigit); }
576 {
return (ucs4 <=
'z' && ucs4 >=
'a') || (ucs4 > 127 &&
QChar::category(ucs4) == Letter_Lowercase); }
578 {
return (ucs4 <=
'Z' && ucs4 >=
'A') || (ucs4 > 127 &&
QChar::category(ucs4) == Letter_Uppercase); }
590 friend constexpr inline bool operator==(
QChar lhs, std::nullptr_t)
noexcept {
return lhs.isNull(); }
591 friend constexpr inline bool operator< (
QChar, std::nullptr_t)
noexcept {
return false; }
592 friend constexpr inline bool operator==(std::nullptr_t,
QChar rhs)
noexcept {
return rhs.isNull(); }
593 friend constexpr inline bool operator< (std::nullptr_t,
QChar rhs)
noexcept {
return !rhs.isNull(); }
611#ifdef QT_NO_CAST_FROM_ASCII
621#ifndef QT_NO_DATASTREAM
627inline namespace Literals {
628inline namespace StringLiterals {
645 template <
typename =
void>
647 noexcept(
noexcept(std::hash<char16_t>{}(u
' ')))
649 return std::hash<char16_t>{}(
c.unicode());
656#include <QtCore/qstringview.h>
static constexpr bool isLowSurrogate(char32_t ucs4) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr bool isNonCharacter() const noexcept
constexpr bool isLetterOrNumber() const noexcept
Returns true if the character is a letter or number (Letter_* or Number_* categories); otherwise retu...
friend constexpr bool operator!=(QChar lhs, std::nullptr_t) noexcept
friend constexpr bool operator<=(QChar lhs, std::nullptr_t) noexcept
static constexpr QChar fromUcs2(char16_t c) noexcept
static constexpr char32_t surrogateToUcs4(char16_t high, char16_t low) noexcept
Converts a UTF16 surrogate pair with the given high and low values to it's UCS-4-encoded code point.
SpecialCharacter
\value Null A QChar with this value isNull().
constexpr Q_IMPLICIT QChar() noexcept
Constructs a null QChar ('\0').
static constexpr bool requiresSurrogates(char32_t ucs4) noexcept
Returns true if the UCS-4-encoded character specified by ucs4 can be split into the high and low part...
constexpr bool isDigit() const noexcept
Returns true if the character is a decimal digit (Number_DecimalDigit); otherwise returns false.
constexpr void setCell(uchar acell) noexcept
Decomposition
This enum type defines the Unicode decomposition attributes.
Script script() const noexcept
friend constexpr bool operator==(QChar c1, QChar c2) noexcept
Returns true if c1 and c2 are the same Unicode character; otherwise returns false.
static constexpr bool isSurrogate(char32_t ucs4) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
QChar toLower() const noexcept
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
constexpr QCHAR_MAYBE_IMPLICIT QChar(uint rc) noexcept
Constructs a QChar for the character with Unicode code point code.
constexpr Q_IMPLICIT QChar(char16_t ch) noexcept
friend constexpr bool operator<=(std::nullptr_t, QChar rhs) noexcept
static constexpr bool isUpper(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
This is an overloaded member function, provided for convenience. It differs from the above function o...
int digitValue() const noexcept
Returns the numeric value of the digit, or -1 if the character is not a digit.
QT_ASCII_CAST_WARN constexpr Q_IMPLICIT QChar(char c) noexcept
Constructs a QChar corresponding to ASCII/Latin-1 character ch.
constexpr Q_IMPLICIT QChar(short rc) noexcept
Constructs a QChar for the character with Unicode code point code.
friend constexpr bool operator==(QChar lhs, std::nullptr_t) noexcept
friend constexpr bool operator<=(QChar c1, QChar c2) noexcept
Returns true if the numeric Unicode value of c1 is less than or equal to that of c2; otherwise return...
static constexpr bool isLetterOrNumber(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr char16_t & unicode() noexcept
Returns a reference to the numeric Unicode value of the QChar.
Direction direction() const noexcept
Returns the character's direction.
friend constexpr bool operator>=(std::nullptr_t, QChar rhs) noexcept
bool hasMirrored() const noexcept
Returns true if the character should be reversed if the text direction is reversed; otherwise returns...
friend constexpr bool operator!=(std::nullptr_t, QChar rhs) noexcept
constexpr char toLatin1() const noexcept
Returns the Latin-1 character equivalent to the QChar, or 0.
Direction
This enum type defines the Unicode direction attributes.
QChar mirroredChar() const noexcept
Returns the mirrored character if this character is a mirrored character; otherwise returns the chara...
static constexpr bool isLetter(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr void setRow(uchar arow) noexcept
UnicodeVersion
Specifies which version of the \l{Unicode standard} introduced a certain character.
static constexpr char16_t highSurrogate(char32_t ucs4) noexcept
Returns the high surrogate part of a UCS-4-encoded code point.
constexpr uchar row() const noexcept
Returns the row (most significant byte) of the Unicode character.
Category
This enum maps the Unicode character categories.
@ Punctuation_InitialQuote
friend constexpr bool operator==(std::nullptr_t, QChar rhs) noexcept
static constexpr char32_t surrogateToUcs4(QChar high, QChar low) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr bool isLowSurrogate() const noexcept
Returns true if the QChar is the low part of a UTF16 surrogate (for example if its code point is in r...
constexpr bool isSurrogate() const noexcept
constexpr char16_t unicode() const noexcept
Returns the numeric Unicode value of the QChar.
constexpr uchar cell() const noexcept
Returns the cell (least significant byte) of the Unicode character.
static constexpr bool isNonCharacter(char32_t ucs4) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
QChar toCaseFolded() const noexcept
Returns the case folded equivalent of the character.
constexpr bool isLower() const noexcept
Returns true if the character is a lowercase letter, for example category() is Letter_Lowercase.
bool isPrint() const noexcept
Returns true if the character is a printable character; otherwise returns false.
static constexpr char16_t lowSurrogate(char32_t ucs4) noexcept
Returns the low surrogate part of a UCS-4-encoded code point.
static constexpr bool isDigit(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
This is an overloaded member function, provided for convenience. It differs from the above function o...
QT_ASCII_CAST_WARN constexpr QCHAR_MAYBE_IMPLICIT QChar(uchar c) noexcept
Constructs a QChar corresponding to ASCII/Latin-1 character ch.
friend constexpr bool operator>=(QChar lhs, std::nullptr_t) noexcept
constexpr Q_IMPLICIT QChar(QLatin1Char ch) noexcept
Constructs a QChar corresponding to ASCII/Latin-1 character ch.
constexpr QCHAR_MAYBE_IMPLICIT QChar(uchar c, uchar r) noexcept
Constructs a QChar for Unicode cell cell in row row.
Category category() const noexcept
Returns the character's category.
@ Script_EgyptianHieroglyphs
@ Script_InscriptionalParthian
@ Script_InscriptionalPahlavi
@ Script_AnatolianHieroglyphs
@ Script_CaucasianAlbanian
@ Script_KhitanSmallScript
@ Script_CanadianAboriginal
@ Script_MeroiticHieroglyphs
@ Script_NyiakengPuachueHmong
constexpr bool isUpper() const noexcept
Returns true if the character is an uppercase letter, for example category() is Letter_Uppercase.
unsigned char combiningClass() const noexcept
Returns the combining class for the character as defined in the Unicode standard.
static constexpr bool isNumber(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr Q_IMPLICIT QChar(SpecialCharacter s) noexcept
Constructs a QChar for the predefined character value ch.
static constexpr QChar fromLatin1(char c) noexcept
Converts the Latin-1 character c to its equivalent QChar.
Decomposition decompositionTag() const noexcept
Returns the tag defining the composition of the character.
constexpr bool isNull() const noexcept
Returns true if the character is the Unicode character 0x0000 ('\0'); otherwise returns false.
QChar toTitleCase() const noexcept
Returns the title case equivalent if the character is lowercase or uppercase; otherwise returns the c...
QChar toUpper() const noexcept
Returns the uppercase equivalent if the character is lowercase or titlecase; otherwise returns the ch...
static constexpr bool isTitleCase(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
This is an overloaded member function, provided for convenience. It differs from the above function o...
JoiningType joiningType() const noexcept
constexpr Q_IMPLICIT QChar(ushort rc) noexcept
Constructs a QChar for the character with Unicode code point code.
constexpr bool isLetter() const noexcept
Returns true if the character is a letter (Letter_* categories); otherwise returns false.
static constexpr bool isLower(char32_t ucs4) noexcept Q_DECL_CONST_FUNCTION
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr bool operator>=(QChar c1, QChar c2) noexcept
Returns true if the numeric Unicode value of c1 is greater than or equal to that of c2; otherwise ret...
bool isPunct() const noexcept
Returns true if the character is a punctuation mark (Punctuation_* categories); otherwise returns fal...
constexpr bool isSpace() const noexcept
Returns true if the character is a separator character (Separator_* categories or certain code points...
constexpr QCHAR_MAYBE_IMPLICIT QChar(int rc) noexcept
Constructs a QChar for the character with Unicode code point code.
UnicodeVersion unicodeVersion() const noexcept
Returns the Unicode version that introduced this character.
constexpr bool isHighSurrogate() const noexcept
Returns true if the QChar is the high part of a UTF16 surrogate (for example if its code point is in ...
bool isSymbol() const noexcept
Returns true if the character is a symbol (Symbol_* categories); otherwise returns false.
friend constexpr bool operator!=(QChar c1, QChar c2) noexcept
Returns true if c1 and c2 are not the same Unicode character; otherwise returns false.
constexpr bool isNumber() const noexcept
Returns true if the character is a number (Number_* categories, not just 0-9); otherwise returns fals...
bool isMark() const noexcept
Returns true if the character is a mark (Mark_* categories); otherwise returns false.
constexpr bool isTitleCase() const noexcept
Returns true if the character is a titlecase letter, for example category() is Letter_Titlecase.
static constexpr bool isHighSurrogate(char32_t ucs4) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore\reentrant
\macro QT_RESTRICTED_CAST_FROM_ASCII
const QLoggingCategory & category()
[1]
QHash< int, QWidget * > hash
[35multi]
Combined button and popup list for selecting options.
#define QCHAR_MAYBE_IMPLICIT
Q_CORE_EXPORT QDataStream & operator<<(QDataStream &, QChar)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QChar &)
#define Q_DECL_CONST_FUNCTION
bool operator>(const QPoint &a, const QPoint &b)
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
#define QT_ASCII_CAST_WARN
#define Q_DECLARE_TYPEINFO(TYPE, FLAGS)
QT_END_NAMESPACE typedef QT_PREPEND_NAMESPACE(quintptr) WId
\inmodule QtCore \reentrant
friend constexpr bool operator!=(char lhs, QLatin1Char rhs) noexcept
constexpr QLatin1Char(char c) noexcept
Constructs a Latin-1 character for c.
friend constexpr bool operator!=(QLatin1Char lhs, char rhs) noexcept
friend constexpr bool operator>=(QLatin1Char lhs, char rhs) noexcept
friend constexpr bool operator==(char lhs, QLatin1Char rhs) noexcept
friend constexpr bool operator<=(QLatin1Char lhs, char rhs) noexcept
friend constexpr bool operator<(QLatin1Char lhs, QLatin1Char rhs) noexcept
friend constexpr bool operator==(QLatin1Char lhs, char rhs) noexcept
constexpr char toLatin1() const noexcept
Converts a Latin-1 character to an 8-bit ASCII representation of the character.
friend constexpr bool operator>=(char lhs, QLatin1Char rhs) noexcept
friend constexpr bool operator!=(QLatin1Char lhs, QLatin1Char rhs) noexcept
friend constexpr bool operator==(QLatin1Char lhs, QLatin1Char rhs) noexcept
friend constexpr bool operator>=(QLatin1Char lhs, QLatin1Char rhs) noexcept
friend constexpr bool operator<=(QLatin1Char lhs, QLatin1Char rhs) noexcept
friend constexpr bool operator<=(char lhs, QLatin1Char rhs) noexcept
constexpr char16_t unicode() const noexcept
Converts a Latin-1 character to an 16-bit-encoded Unicode representation of the character.
friend constexpr bool operator>(QLatin1Char lhs, QLatin1Char rhs) noexcept
constexpr size_t operator()(QT_PREPEND_NAMESPACE(QChar) c) const noexcept(noexcept(std::hash< char16_t >{}(u' ')))