⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qchar.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 3 页
字号:
{    if(ucs >= 9 && ucs <=13)        return true;    const int test = FLAG(Separator_Space) |                     FLAG(Separator_Line) |                     FLAG(Separator_Paragraph);    return FLAG(qGetProp(ucs)->category) & test;}/*!    Returns true if the character is a mark (Mark_* categories);    otherwise returns false.*/bool QChar::isMark() const{    const int test = FLAG(Mark_NonSpacing) |                     FLAG(Mark_SpacingCombining) |                     FLAG(Mark_Enclosing);    return FLAG(qGetProp(ucs)->category) & test;}/*!    Returns true if the character is a punctuation mark (Punctuation_*    categories); otherwise returns false.*/bool QChar::isPunct() const{    const int test = FLAG(Punctuation_Connector) |                     FLAG(Punctuation_Dash) |                     FLAG(Punctuation_Open) |                     FLAG(Punctuation_Close) |                     FLAG(Punctuation_InitialQuote) |                     FLAG(Punctuation_FinalQuote) |                     FLAG(Punctuation_Other);    return FLAG(qGetProp(ucs)->category) & test;}/*!    Returns true if the character is a letter (Letter_* categories);    otherwise returns false.*/bool QChar::isLetter() const{    const int test = FLAG(Letter_Uppercase) |                     FLAG(Letter_Lowercase) |                     FLAG(Letter_Titlecase) |                     FLAG(Letter_Modifier) |                     FLAG(Letter_Other);    return FLAG(qGetProp(ucs)->category) & test;}/*!    Returns true if the character is a number (Number_* categories,    not just 0-9); otherwise returns false.    \sa isDigit()*/bool QChar::isNumber() const{    const int test = FLAG(Number_DecimalDigit) |                     FLAG(Number_Letter) |                     FLAG(Number_Other);    return FLAG(qGetProp(ucs)->category) & test;}/*!    Returns true if the character is a letter or number (Letter_* or    Number_* categories); otherwise returns false.*/bool QChar::isLetterOrNumber() const{    const int test = FLAG(Letter_Uppercase) |                     FLAG(Letter_Lowercase) |                     FLAG(Letter_Titlecase) |                     FLAG(Letter_Modifier) |                     FLAG(Letter_Other) |                     FLAG(Number_DecimalDigit) |                     FLAG(Number_Letter) |                     FLAG(Number_Other);    return FLAG(qGetProp(ucs)->category) & test;}/*!    Returns true if the character is a decimal digit    (Number_DecimalDigit); otherwise returns false.*/bool QChar::isDigit() const{    return (qGetProp(ucs)->category == Number_DecimalDigit);}/*!    Returns true if the character is a symbol (Symbol_* categories);    otherwise returns false.*/bool QChar::isSymbol() const{    const int test = FLAG(Symbol_Math) |                     FLAG(Symbol_Currency) |                     FLAG(Symbol_Modifier) |                     FLAG(Symbol_Other);    return FLAG(qGetProp(ucs)->category) & test;}/*!  \fn bool QChar::isHighSurrogate() const  Returns true if the QChar is the high part of a utf16 surrogate  (ie. if it's code point is between 0xd800 and 0xdbff).*//*!  \fn bool QChar::isLowSurrogate() const  Returns true if the QChar is the low part of a utf16 surrogate  (ie. if it's code point is between 0xdc00 and 0xdfff).*//*!  \fn static uint QChar::surrogateToUcs4(ushort high, ushort low)  Converts a utf16 surrogate pair (\a high, \a low) to it's ucs4  code point.*//*!  \fn static uint QChar::surrogateToUcs4(QChar high, QChar low)  Converts a utf16 surrogate pair (\a high, \a low) to it's ucs4 code  point.*//*!  \fn static ushort QChar::highSurrogate(uint ucs4)  Returns the high surrogate value of a ucs4 code point.  The returned result is undefined if \a ucs4 is smaller than 0x10000.*//*!  \fn static ushort QChar::lowSurrogate(uint ucs4)  Returns the low surrogate value of a ucs4 code point.  The returned result is undefined if \a ucs4 is smaller than 0x10000.*//*!    Returns the numeric value of the digit, or -1 if the character is    not a digit.*/int QChar::digitValue() const{    return qGetProp(ucs)->digitValue;}/*!    \overload    Returns the numeric value of the digit, specified by the UCS-2-encoded    character, \a ucs2, or -1 if the character is not a digit.*/int QChar::digitValue(ushort ucs2){    return qGetProp(ucs2)->digitValue;}/*!    \overload    Returns the numeric value of the digit specified by the UCS-4-encoded    character, \a ucs4, or -1 if the character is not a digit.*/int QChar::digitValue(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return 0;    return qGetProp(ucs4)->digitValue;}/*!    Returns the character's category.*/QChar::Category QChar::category() const{    return (QChar::Category) qGetProp(ucs)->category;}/*! \overloadReturns the category of the UCS-4-encoded character specified by \a ucs4. */QChar::Category QChar::category(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return QChar::NoCategory;    return (QChar::Category) qGetProp(ucs4)->category;}/*! \overloadReturns the category of the UCS-2-encoded character specified by \a ucs2. */QChar::Category QChar::category(ushort ucs2){    return (QChar::Category) qGetProp(ucs2)->category;}/*!    Returns the character's direction.*/QChar::Direction QChar::direction() const{    return (QChar::Direction) qGetProp(ucs)->direction;}/*! \overloadReturns the direction of the UCS-4-encoded character specified by \a ucs4. */QChar::Direction QChar::direction(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return QChar::DirL;    return (QChar::Direction) qGetProp(ucs4)->direction;}/*! \overloadReturns the direction of the UCS-2-encoded character specified by \a ucs2. */QChar::Direction QChar::direction(ushort ucs2){    return (QChar::Direction) qGetProp(ucs2)->direction;}/*!    Returns information about the joining properties of the character    (needed for certain languages such as Arabic).*/QChar::Joining QChar::joining() const{    return (QChar::Joining) qGetProp(ucs)->joining;}/*! \overloadReturns information about the joining properties of the UCS-4-encodedcharacter specified by \a ucs4 (needed for certain languages such asArabic). */QChar::Joining QChar::joining(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return QChar::OtherJoining;    return (QChar::Joining) qGetProp(ucs4)->joining;}/*! \overloadReturns information about the joining properties of the UCS-2-encodedcharacter specified by \a ucs2 (needed for certain languages such asArabic). */QChar::Joining QChar::joining(ushort ucs2){    return (QChar::Joining) qGetProp(ucs2)->joining;}/*!    Returns true if the character should be reversed if the text    direction is reversed; otherwise returns false.    Same as (ch.mirroredChar() != ch).    \sa mirroredChar()*/bool QChar::hasMirrored() const{    return qGetProp(ucs)->mirrorDiff != 0;}/*!    \fn bool QChar::isLower() const    Returns true if the character is a lowercase letter, i.e.    category() is Letter_Lowercase.    \sa isUpper(), toLower(), toUpper()*//*!    \fn bool QChar::isUpper() const    Returns true if the character is an uppercase letter, i.e.    category() is Letter_Uppercase.    \sa isLower(), toUpper(), toLower()*//*!    \fn bool QChar::isTitleCase() const    \since 4.3    Returns true if the character is a titlecase letter, i.e.    category() is Letter_Titlecase.    \sa isLower(), toUpper(), toLower(), toTitleCase()*//*!    Returns the mirrored character if this character is a mirrored    character; otherwise returns the character itself.    \sa hasMirrored()*/QChar QChar::mirroredChar() const{    return ucs + qGetProp(ucs)->mirrorDiff;}/*! \overloadReturns the mirrored character if the UCS-4-encoded character specifiedby \a ucs4 is a mirrored character; otherwise returns the character itself.\sa hasMirrored() */uint QChar::mirroredChar(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return ucs4;    return ucs4 + qGetProp(ucs4)->mirrorDiff;}/*! \overloadReturns the mirrored character if the UCS-2-encoded character specifiedby \a ucs2 is a mirrored character; otherwise returns the character itself.\sa hasMirrored() */ushort QChar::mirroredChar(ushort ucs2){    return ucs2 + qGetProp(ucs2)->mirrorDiff;}enum {    Hangul_SBase = 0xac00,    Hangul_LBase = 0x1100,    Hangul_VBase = 0x1161,    Hangul_TBase = 0x11a7,    Hangul_SCount = 11172,    Hangul_LCount = 19,    Hangul_VCount = 21,    Hangul_TCount = 28,    Hangul_NCount = 21*28};// buffer has to have a length of 3. It's needed for Hangul decompositionstatic const unsigned short * QT_FASTCALL decomposition(uint ucs4, int *length, int *tag, unsigned short *buffer){    *length = 0;    if (ucs4 > LAST_UNICODE_CHAR)        return 0;    if (ucs4 >= Hangul_SBase && ucs4 < Hangul_SBase + Hangul_SCount) {        int SIndex = ucs4 - Hangul_SBase;        buffer[0] = Hangul_LBase + SIndex / Hangul_NCount; // L        buffer[1] = Hangul_VBase + (SIndex % Hangul_NCount) / Hangul_TCount; // V        buffer[2] = Hangul_TBase + SIndex % Hangul_TCount; // T        *length = buffer[2] == Hangul_TBase ? 2 : 3;        *tag = QChar::Canonical;        return buffer;    }    const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);    if (index == 0xffff)        return 0;    const unsigned short *decomposition = uc_decomposition_map+index;    *tag = (*decomposition) & 0xff;    *length = (*decomposition) >> 8;    return decomposition+1;}/*!    Decomposes a character into its parts. Returns an empty string if    no decomposition exists.*/QString QChar::decomposition() const{    return decomposition(ucs);}/*! \overloadDecomposes the UCS-4-encoded character specified by \a ucs4 into itsconstituent parts. Returns an empty string if no decomposition exists. */QString QChar::decomposition(uint ucs4){    unsigned short buffer[3];    int length;    int tag;    const unsigned short *d = ::decomposition(ucs4, &length, &tag, buffer);    return QString::fromUtf16(d, length);}/*!    Returns the tag defining the composition of the character. Returns    QChar::Single if no decomposition exists.*/QChar::Decomposition QChar::decompositionTag() const{    return decompositionTag(ucs);}/*! \overloadReturns the tag defining the composition of the UCS-4-encoded characterspecified by \a ucs4. Returns QChar::Single if no decomposition exists. */QChar::Decomposition QChar::decompositionTag(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return QChar::NoDecomposition;    const unsigned short index = GET_DECOMPOSITION_INDEX(ucs4);    if (index == 0xffff)        return QChar::NoDecomposition;    return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff);}/*!    Returns the combining class for the character as defined in the    Unicode standard. This is mainly useful as a positioning hint for    marks attached to a base character.    The Qt text rendering engine uses this information to correctly    position non-spacing marks around a base character.*/unsigned char QChar::combiningClass() const{    return (unsigned char) qGetProp(ucs)->combiningClass;}/*! \overloadReturns the combining class for the UCS-4-encoded character specified by\a ucs4, as defined in the Unicode standard. */unsigned char QChar::combiningClass(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return 0;    return (unsigned char) qGetProp(ucs4)->combiningClass;}/*! \overloadReturns the combining class for the UCS-2-encoded character specified by\a ucs2, as defined in the Unicode standard. */unsigned char QChar::combiningClass(ushort ucs2){    return (unsigned char) qGetProp(ucs2)->combiningClass;}/*!    Returns the Unicode version that introduced this character.*/QChar::UnicodeVersion QChar::unicodeVersion() const{    return (QChar::UnicodeVersion) qGetProp(ucs)->unicodeVersion;}/*! \overloadReturns the Unicode version that introduced the character specified inits UCS-4-encoded form as \a ucs4. */QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return QChar::Unicode_Unassigned;    return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;}/*! \overloadReturns the Unicode version that introduced the character specified inits UCS-2-encoded form as \a ucs2. */QChar::UnicodeVersion QChar::unicodeVersion(ushort ucs2){    return (QChar::UnicodeVersion) qGetProp(ucs2)->unicodeVersion;}/*!    Returns the lowercase equivalent if the character is uppercase or titlecase;    otherwise returns the character itself.*/QChar QChar::toLower() const{    const QUnicodeTables::Properties *p = qGetProp(ucs);    if (!p->lowerCaseSpecial)        return ucs + p->lowerCaseDiff;    return ucs;}/*! \overloadReturns the lowercase equivalent of the UCS-4-encoded character specifiedby \a ucs4 if the character is uppercase or titlecase; otherwise returnsthe character itself. */uint QChar::toLower(uint ucs4){    if (ucs4 > LAST_UNICODE_CHAR)        return ucs4;    const QUnicodeTables::Properties *p = qGetProp(ucs4);    if (!p->lowerCaseSpecial)        return ucs4 + p->lowerCaseDiff;    return ucs4;}/*! \overloadReturns the lowercase equivalent of the UCS-2-encoded character specifiedby \a ucs2 if the character is uppercase or titlecase; otherwise returnsthe character itself. */ushort QChar::toLower(ushort ucs2){    const QUnicodeTables::Properties *p = qGetProp(ucs2);    if (!p->lowerCaseSpecial)        return ucs2 + p->lowerCaseDiff;    return ucs2;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -