Qt 6.x
The Qt SDK
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
qchar.cpp File Reference
#include "qchar.h"
#include "qdatastream.h"
#include "qunicodetables_p.h"
#include "qunicodetables.cpp"
#include <algorithm>
+ Include dependency graph for qchar.cpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  UCS2Pair
 
struct  UCS2SurrogatePair
 

Macros

#define FLAG(x)   (1 << (x))
 

Functions

static const QChar *QT_FASTCALL decompositionHelper (char32_t ucs4, qsizetype *length, QChar::Decomposition *tag, QChar *buffer)
 
static auto fullConvertCase (char32_t uc, QUnicodeTables::Case which) noexcept
 
template<typename T >
static Q_DECL_CONST_FUNCTIONconvertCase_helper (T uc, QUnicodeTables::Case which) noexcept
 
static char32_t foldCase (const char16_t *ch, const char16_t *start)
 
static char32_t foldCase (char32_t ch, char32_t &last) noexcept
 
static char16_t foldCase (char16_t ch) noexcept
 
static QChar foldCase (QChar ch) noexcept
 
static void decomposeHelper (QString *str, bool canonical, QChar::UnicodeVersion version, qsizetype from)
 
bool operator< (const UCS2Pair &ligature1, const UCS2Pair &ligature2)
 
bool operator< (ushort u1, const UCS2Pair &ligature)
 
bool operator< (const UCS2Pair &ligature, ushort u1)
 
bool operator< (const UCS2SurrogatePair &ligature1, const UCS2SurrogatePair &ligature2)
 
bool operator< (char32_t u1, const UCS2SurrogatePair &ligature)
 
bool operator< (const UCS2SurrogatePair &ligature, char32_t u1)
 
static char32_t ligatureHelper (char32_t u1, char32_t u2)
 
static void composeHelper (QString *str, QChar::UnicodeVersion version, qsizetype from)
 
static void canonicalOrderHelper (QString *str, QChar::UnicodeVersion version, qsizetype from)
 
static bool normalizationQuickCheckHelper (QString *str, QString::NormalizationForm mode, qsizetype from, qsizetype *lastStable)
 

Variables

static constexpr char32_t Hangul_SBase = 0xac00
 
static constexpr char32_t Hangul_LBase = 0x1100
 
static constexpr char32_t Hangul_VBase = 0x1161
 
static constexpr char32_t Hangul_TBase = 0x11a7
 
static constexpr quint32 Hangul_LCount = 19
 
static constexpr quint32 Hangul_VCount = 21
 
static constexpr quint32 Hangul_TCount = 28
 
static constexpr quint32 Hangul_NCount = Hangul_VCount * Hangul_TCount
 
static constexpr quint32 Hangul_SCount = Hangul_LCount * Hangul_NCount
 

Macro Definition Documentation

◆ FLAG

#define FLAG (   x)    (1 << (x))

Definition at line 23 of file qchar.cpp.

Function Documentation

◆ canonicalOrderHelper()

static void canonicalOrderHelper ( QString str,
QChar::UnicodeVersion  version,
qsizetype  from 
)
static

Definition at line 1972 of file qchar.cpp.

References c2, ch, QChar::fromUcs4(), QChar::isHighSurrogate(), QChar::isLowSurrogate(), p2, pos, QUnicodeTables::qGetProp(), QChar::requiresSurrogates(), QString::size(), str, and QChar::surrogateToUcs4().

Referenced by qt_string_normalize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ composeHelper()

static void composeHelper ( QString str,
QChar::UnicodeVersion  version,
qsizetype  from 
)
static

Definition at line 1912 of file qchar.cpp.

References ch, d, QChar::fromUcs4(), i, j, ligatureHelper(), next, pos, QUnicodeTables::qGetProp(), str, and QChar::surrogateToUcs4().

Referenced by qt_string_normalize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ convertCase_helper()

template<typename T >
static Q_DECL_CONST_FUNCTION T convertCase_helper ( uc,
QUnicodeTables::Case  which 
)
inlinestaticnoexcept

Definition at line 1553 of file qchar.cpp.

References QUnicodeTables::Properties::cases, Q_UNLIKELY, QUnicodeTables::qGetProp(), and QUnicodeTables::specialCaseMap.

Referenced by foldCase(), foldCase(), foldCase(), QChar::toCaseFolded(), QChar::toLower(), QChar::toTitleCase(), and QChar::toUpper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ decomposeHelper()

static void decomposeHelper ( QString str,
bool  canonical,
QChar::UnicodeVersion  version,
qsizetype  from 
)
static

Definition at line 1812 of file qchar.cpp.

References QChar::Canonical, d, decompositionHelper(), QChar::isHighSurrogate(), QChar::isLowSurrogate(), pos, QChar::requiresSurrogates(), QString::size(), str, QChar::surrogateToUcs4(), tag, and QChar::unicodeVersion().

Referenced by qt_string_normalize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ decompositionHelper()

static const QChar *QT_FASTCALL decompositionHelper ( char32_t  ucs4,
qsizetype length,
QChar::Decomposition tag,
QChar buffer 
)
static

Definition at line 1366 of file qchar.cpp.

References QChar::Canonical, GET_DECOMPOSITION_INDEX, Hangul_LBase, Hangul_NCount, Hangul_SBase, Hangul_SCount, Hangul_TBase, Hangul_TCount, Hangul_VBase, QChar::NoDecomposition, tag, and QUnicodeTables::uc_decomposition_map.

Referenced by decomposeHelper(), and QChar::decomposition().

+ Here is the caller graph for this function:

◆ foldCase() [1/4]

static char16_t foldCase ( char16_t  ch)
inlinestaticnoexcept

Definition at line 1649 of file qchar.cpp.

References QUnicodeTables::CaseFold, ch, and convertCase_helper().

+ Here is the call graph for this function:

◆ foldCase() [2/4]

static char32_t foldCase ( char32_t  ch,
char32_t &  last 
)
inlinestaticnoexcept

Definition at line 1640 of file qchar.cpp.

References QUnicodeTables::CaseFold, ch, convertCase_helper(), QChar::isHighSurrogate(), QChar::isLowSurrogate(), and QChar::surrogateToUcs4().

+ Here is the call graph for this function:

◆ foldCase() [3/4]

static char32_t foldCase ( const char16_t *  ch,
const char16_t *  start 
)
inlinestatic

Definition at line 1632 of file qchar.cpp.

References QUnicodeTables::CaseFold, ch, convertCase_helper(), QChar::isHighSurrogate(), QChar::isLowSurrogate(), and QChar::surrogateToUcs4().

Referenced by bm_find(), bm_init_skiptable(), QtPrivate::count(), QString::endsWith(), QtPrivate::findString(), foldCase(), QString::replace(), QString::startsWith(), ucstricmp(), and ucstricmp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ foldCase() [4/4]

static QChar foldCase ( QChar  ch)
inlinestaticnoexcept

Definition at line 1654 of file qchar.cpp.

References ch, and foldCase().

+ Here is the call graph for this function:

◆ fullConvertCase()

static auto fullConvertCase ( char32_t  uc,
QUnicodeTables::Case  which 
)
staticnoexcept

Definition at line 1518 of file qchar.cpp.

References begin(), QUnicodeTables::Properties::cases, QUnicodeTables::Properties::diff, QChar::fromUcs4(), QChar::LastValidCodePoint, QUnicodeTables::MaxSpecialCaseLength, Q_ASSERT, Q_UNLIKELY, QUnicodeTables::qGetProp(), qint8, R, and QUnicodeTables::specialCaseMap.

Referenced by QUnicodeTables::detachAndConvertCase().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ligatureHelper()

static char32_t ligatureHelper ( char32_t  u1,
char32_t  u2 
)
inlinestatic

Definition at line 1872 of file qchar.cpp.

References GET_LIGATURE_INDEX, Hangul_LBase, Hangul_LCount, Hangul_SBase, Hangul_SCount, Hangul_TBase, Hangul_TCount, Hangul_VBase, Hangul_VCount, QChar::requiresSurrogates(), QChar::surrogateToUcs4(), and QUnicodeTables::uc_ligature_map.

Referenced by composeHelper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalizationQuickCheckHelper()

static bool normalizationQuickCheckHelper ( QString str,
QString::NormalizationForm  mode,
qsizetype  from,
qsizetype lastStable 
)
static

Definition at line 2054 of file qchar.cpp.

References QString::constData(), i, QChar::isHighSurrogate(), QChar::isLowSurrogate(), QString::NormalizationForm_C, QString::NormalizationForm_D, QString::NormalizationForm_KC, QString::NormalizationForm_KD, pos, QUnicodeTables::qGetProp(), QString::size(), str, and QChar::surrogateToUcs4().

Referenced by qt_string_normalize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator<() [1/6]

bool operator< ( char32_t  u1,
const UCS2SurrogatePair ligature 
)
inline

Definition at line 1867 of file qchar.cpp.

References UCS2SurrogatePair::p1, QChar::surrogateToUcs4(), UCS2Pair::u1, and UCS2Pair::u2.

+ Here is the call graph for this function:

◆ operator<() [2/6]

bool operator< ( const UCS2Pair ligature,
ushort  u1 
)
inline

Definition at line 1857 of file qchar.cpp.

References UCS2Pair::u1.

◆ operator<() [3/6]

bool operator< ( const UCS2Pair ligature1,
const UCS2Pair ligature2 
)
inline

Definition at line 1853 of file qchar.cpp.

References UCS2Pair::u1.

◆ operator<() [4/6]

bool operator< ( const UCS2SurrogatePair ligature,
char32_t  u1 
)
inline

Definition at line 1869 of file qchar.cpp.

References UCS2SurrogatePair::p1, QChar::surrogateToUcs4(), UCS2Pair::u1, and UCS2Pair::u2.

+ Here is the call graph for this function:

◆ operator<() [5/6]

bool operator< ( const UCS2SurrogatePair ligature1,
const UCS2SurrogatePair ligature2 
)
inline

Definition at line 1865 of file qchar.cpp.

References UCS2SurrogatePair::p1, QChar::surrogateToUcs4(), UCS2Pair::u1, and UCS2Pair::u2.

+ Here is the call graph for this function:

◆ operator<() [6/6]

bool operator< ( ushort  u1,
const UCS2Pair ligature 
)
inline

Definition at line 1855 of file qchar.cpp.

References UCS2Pair::u1.

Variable Documentation

◆ Hangul_LBase

constexpr char32_t Hangul_LBase = 0x1100
staticconstexpr

Definition at line 1356 of file qchar.cpp.

Referenced by decompositionHelper(), and ligatureHelper().

◆ Hangul_LCount

constexpr quint32 Hangul_LCount = 19
staticconstexpr

Definition at line 1359 of file qchar.cpp.

Referenced by ligatureHelper().

◆ Hangul_NCount

constexpr quint32 Hangul_NCount = Hangul_VCount * Hangul_TCount
staticconstexpr

Definition at line 1362 of file qchar.cpp.

Referenced by decompositionHelper().

◆ Hangul_SBase

constexpr char32_t Hangul_SBase = 0xac00
staticconstexpr

Definition at line 1355 of file qchar.cpp.

Referenced by decompositionHelper(), QChar::decompositionTag(), and ligatureHelper().

◆ Hangul_SCount

constexpr quint32 Hangul_SCount = Hangul_LCount * Hangul_NCount
staticconstexpr

Definition at line 1363 of file qchar.cpp.

Referenced by decompositionHelper(), QChar::decompositionTag(), and ligatureHelper().

◆ Hangul_TBase

constexpr char32_t Hangul_TBase = 0x11a7
staticconstexpr

Definition at line 1358 of file qchar.cpp.

Referenced by decompositionHelper(), and ligatureHelper().

◆ Hangul_TCount

constexpr quint32 Hangul_TCount = 28
staticconstexpr

Definition at line 1361 of file qchar.cpp.

Referenced by decompositionHelper(), and ligatureHelper().

◆ Hangul_VBase

constexpr char32_t Hangul_VBase = 0x1161
staticconstexpr

Definition at line 1357 of file qchar.cpp.

Referenced by decompositionHelper(), and ligatureHelper().

◆ Hangul_VCount

constexpr quint32 Hangul_VCount = 21
staticconstexpr

Definition at line 1360 of file qchar.cpp.

Referenced by ligatureHelper().