| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qchar.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | - | |||||||||||||||||||
| 8 | bool QChar::isPrint(uint ucs4) noexcept | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 | if (ucs4 > LastValidCodePoint
| 0-206544 | ||||||||||||||||||
| 11 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 12 | const int test = (1 << (Other_Control)) | | - | ||||||||||||||||||
| 13 | (1 << (Other_Format)) | | - | ||||||||||||||||||
| 14 | (1 << (Other_Surrogate)) | | - | ||||||||||||||||||
| 15 | (1 << (Other_PrivateUse)) | | - | ||||||||||||||||||
| 16 | (1 << (Other_NotAssigned)); | - | ||||||||||||||||||
| 17 | return executed 206544 times by 79 tests: !((1 << (qGetProp(ucs4)->category)) & test);return !((1 << (qGetProp(ucs4)->category)) & test);Executed by:
executed 206544 times by 79 tests: return !((1 << (qGetProp(ucs4)->category)) & test);Executed by:
| 206544 | ||||||||||||||||||
| 18 | } | - | ||||||||||||||||||
| 19 | bool QChar::isSpace_helper(uint ucs4) noexcept | - | ||||||||||||||||||
| 20 | { | - | ||||||||||||||||||
| 21 | if (ucs4 > LastValidCodePoint
| 0-315775 | ||||||||||||||||||
| 22 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 23 | const int test = (1 << (Separator_Space)) | | - | ||||||||||||||||||
| 24 | (1 << (Separator_Line)) | | - | ||||||||||||||||||
| 25 | (1 << (Separator_Paragraph)); | - | ||||||||||||||||||
| 26 | return executed 315775 times by 44 tests: (1 << (qGetProp(ucs4)->category)) & test;return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
executed 315775 times by 44 tests: return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
| 315775 | ||||||||||||||||||
| 27 | } | - | ||||||||||||||||||
| 28 | bool QChar::isMark(uint ucs4) noexcept | - | ||||||||||||||||||
| 29 | { | - | ||||||||||||||||||
| 30 | if (ucs4 > LastValidCodePoint
| 0-16148 | ||||||||||||||||||
| 31 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 32 | const int test = (1 << (Mark_NonSpacing)) | | - | ||||||||||||||||||
| 33 | (1 << (Mark_SpacingCombining)) | | - | ||||||||||||||||||
| 34 | (1 << (Mark_Enclosing)); | - | ||||||||||||||||||
| 35 | return executed 16148 times by 3 tests: (1 << (qGetProp(ucs4)->category)) & test;return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
executed 16148 times by 3 tests: return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
| 16148 | ||||||||||||||||||
| 36 | } | - | ||||||||||||||||||
| 37 | bool QChar::isPunct(uint ucs4) noexcept | - | ||||||||||||||||||
| 38 | { | - | ||||||||||||||||||
| 39 | if (ucs4 > LastValidCodePoint
| 0 | ||||||||||||||||||
| 40 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 41 | const int test = (1 << (Punctuation_Connector)) | | - | ||||||||||||||||||
| 42 | (1 << (Punctuation_Dash)) | | - | ||||||||||||||||||
| 43 | (1 << (Punctuation_Open)) | | - | ||||||||||||||||||
| 44 | (1 << (Punctuation_Close)) | | - | ||||||||||||||||||
| 45 | (1 << (Punctuation_InitialQuote)) | | - | ||||||||||||||||||
| 46 | (1 << (Punctuation_FinalQuote)) | | - | ||||||||||||||||||
| 47 | (1 << (Punctuation_Other)); | - | ||||||||||||||||||
| 48 | return never executed: (1 << (qGetProp(ucs4)->category)) & test;return (1 << (qGetProp(ucs4)->category)) & test;never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 | ||||||||||||||||||
| 49 | } | - | ||||||||||||||||||
| 50 | bool QChar::isSymbol(uint ucs4) noexcept | - | ||||||||||||||||||
| 51 | { | - | ||||||||||||||||||
| 52 | if (ucs4 > LastValidCodePoint
| 0 | ||||||||||||||||||
| 53 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 54 | const int test = (1 << (Symbol_Math)) | | - | ||||||||||||||||||
| 55 | (1 << (Symbol_Currency)) | | - | ||||||||||||||||||
| 56 | (1 << (Symbol_Modifier)) | | - | ||||||||||||||||||
| 57 | (1 << (Symbol_Other)); | - | ||||||||||||||||||
| 58 | return never executed: (1 << (qGetProp(ucs4)->category)) & test;return (1 << (qGetProp(ucs4)->category)) & test;never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 | ||||||||||||||||||
| 59 | } | - | ||||||||||||||||||
| 60 | bool QChar::isLetter_helper(uint ucs4) noexcept | - | ||||||||||||||||||
| 61 | { | - | ||||||||||||||||||
| 62 | if (ucs4 > LastValidCodePoint
| 0-128 | ||||||||||||||||||
| 63 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 64 | const int test = (1 << (Letter_Uppercase)) | | - | ||||||||||||||||||
| 65 | (1 << (Letter_Lowercase)) | | - | ||||||||||||||||||
| 66 | (1 << (Letter_Titlecase)) | | - | ||||||||||||||||||
| 67 | (1 << (Letter_Modifier)) | | - | ||||||||||||||||||
| 68 | (1 << (Letter_Other)); | - | ||||||||||||||||||
| 69 | return executed 128 times by 1 test: (1 << (qGetProp(ucs4)->category)) & test;return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
executed 128 times by 1 test: return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
| 128 | ||||||||||||||||||
| 70 | } | - | ||||||||||||||||||
| 71 | bool QChar::isNumber_helper(uint ucs4) noexcept | - | ||||||||||||||||||
| 72 | { | - | ||||||||||||||||||
| 73 | if (ucs4 > LastValidCodePoint
| 0 | ||||||||||||||||||
| 74 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 75 | const int test = (1 << (Number_DecimalDigit)) | | - | ||||||||||||||||||
| 76 | (1 << (Number_Letter)) | | - | ||||||||||||||||||
| 77 | (1 << (Number_Other)); | - | ||||||||||||||||||
| 78 | return never executed: (1 << (qGetProp(ucs4)->category)) & test;return (1 << (qGetProp(ucs4)->category)) & test;never executed: return (1 << (qGetProp(ucs4)->category)) & test; | 0 | ||||||||||||||||||
| 79 | } | - | ||||||||||||||||||
| 80 | bool QChar::isLetterOrNumber_helper(uint ucs4) noexcept | - | ||||||||||||||||||
| 81 | { | - | ||||||||||||||||||
| 82 | if (ucs4 > LastValidCodePoint
| 0-81818 | ||||||||||||||||||
| 83 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 84 | const int test = (1 << (Letter_Uppercase)) | | - | ||||||||||||||||||
| 85 | (1 << (Letter_Lowercase)) | | - | ||||||||||||||||||
| 86 | (1 << (Letter_Titlecase)) | | - | ||||||||||||||||||
| 87 | (1 << (Letter_Modifier)) | | - | ||||||||||||||||||
| 88 | (1 << (Letter_Other)) | | - | ||||||||||||||||||
| 89 | (1 << (Number_DecimalDigit)) | | - | ||||||||||||||||||
| 90 | (1 << (Number_Letter)) | | - | ||||||||||||||||||
| 91 | (1 << (Number_Other)); | - | ||||||||||||||||||
| 92 | return executed 81818 times by 36 tests: (1 << (qGetProp(ucs4)->category)) & test;return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
executed 81818 times by 36 tests: return (1 << (qGetProp(ucs4)->category)) & test;Executed by:
| 81818 | ||||||||||||||||||
| 93 | } | - | ||||||||||||||||||
| 94 | int QChar::digitValue(uint ucs4) noexcept | - | ||||||||||||||||||
| 95 | { | - | ||||||||||||||||||
| 96 | if (ucs4 > LastValidCodePoint
| 1-5797012 | ||||||||||||||||||
| 97 | return executed 1 time by 1 test: -1;return -1;Executed by:
executed 1 time by 1 test: return -1;Executed by:
| 1 | ||||||||||||||||||
| 98 | return executed 5797012 times by 430 tests: qGetProp(ucs4)->digitValue;return qGetProp(ucs4)->digitValue;Executed by:
executed 5797012 times by 430 tests: return qGetProp(ucs4)->digitValue;Executed by:
| 5797012 | ||||||||||||||||||
| 99 | } | - | ||||||||||||||||||
| 100 | QChar::Category QChar::category(uint ucs4) noexcept | - | ||||||||||||||||||
| 101 | { | - | ||||||||||||||||||
| 102 | if (ucs4 > LastValidCodePoint
| 1-9539049 | ||||||||||||||||||
| 103 | return executed 1 time by 1 test: QChar::Other_NotAssigned;return QChar::Other_NotAssigned;Executed by:
executed 1 time by 1 test: return QChar::Other_NotAssigned;Executed by:
| 1 | ||||||||||||||||||
| 104 | return executed 9539049 times by 132 tests: (QChar::Category) qGetProp(ucs4)->category;return (QChar::Category) qGetProp(ucs4)->category;Executed by:
executed 9539049 times by 132 tests: return (QChar::Category) qGetProp(ucs4)->category;Executed by:
| 9539049 | ||||||||||||||||||
| 105 | } | - | ||||||||||||||||||
| 106 | QChar::Direction QChar::direction(uint ucs4) noexcept | - | ||||||||||||||||||
| 107 | { | - | ||||||||||||||||||
| 108 | if (ucs4 > LastValidCodePoint
| 0-1879525 | ||||||||||||||||||
| 109 | return never executed: QChar::DirL;return QChar::DirL;never executed: return QChar::DirL; | 0 | ||||||||||||||||||
| 110 | return executed 1879525 times by 104 tests: (QChar::Direction) qGetProp(ucs4)->direction;return (QChar::Direction) qGetProp(ucs4)->direction;Executed by:
executed 1879525 times by 104 tests: return (QChar::Direction) qGetProp(ucs4)->direction;Executed by:
| 1879525 | ||||||||||||||||||
| 111 | } | - | ||||||||||||||||||
| 112 | QChar::JoiningType QChar::joiningType(uint ucs4) noexcept | - | ||||||||||||||||||
| 113 | { | - | ||||||||||||||||||
| 114 | if (ucs4 > LastValidCodePoint
| 0-2169 | ||||||||||||||||||
| 115 | return never executed: QChar::Joining_None;return QChar::Joining_None;never executed: return QChar::Joining_None; | 0 | ||||||||||||||||||
| 116 | return executed 2169 times by 14 tests: QChar::JoiningType(qGetProp(ucs4)->joining);return QChar::JoiningType(qGetProp(ucs4)->joining);Executed by:
executed 2169 times by 14 tests: return QChar::JoiningType(qGetProp(ucs4)->joining);Executed by:
| 2169 | ||||||||||||||||||
| 117 | } | - | ||||||||||||||||||
| 118 | QChar::Joining QChar::joining(uint ucs4) noexcept | - | ||||||||||||||||||
| 119 | { | - | ||||||||||||||||||
| 120 | if (ucs4 > LastValidCodePoint
| 0 | ||||||||||||||||||
| 121 | return never executed: QChar::OtherJoining;return QChar::OtherJoining;never executed: return QChar::OtherJoining; | 0 | ||||||||||||||||||
| 122 | switch (qGetProp(ucs4)->joining) { | - | ||||||||||||||||||
| 123 | case never executed: QChar::Joining_Causing:case QChar::Joining_Causing:never executed: returncase QChar::Joining_Causing:never executed: QChar::Center;return QChar::Center;never executed: return QChar::Center; | 0 | ||||||||||||||||||
| 124 | case never executed: QChar::Joining_Dual:case QChar::Joining_Dual:never executed: returncase QChar::Joining_Dual:never executed: QChar::Dual;return QChar::Dual;never executed: return QChar::Dual; | 0 | ||||||||||||||||||
| 125 | case never executed: QChar::Joining_Right:case QChar::Joining_Right:never executed: returncase QChar::Joining_Right:never executed: QChar::Right;return QChar::Right;never executed: return QChar::Right; | 0 | ||||||||||||||||||
| 126 | default never executed: :default:never executed: break;default:never executed: break; | 0 | ||||||||||||||||||
| 127 | } | - | ||||||||||||||||||
| 128 | return never executed: QChar::OtherJoining;return QChar::OtherJoining;never executed: return QChar::OtherJoining; | 0 | ||||||||||||||||||
| 129 | } | - | ||||||||||||||||||
| 130 | bool QChar::hasMirrored(uint ucs4) noexcept | - | ||||||||||||||||||
| 131 | { | - | ||||||||||||||||||
| 132 | if (ucs4 > LastValidCodePoint
| 0-4 | ||||||||||||||||||
| 133 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 134 | return executed 4 times by 1 test: qGetProp(ucs4)->mirrorDiff != 0;return qGetProp(ucs4)->mirrorDiff != 0;Executed by:
executed 4 times by 1 test: return qGetProp(ucs4)->mirrorDiff != 0;Executed by:
| 4 | ||||||||||||||||||
| 135 | } | - | ||||||||||||||||||
| 136 | uint QChar::mirroredChar(uint ucs4) noexcept | - | ||||||||||||||||||
| 137 | { | - | ||||||||||||||||||
| 138 | if (ucs4 > LastValidCodePoint
| 0-129532 | ||||||||||||||||||
| 139 | return never executed: ucs4;return ucs4;never executed: return ucs4; | 0 | ||||||||||||||||||
| 140 | return executed 129532 times by 12 tests: ucs4 + qGetProp(ucs4)->mirrorDiff;return ucs4 + qGetProp(ucs4)->mirrorDiff;Executed by:
executed 129532 times by 12 tests: return ucs4 + qGetProp(ucs4)->mirrorDiff;Executed by:
| 129532 | ||||||||||||||||||
| 141 | } | - | ||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | - | |||||||||||||||||||
| 144 | - | |||||||||||||||||||
| 145 | enum { | - | ||||||||||||||||||
| 146 | Hangul_SBase = 0xac00, | - | ||||||||||||||||||
| 147 | Hangul_LBase = 0x1100, | - | ||||||||||||||||||
| 148 | Hangul_VBase = 0x1161, | - | ||||||||||||||||||
| 149 | Hangul_TBase = 0x11a7, | - | ||||||||||||||||||
| 150 | Hangul_LCount = 19, | - | ||||||||||||||||||
| 151 | Hangul_VCount = 21, | - | ||||||||||||||||||
| 152 | Hangul_TCount = 28, | - | ||||||||||||||||||
| 153 | Hangul_NCount = Hangul_VCount * Hangul_TCount, | - | ||||||||||||||||||
| 154 | Hangul_SCount = Hangul_LCount * Hangul_NCount | - | ||||||||||||||||||
| 155 | }; | - | ||||||||||||||||||
| 156 | - | |||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | static const unsigned short * decompositionHelper | - | ||||||||||||||||||
| 159 | (uint ucs4, int *length, int *tag, unsigned short *buffer) | - | ||||||||||||||||||
| 160 | { | - | ||||||||||||||||||
| 161 | if (ucs4 >= Hangul_SBase
| 21808-507118 | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | const uint SIndex = ucs4 - Hangul_SBase; | - | ||||||||||||||||||
| 164 | buffer[0] = Hangul_LBase + SIndex / Hangul_NCount; | - | ||||||||||||||||||
| 165 | buffer[1] = Hangul_VBase + (SIndex % Hangul_NCount) / Hangul_TCount; | - | ||||||||||||||||||
| 166 | buffer[2] = Hangul_TBase + SIndex % Hangul_TCount; | - | ||||||||||||||||||
| 167 | *length = buffer[2] == Hangul_TBase
| 3573-64643 | ||||||||||||||||||
| 168 | *tag = QChar::Canonical; | - | ||||||||||||||||||
| 169 | return executed 68216 times by 1 test: buffer;return buffer;Executed by:
executed 68216 times by 1 test: return buffer;Executed by:
| 68216 | ||||||||||||||||||
| 170 | } | - | ||||||||||||||||||
| 171 | - | |||||||||||||||||||
| 172 | const unsigned short index = (ucs4 < 0x3400
| 0-499564 | ||||||||||||||||||
| 173 | if (index == 0xffff
| 37886-491040 | ||||||||||||||||||
| 174 | *length = 0; | - | ||||||||||||||||||
| 175 | *tag = QChar::NoDecomposition; | - | ||||||||||||||||||
| 176 | return executed 491040 times by 3 tests: 0;return 0;Executed by:
executed 491040 times by 3 tests: return 0;Executed by:
| 491040 | ||||||||||||||||||
| 177 | } | - | ||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | const unsigned short *decomposition = uc_decomposition_map+index; | - | ||||||||||||||||||
| 180 | *tag = (*decomposition) & 0xff; | - | ||||||||||||||||||
| 181 | *length = (*decomposition) >> 8; | - | ||||||||||||||||||
| 182 | return executed 37886 times by 3 tests: decomposition+1;return decomposition+1;Executed by:
executed 37886 times by 3 tests: return decomposition+1;Executed by:
| 37886 | ||||||||||||||||||
| 183 | } | - | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | - | |||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | - | |||||||||||||||||||
| 188 | - | |||||||||||||||||||
| 189 | QString QChar::decomposition() const | - | ||||||||||||||||||
| 190 | { | - | ||||||||||||||||||
| 191 | return never executed: QChar::decomposition(ucs);return QChar::decomposition(ucs);never executed: return QChar::decomposition(ucs); | 0 | ||||||||||||||||||
| 192 | } | - | ||||||||||||||||||
| 193 | - | |||||||||||||||||||
| 194 | - | |||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | - | |||||||||||||||||||
| 198 | - | |||||||||||||||||||
| 199 | QString QChar::decomposition(uint ucs4) | - | ||||||||||||||||||
| 200 | { | - | ||||||||||||||||||
| 201 | unsigned short buffer[3]; | - | ||||||||||||||||||
| 202 | int length; | - | ||||||||||||||||||
| 203 | int tag; | - | ||||||||||||||||||
| 204 | const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer); | - | ||||||||||||||||||
| 205 | return executed 5 times by 1 test: QString(reinterpret_cast<const QChar *>(d), length);return QString(reinterpret_cast<const QChar *>(d), length);Executed by:
executed 5 times by 1 test: return QString(reinterpret_cast<const QChar *>(d), length);Executed by:
| 5 | ||||||||||||||||||
| 206 | } | - | ||||||||||||||||||
| 207 | QChar::Decomposition QChar::decompositionTag(uint ucs4) noexcept | - | ||||||||||||||||||
| 208 | { | - | ||||||||||||||||||
| 209 | if (ucs4 >= Hangul_SBase
| 24-1275746 | ||||||||||||||||||
| 210 | return executed 22344 times by 1 test: QChar::Canonical;return QChar::Canonical;Executed by:
executed 22344 times by 1 test: return QChar::Canonical;Executed by:
| 22344 | ||||||||||||||||||
| 211 | const unsigned short index = (ucs4 < 0x3400
| 0-1275746 | ||||||||||||||||||
| 212 | if (index == 0xffff
| 55674-1220096 | ||||||||||||||||||
| 213 | return executed 1220096 times by 85 tests: QChar::NoDecomposition;return QChar::NoDecomposition;Executed by:
executed 1220096 times by 85 tests: return QChar::NoDecomposition;Executed by:
| 1220096 | ||||||||||||||||||
| 214 | return executed 55674 times by 7 tests: (QChar::Decomposition)(uc_decomposition_map[index] & 0xff);return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff);Executed by:
executed 55674 times by 7 tests: return (QChar::Decomposition)(uc_decomposition_map[index] & 0xff);Executed by:
| 55674 | ||||||||||||||||||
| 215 | } | - | ||||||||||||||||||
| 216 | unsigned char QChar::combiningClass(uint ucs4) noexcept | - | ||||||||||||||||||
| 217 | { | - | ||||||||||||||||||
| 218 | if (ucs4 > LastValidCodePoint
| 0-5518214 | ||||||||||||||||||
| 219 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 220 | return executed 5518214 times by 112 tests: (unsigned char) qGetProp(ucs4)->combiningClass;return (unsigned char) qGetProp(ucs4)->combiningClass;Executed by:
executed 5518214 times by 112 tests: return (unsigned char) qGetProp(ucs4)->combiningClass;Executed by:
| 5518214 | ||||||||||||||||||
| 221 | } | - | ||||||||||||||||||
| 222 | QChar::Script QChar::script(uint ucs4) noexcept | - | ||||||||||||||||||
| 223 | { | - | ||||||||||||||||||
| 224 | if (ucs4 > LastValidCodePoint
| 0-2639 | ||||||||||||||||||
| 225 | return never executed: QChar::Script_Unknown;return QChar::Script_Unknown;never executed: return QChar::Script_Unknown; | 0 | ||||||||||||||||||
| 226 | return executed 2639 times by 62 tests: (QChar::Script) qGetProp(ucs4)->script;return (QChar::Script) qGetProp(ucs4)->script;Executed by:
executed 2639 times by 62 tests: return (QChar::Script) qGetProp(ucs4)->script;Executed by:
| 2639 | ||||||||||||||||||
| 227 | } | - | ||||||||||||||||||
| 228 | QChar::UnicodeVersion QChar::unicodeVersion(uint ucs4) noexcept | - | ||||||||||||||||||
| 229 | { | - | ||||||||||||||||||
| 230 | if (ucs4 > LastValidCodePoint
| 1-609469 | ||||||||||||||||||
| 231 | return executed 1 time by 1 test: QChar::Unicode_Unassigned;return QChar::Unicode_Unassigned;Executed by:
executed 1 time by 1 test: return QChar::Unicode_Unassigned;Executed by:
| 1 | ||||||||||||||||||
| 232 | return executed 609469 times by 6 tests: (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;Executed by:
executed 609469 times by 6 tests: return (QChar::UnicodeVersion) qGetProp(ucs4)->unicodeVersion;Executed by:
| 609469 | ||||||||||||||||||
| 233 | } | - | ||||||||||||||||||
| 234 | - | |||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | QChar::UnicodeVersion QChar::currentUnicodeVersion() noexcept | - | ||||||||||||||||||
| 239 | { | - | ||||||||||||||||||
| 240 | return executed 565704 times by 4 tests: QChar::Unicode_8_0;return QChar::Unicode_8_0;Executed by:
executed 565704 times by 4 tests: return QChar::Unicode_8_0;Executed by:
| 565704 | ||||||||||||||||||
| 241 | } | - | ||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | template <typename Traits, typename T> | - | ||||||||||||||||||
| 245 | __attribute__((const)) static inline T convertCase_helper(T uc) noexcept | - | ||||||||||||||||||
| 246 | { | - | ||||||||||||||||||
| 247 | const QUnicodeTables::Properties *prop = qGetProp(uc); | - | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | if (__builtin_expect(!!(Traits::caseSpecial(prop)), false)
| 347-11269411 | ||||||||||||||||||
| 250 | const ushort *specialCase = specialCaseMap + Traits::caseDiff(prop); | - | ||||||||||||||||||
| 251 | - | |||||||||||||||||||
| 252 | return executed 347 times by 5 tests: *specialCase == 1 ? specialCase[1] : uc;return *specialCase == 1 ? specialCase[1] : uc;Executed by:
executed 347 times by 5 tests: return *specialCase == 1 ? specialCase[1] : uc;Executed by:
| 347 | ||||||||||||||||||
| 253 | } | - | ||||||||||||||||||
| 254 | - | |||||||||||||||||||
| 255 | return executed 11269411 times by 226 tests: uc + Traits::caseDiff(prop);return uc + Traits::caseDiff(prop);Executed by:
executed 11269411 times by 226 tests: return uc + Traits::caseDiff(prop);Executed by:
| 11269411 | ||||||||||||||||||
| 256 | } | - | ||||||||||||||||||
| 257 | uint QChar::toLower(uint ucs4) noexcept | - | ||||||||||||||||||
| 258 | { | - | ||||||||||||||||||
| 259 | if (ucs4 > LastValidCodePoint
| 0-5516452 | ||||||||||||||||||
| 260 | return never executed: ucs4;return ucs4;never executed: return ucs4; | 0 | ||||||||||||||||||
| 261 | return executed 5516452 times by 94 tests: convertCase_helper<QUnicodeTables::LowercaseTraits>(ucs4);return convertCase_helper<QUnicodeTables::LowercaseTraits>(ucs4);Executed by:
executed 5516452 times by 94 tests: return convertCase_helper<QUnicodeTables::LowercaseTraits>(ucs4);Executed by:
| 5516452 | ||||||||||||||||||
| 262 | } | - | ||||||||||||||||||
| 263 | uint QChar::toUpper(uint ucs4) noexcept | - | ||||||||||||||||||
| 264 | { | - | ||||||||||||||||||
| 265 | if (ucs4 > LastValidCodePoint
| 0-2026370 | ||||||||||||||||||
| 266 | return never executed: ucs4;return ucs4;never executed: return ucs4; | 0 | ||||||||||||||||||
| 267 | return executed 2026370 times by 187 tests: convertCase_helper<QUnicodeTables::UppercaseTraits>(ucs4);return convertCase_helper<QUnicodeTables::UppercaseTraits>(ucs4);Executed by:
executed 2026370 times by 187 tests: return convertCase_helper<QUnicodeTables::UppercaseTraits>(ucs4);Executed by:
| 2026370 | ||||||||||||||||||
| 268 | } | - | ||||||||||||||||||
| 269 | uint QChar::toTitleCase(uint ucs4) noexcept | - | ||||||||||||||||||
| 270 | { | - | ||||||||||||||||||
| 271 | if (ucs4 > LastValidCodePoint
| 0-50 | ||||||||||||||||||
| 272 | return never executed: ucs4;return ucs4;never executed: return ucs4; | 0 | ||||||||||||||||||
| 273 | return executed 50 times by 2 tests: convertCase_helper<QUnicodeTables::TitlecaseTraits>(ucs4);return convertCase_helper<QUnicodeTables::TitlecaseTraits>(ucs4);Executed by:
executed 50 times by 2 tests: return convertCase_helper<QUnicodeTables::TitlecaseTraits>(ucs4);Executed by:
| 50 | ||||||||||||||||||
| 274 | } | - | ||||||||||||||||||
| 275 | - | |||||||||||||||||||
| 276 | static inline uint foldCase(const ushort *ch, const ushort *start) | - | ||||||||||||||||||
| 277 | { | - | ||||||||||||||||||
| 278 | uint ucs4 = *ch; | - | ||||||||||||||||||
| 279 | if (QChar::isLowSurrogate(ucs4)
| 0-46351 | ||||||||||||||||||
| 280 | ucs4 = QChar::surrogateToUcs4(*(ch - 1), ucs4); never executed: ucs4 = QChar::surrogateToUcs4(*(ch - 1), ucs4); | 0 | ||||||||||||||||||
| 281 | return executed 46351 times by 25 tests: convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
executed 46351 times by 25 tests: return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
| 46351 | ||||||||||||||||||
| 282 | } | - | ||||||||||||||||||
| 283 | - | |||||||||||||||||||
| 284 | static inline uint foldCase(uint ch, uint &last) noexcept | - | ||||||||||||||||||
| 285 | { | - | ||||||||||||||||||
| 286 | uint ucs4 = ch; | - | ||||||||||||||||||
| 287 | if (QChar::isLowSurrogate(ucs4)
| 0-3463562 | ||||||||||||||||||
| 288 | ucs4 = QChar::surrogateToUcs4(last, ucs4); executed 28 times by 2 tests: ucs4 = QChar::surrogateToUcs4(last, ucs4);Executed by:
| 28 | ||||||||||||||||||
| 289 | last = ch; | - | ||||||||||||||||||
| 290 | return executed 3463590 times by 170 tests: convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
executed 3463590 times by 170 tests: return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
| 3463590 | ||||||||||||||||||
| 291 | } | - | ||||||||||||||||||
| 292 | - | |||||||||||||||||||
| 293 | static inline ushort foldCase(ushort ch) noexcept | - | ||||||||||||||||||
| 294 | { | - | ||||||||||||||||||
| 295 | return executed 151362 times by 53 tests: convertCase_helper<QUnicodeTables::CasefoldTraits>(ch);return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch);Executed by:
executed 151362 times by 53 tests: return convertCase_helper<QUnicodeTables::CasefoldTraits>(ch);Executed by:
| 151362 | ||||||||||||||||||
| 296 | } | - | ||||||||||||||||||
| 297 | uint QChar::toCaseFolded(uint ucs4) noexcept | - | ||||||||||||||||||
| 298 | { | - | ||||||||||||||||||
| 299 | if (ucs4 > LastValidCodePoint
| 0-65583 | ||||||||||||||||||
| 300 | return never executed: ucs4;return ucs4;never executed: return ucs4; | 0 | ||||||||||||||||||
| 301 | return executed 65583 times by 2 tests: convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
executed 65583 times by 2 tests: return convertCase_helper<QUnicodeTables::CasefoldTraits>(ucs4);Executed by:
| 65583 | ||||||||||||||||||
| 302 | } | - | ||||||||||||||||||
| 303 | QDataStream &operator<<(QDataStream &out, QChar chr) | - | ||||||||||||||||||
| 304 | { | - | ||||||||||||||||||
| 305 | out << quint16(chr.unicode()); | - | ||||||||||||||||||
| 306 | return executed 5 times by 2 tests: out;return out;Executed by:
executed 5 times by 2 tests: return out;Executed by:
| 5 | ||||||||||||||||||
| 307 | } | - | ||||||||||||||||||
| 308 | QDataStream &operator>>(QDataStream &in, QChar &chr) | - | ||||||||||||||||||
| 309 | { | - | ||||||||||||||||||
| 310 | quint16 u; | - | ||||||||||||||||||
| 311 | in >> u; | - | ||||||||||||||||||
| 312 | chr.unicode() = ushort(u); | - | ||||||||||||||||||
| 313 | return executed 9 times by 2 tests: in;return in;Executed by:
executed 9 times by 2 tests: return in;Executed by:
| 9 | ||||||||||||||||||
| 314 | } | - | ||||||||||||||||||
| 315 | static void decomposeHelper(QString *str, bool canonical, QChar::UnicodeVersion version, int from) | - | ||||||||||||||||||
| 316 | { | - | ||||||||||||||||||
| 317 | int length; | - | ||||||||||||||||||
| 318 | int tag; | - | ||||||||||||||||||
| 319 | unsigned short buffer[3]; | - | ||||||||||||||||||
| 320 | - | |||||||||||||||||||
| 321 | QString &s = *str; | - | ||||||||||||||||||
| 322 | - | |||||||||||||||||||
| 323 | const unsigned short *utf16 = reinterpret_cast<unsigned short *>(s.data()); | - | ||||||||||||||||||
| 324 | const unsigned short *uc = utf16 + s.length(); | - | ||||||||||||||||||
| 325 | while (uc != utf16 + from
| 166051-597138 | ||||||||||||||||||
| 326 | uint ucs4 = *(--uc); | - | ||||||||||||||||||
| 327 | if (QChar(ucs4).isLowSurrogate()
| 0-583903 | ||||||||||||||||||
| 328 | ushort high = *(uc - 1); | - | ||||||||||||||||||
| 329 | if (QChar(high).isHighSurrogate()
| 0-13235 | ||||||||||||||||||
| 330 | --uc; | - | ||||||||||||||||||
| 331 | ucs4 = QChar::surrogateToUcs4(high, ucs4); | - | ||||||||||||||||||
| 332 | } executed 13235 times by 1 test: end of blockExecuted by:
| 13235 | ||||||||||||||||||
| 333 | } executed 13235 times by 1 test: end of blockExecuted by:
| 13235 | ||||||||||||||||||
| 334 | - | |||||||||||||||||||
| 335 | if (QChar::unicodeVersion(ucs4) > version
| 1-597137 | ||||||||||||||||||
| 336 | continue; executed 1 time by 1 test: continue;Executed by:
| 1 | ||||||||||||||||||
| 337 | - | |||||||||||||||||||
| 338 | const unsigned short *d = decompositionHelper(ucs4, &length, &tag, buffer); | - | ||||||||||||||||||
| 339 | if (!d
| 46-491040 | ||||||||||||||||||
| 340 | continue; executed 491086 times by 3 tests: continue;Executed by:
| 491086 | ||||||||||||||||||
| 341 | - | |||||||||||||||||||
| 342 | int pos = uc - utf16; | - | ||||||||||||||||||
| 343 | s.replace(pos, QChar::requiresSurrogates(ucs4) ? 2 : 1, reinterpret_cast<const QChar *>(d), length); | - | ||||||||||||||||||
| 344 | - | |||||||||||||||||||
| 345 | utf16 = reinterpret_cast<unsigned short *>(s.data()); | - | ||||||||||||||||||
| 346 | uc = utf16 + pos + length; | - | ||||||||||||||||||
| 347 | } executed 106051 times by 3 tests: end of blockExecuted by:
| 106051 | ||||||||||||||||||
| 348 | } executed 166051 times by 3 tests: end of blockExecuted by:
| 166051 | ||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | - | |||||||||||||||||||
| 351 | struct UCS2Pair { | - | ||||||||||||||||||
| 352 | ushort u1; | - | ||||||||||||||||||
| 353 | ushort u2; | - | ||||||||||||||||||
| 354 | }; | - | ||||||||||||||||||
| 355 | - | |||||||||||||||||||
| 356 | inline bool operator<(const UCS2Pair &ligature1, const UCS2Pair &ligature2) | - | ||||||||||||||||||
| 357 | { return never executed: ligature1.u1 < ligature2.u1;return ligature1.u1 < ligature2.u1;never executed: }return ligature1.u1 < ligature2.u1; | 0 | ||||||||||||||||||
| 358 | inline bool operator<(ushort u1, const UCS2Pair &ligature) | - | ||||||||||||||||||
| 359 | { return never executed: u1 < ligature.u1;return u1 < ligature.u1;never executed: }return u1 < ligature.u1; | 0 | ||||||||||||||||||
| 360 | inline bool operator<(const UCS2Pair &ligature, ushort u1) | - | ||||||||||||||||||
| 361 | { return executed 60862 times by 2 tests: ligature.u1 < u1;return ligature.u1 < u1;Executed by:
executed 60862 times by 2 tests: }return ligature.u1 < u1;Executed by:
| 60862 | ||||||||||||||||||
| 362 | - | |||||||||||||||||||
| 363 | struct UCS2SurrogatePair { | - | ||||||||||||||||||
| 364 | UCS2Pair p1; | - | ||||||||||||||||||
| 365 | UCS2Pair p2; | - | ||||||||||||||||||
| 366 | }; | - | ||||||||||||||||||
| 367 | - | |||||||||||||||||||
| 368 | inline bool operator<(const UCS2SurrogatePair &ligature1, const UCS2SurrogatePair &ligature2) | - | ||||||||||||||||||
| 369 | { return never executed: QChar::surrogateToUcs4(ligature1.p1.u1, ligature1.p1.u2) < QChar::surrogateToUcs4(ligature2.p1.u1, ligature2.p1.u2);return QChar::surrogateToUcs4(ligature1.p1.u1, ligature1.p1.u2) < QChar::surrogateToUcs4(ligature2.p1.u1, ligature2.p1.u2);never executed: }return QChar::surrogateToUcs4(ligature1.p1.u1, ligature1.p1.u2) < QChar::surrogateToUcs4(ligature2.p1.u1, ligature2.p1.u2); | 0 | ||||||||||||||||||
| 370 | inline bool operator<(uint u1, const UCS2SurrogatePair &ligature) | - | ||||||||||||||||||
| 371 | { return never executed: u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2);return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2);never executed: }return u1 < QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2); | 0 | ||||||||||||||||||
| 372 | inline bool operator<(const UCS2SurrogatePair &ligature, uint u1) | - | ||||||||||||||||||
| 373 | { return executed 76 times by 1 test: QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1;return QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1;Executed by:
executed 76 times by 1 test: }return QChar::surrogateToUcs4(ligature.p1.u1, ligature.p1.u2) < u1;Executed by:
| 76 | ||||||||||||||||||
| 374 | - | |||||||||||||||||||
| 375 | static uint inline ligatureHelper(uint u1, uint u2) | - | ||||||||||||||||||
| 376 | { | - | ||||||||||||||||||
| 377 | if (u1 >= Hangul_LBase
| 164-93226 | ||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | - | |||||||||||||||||||
| 380 | const uint LIndex = u1 - Hangul_LBase; | - | ||||||||||||||||||
| 381 | if (LIndex < Hangul_LCount
| 46152-46910 | ||||||||||||||||||
| 382 | const uint VIndex = u2 - Hangul_VBase; | - | ||||||||||||||||||
| 383 | if (VIndex < Hangul_VCount
| 352-45800 | ||||||||||||||||||
| 384 | return executed 45800 times by 1 test: Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount;return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount;Executed by:
executed 45800 times by 1 test: return Hangul_SBase + (LIndex * Hangul_VCount + VIndex) * Hangul_TCount;Executed by:
| 45800 | ||||||||||||||||||
| 385 | } executed 352 times by 1 test: end of blockExecuted by:
| 352 | ||||||||||||||||||
| 386 | - | |||||||||||||||||||
| 387 | const uint SIndex = u1 - Hangul_SBase; | - | ||||||||||||||||||
| 388 | if (SIndex < Hangul_SCount
| 10-44129 | ||||||||||||||||||
| 389 | const uint TIndex = u2 - Hangul_TBase; | - | ||||||||||||||||||
| 390 | if (TIndex <= Hangul_TCount
| 1017-43102 | ||||||||||||||||||
| 391 | return executed 43102 times by 1 test: u1 + TIndex;return u1 + TIndex;Executed by:
executed 43102 times by 1 test: return u1 + TIndex;Executed by:
| 43102 | ||||||||||||||||||
| 392 | } executed 1017 times by 1 test: end of blockExecuted by:
| 1017 | ||||||||||||||||||
| 393 | } executed 4160 times by 2 tests: end of blockExecuted by:
| 4160 | ||||||||||||||||||
| 394 | - | |||||||||||||||||||
| 395 | const unsigned short index = (u2 < 0x3100
| 572-43175 | ||||||||||||||||||
| 396 | if (index == 0xffff
| 12117-33574 | ||||||||||||||||||
| 397 | return executed 33574 times by 2 tests: 0;return 0;Executed by:
executed 33574 times by 2 tests: return 0;Executed by:
| 33574 | ||||||||||||||||||
| 398 | const unsigned short *ligatures = uc_ligature_map+index; | - | ||||||||||||||||||
| 399 | ushort length = *ligatures++; | - | ||||||||||||||||||
| 400 | if (QChar::requiresSurrogates(u1)
| 48-12069 | ||||||||||||||||||
| 401 | const UCS2SurrogatePair *data = reinterpret_cast<const UCS2SurrogatePair *>(ligatures); | - | ||||||||||||||||||
| 402 | const UCS2SurrogatePair *r = std::lower_bound(data, data + length, u1); | - | ||||||||||||||||||
| 403 | if (r != data + length
| 0-48 | ||||||||||||||||||
| 404 | return executed 48 times by 1 test: QChar::surrogateToUcs4(r->p2.u1, r->p2.u2);return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2);Executed by:
executed 48 times by 1 test: return QChar::surrogateToUcs4(r->p2.u1, r->p2.u2);Executed by:
| 48 | ||||||||||||||||||
| 405 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 406 | const UCS2Pair *data = reinterpret_cast<const UCS2Pair *>(ligatures); | - | ||||||||||||||||||
| 407 | const UCS2Pair *r = std::lower_bound(data, data + length, ushort(u1)); | - | ||||||||||||||||||
| 408 | if (r != data + length
| 30-12039 | ||||||||||||||||||
| 409 | return executed 8485 times by 2 tests: r->u2;return r->u2;Executed by:
executed 8485 times by 2 tests: return r->u2;Executed by:
| 8485 | ||||||||||||||||||
| 410 | } executed 3584 times by 2 tests: end of blockExecuted by:
| 3584 | ||||||||||||||||||
| 411 | - | |||||||||||||||||||
| 412 | return executed 3584 times by 2 tests: 0;return 0;Executed by:
executed 3584 times by 2 tests: return 0;Executed by:
| 3584 | ||||||||||||||||||
| 413 | } | - | ||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | static void composeHelper(QString *str, QChar::UnicodeVersion version, int from) | - | ||||||||||||||||||
| 416 | { | - | ||||||||||||||||||
| 417 | QString &s = *str; | - | ||||||||||||||||||
| 418 | - | |||||||||||||||||||
| 419 | if (from < 0
| 0-74383 | ||||||||||||||||||
| 420 | return; executed 9562 times by 3 tests: return;Executed by:
| 9562 | ||||||||||||||||||
| 421 | - | |||||||||||||||||||
| 422 | uint stcode = 0; | - | ||||||||||||||||||
| 423 | int starter = -1; | - | ||||||||||||||||||
| 424 | int next = -1; | - | ||||||||||||||||||
| 425 | int lastCombining = 255; | - | ||||||||||||||||||
| 426 | - | |||||||||||||||||||
| 427 | int pos = from; | - | ||||||||||||||||||
| 428 | while (pos < s.length()
| 64821-218622 | ||||||||||||||||||
| 429 | int i = pos; | - | ||||||||||||||||||
| 430 | uint uc = s.at(pos).unicode(); | - | ||||||||||||||||||
| 431 | if (QChar(uc).isHighSurrogate()
| 0-216420 | ||||||||||||||||||
| 432 | ushort low = s.at(pos+1).unicode(); | - | ||||||||||||||||||
| 433 | if (QChar(low).isLowSurrogate()
| 0-2202 | ||||||||||||||||||
| 434 | uc = QChar::surrogateToUcs4(uc, low); | - | ||||||||||||||||||
| 435 | ++pos; | - | ||||||||||||||||||
| 436 | } executed 2202 times by 1 test: end of blockExecuted by:
| 2202 | ||||||||||||||||||
| 437 | } executed 2202 times by 1 test: end of blockExecuted by:
| 2202 | ||||||||||||||||||
| 438 | - | |||||||||||||||||||
| 439 | const QUnicodeTables::Properties *p = qGetProp(uc); | - | ||||||||||||||||||
| 440 | if (p->unicodeVersion > version
| 1-218621 | ||||||||||||||||||
| 441 | starter = -1; | - | ||||||||||||||||||
| 442 | next = -1; | - | ||||||||||||||||||
| 443 | lastCombining = 255; | - | ||||||||||||||||||
| 444 | ++pos; | - | ||||||||||||||||||
| 445 | continue; executed 1 time by 1 test: continue;Executed by:
| 1 | ||||||||||||||||||
| 446 | } | - | ||||||||||||||||||
| 447 | - | |||||||||||||||||||
| 448 | int combining = p->combiningClass; | - | ||||||||||||||||||
| 449 | if ((i == next
| 20-134593 | ||||||||||||||||||
| 450 | - | |||||||||||||||||||
| 451 | uint ligature = ligatureHelper(stcode, uc); | - | ||||||||||||||||||
| 452 | if (ligature
| 37158-97435 | ||||||||||||||||||
| 453 | stcode = ligature; | - | ||||||||||||||||||
| 454 | QChar *d = s.data(); | - | ||||||||||||||||||
| 455 | - | |||||||||||||||||||
| 456 | if (QChar::requiresSurrogates(ligature)
| 48-97387 | ||||||||||||||||||
| 457 | d[starter] = QChar::highSurrogate(ligature); | - | ||||||||||||||||||
| 458 | d[starter + 1] = QChar::lowSurrogate(ligature); | - | ||||||||||||||||||
| 459 | s.remove(i, 2); | - | ||||||||||||||||||
| 460 | } executed 48 times by 1 test: else {end of blockExecuted by:
| 48 | ||||||||||||||||||
| 461 | d[starter] = ligature; | - | ||||||||||||||||||
| 462 | s.remove(i, 1); | - | ||||||||||||||||||
| 463 | } executed 97387 times by 2 tests: end of blockExecuted by:
| 97387 | ||||||||||||||||||
| 464 | continue; executed 97435 times by 2 tests: continue;Executed by:
| 97435 | ||||||||||||||||||
| 465 | } | - | ||||||||||||||||||
| 466 | } executed 37158 times by 2 tests: end of blockExecuted by:
| 37158 | ||||||||||||||||||
| 467 | if (combining == 0
| 39313-81873 | ||||||||||||||||||
| 468 | starter = i; | - | ||||||||||||||||||
| 469 | stcode = uc; | - | ||||||||||||||||||
| 470 | next = pos + 1; | - | ||||||||||||||||||
| 471 | } executed 81873 times by 2 tests: end of blockExecuted by:
| 81873 | ||||||||||||||||||
| 472 | lastCombining = combining; | - | ||||||||||||||||||
| 473 | - | |||||||||||||||||||
| 474 | ++pos; | - | ||||||||||||||||||
| 475 | } executed 121186 times by 2 tests: end of blockExecuted by:
| 121186 | ||||||||||||||||||
| 476 | } executed 64821 times by 2 tests: end of blockExecuted by:
| 64821 | ||||||||||||||||||
| 477 | - | |||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | static void canonicalOrderHelper(QString *str, QChar::UnicodeVersion version, int from) | - | ||||||||||||||||||
| 480 | { | - | ||||||||||||||||||
| 481 | QString &s = *str; | - | ||||||||||||||||||
| 482 | const int l = s.length()-1; | - | ||||||||||||||||||
| 483 | - | |||||||||||||||||||
| 484 | uint u1, u2; | - | ||||||||||||||||||
| 485 | ushort c1, c2; | - | ||||||||||||||||||
| 486 | - | |||||||||||||||||||
| 487 | int pos = from; | - | ||||||||||||||||||
| 488 | while (pos < l
| 155015-174900 | ||||||||||||||||||
| 489 | int p2 = pos+1; | - | ||||||||||||||||||
| 490 | u1 = s.at(pos).unicode(); | - | ||||||||||||||||||
| 491 | if (QChar(u1).isHighSurrogate()
| 1554-173346 | ||||||||||||||||||
| 492 | ushort low = s.at(p2).unicode(); | - | ||||||||||||||||||
| 493 | if (QChar(low).isLowSurrogate()
| 0-1554 | ||||||||||||||||||
| 494 | u1 = QChar::surrogateToUcs4(u1, low); | - | ||||||||||||||||||
| 495 | if (p2 >= l
| 448-1106 | ||||||||||||||||||
| 496 | break; executed 448 times by 1 test: break;Executed by:
| 448 | ||||||||||||||||||
| 497 | ++p2; | - | ||||||||||||||||||
| 498 | } executed 1106 times by 1 test: end of blockExecuted by:
| 1106 | ||||||||||||||||||
| 499 | } executed 1106 times by 1 test: end of blockExecuted by:
| 1106 | ||||||||||||||||||
| 500 | c1 = 0; | - | ||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | advance: code before this statement executed 174452 times by 2 tests: advance:Executed by:
| 174452 | ||||||||||||||||||
| 503 | u2 = s.at(p2).unicode(); | - | ||||||||||||||||||
| 504 | if (QChar(u2).isHighSurrogate()
| 0-259567 | ||||||||||||||||||
| 505 | ushort low = s.at(p2+1).unicode(); | - | ||||||||||||||||||
| 506 | if (QChar(low).isLowSurrogate()
| 0-3518 | ||||||||||||||||||
| 507 | u2 = QChar::surrogateToUcs4(u2, low); | - | ||||||||||||||||||
| 508 | ++p2; | - | ||||||||||||||||||
| 509 | } executed 3518 times by 1 test: end of blockExecuted by:
| 3518 | ||||||||||||||||||
| 510 | } executed 3518 times by 1 test: end of blockExecuted by:
| 3518 | ||||||||||||||||||
| 511 | - | |||||||||||||||||||
| 512 | c2 = 0; | - | ||||||||||||||||||
| 513 | { | - | ||||||||||||||||||
| 514 | const QUnicodeTables::Properties *p = qGetProp(u2); | - | ||||||||||||||||||
| 515 | if (p->unicodeVersion <= version
| 0-263085 | ||||||||||||||||||
| 516 | c2 = p->combiningClass; executed 263085 times by 2 tests: c2 = p->combiningClass;Executed by:
| 263085 | ||||||||||||||||||
| 517 | } | - | ||||||||||||||||||
| 518 | if (c2 == 0
| 124633-138452 | ||||||||||||||||||
| 519 | pos = p2+1; | - | ||||||||||||||||||
| 520 | continue; executed 138452 times by 2 tests: continue;Executed by:
| 138452 | ||||||||||||||||||
| 521 | } | - | ||||||||||||||||||
| 522 | - | |||||||||||||||||||
| 523 | if (c1 == 0
| 52188-72445 | ||||||||||||||||||
| 524 | const QUnicodeTables::Properties *p = qGetProp(u1); | - | ||||||||||||||||||
| 525 | if (p->unicodeVersion <= version
| 1-52187 | ||||||||||||||||||
| 526 | c1 = p->combiningClass; executed 52187 times by 2 tests: c1 = p->combiningClass;Executed by:
| 52187 | ||||||||||||||||||
| 527 | } executed 52188 times by 2 tests: end of blockExecuted by:
| 52188 | ||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | if (c1 > c2
| 25412-99221 | ||||||||||||||||||
| 530 | QChar *uc = s.data(); | - | ||||||||||||||||||
| 531 | int p = pos; | - | ||||||||||||||||||
| 532 | - | |||||||||||||||||||
| 533 | if (!QChar::requiresSurrogates(u2)
| 516-24896 | ||||||||||||||||||
| 534 | uc[p++] = u2; | - | ||||||||||||||||||
| 535 | } executed 24896 times by 1 test: else {end of blockExecuted by:
| 24896 | ||||||||||||||||||
| 536 | uc[p++] = QChar::highSurrogate(u2); | - | ||||||||||||||||||
| 537 | uc[p++] = QChar::lowSurrogate(u2); | - | ||||||||||||||||||
| 538 | } executed 516 times by 1 test: end of blockExecuted by:
| 516 | ||||||||||||||||||
| 539 | if (!QChar::requiresSurrogates(u1)
| 432-24980 | ||||||||||||||||||
| 540 | uc[p++] = u1; | - | ||||||||||||||||||
| 541 | } executed 24980 times by 1 test: else {end of blockExecuted by:
| 24980 | ||||||||||||||||||
| 542 | uc[p++] = QChar::highSurrogate(u1); | - | ||||||||||||||||||
| 543 | uc[p++] = QChar::lowSurrogate(u1); | - | ||||||||||||||||||
| 544 | } executed 432 times by 1 test: end of blockExecuted by:
| 432 | ||||||||||||||||||
| 545 | if (pos > 0
| 12-25400 | ||||||||||||||||||
| 546 | -- executed 25400 times by 1 test: pos;--pos;Executed by:
executed 25400 times by 1 test: --pos;Executed by:
| 25400 | ||||||||||||||||||
| 547 | if (pos > 0
| 844-14708 | ||||||||||||||||||
| 548 | -- executed 844 times by 1 test: pos;--pos;Executed by:
executed 844 times by 1 test: --pos;Executed by:
| 844 | ||||||||||||||||||
| 549 | } executed 25412 times by 1 test: else {end of blockExecuted by:
| 25412 | ||||||||||||||||||
| 550 | ++pos; | - | ||||||||||||||||||
| 551 | if (QChar::requiresSurrogates(u1)
| 3308-95913 | ||||||||||||||||||
| 552 | ++ executed 3308 times by 1 test: pos;++pos;Executed by:
executed 3308 times by 1 test: ++pos;Executed by:
| 3308 | ||||||||||||||||||
| 553 | - | |||||||||||||||||||
| 554 | u1 = u2; | - | ||||||||||||||||||
| 555 | c1 = c2; | - | ||||||||||||||||||
| 556 | p2 = pos + 1; | - | ||||||||||||||||||
| 557 | if (QChar::requiresSurrogates(u1)
| 2822-96399 | ||||||||||||||||||
| 558 | ++ executed 2822 times by 1 test: p2;++p2;Executed by:
executed 2822 times by 1 test: ++p2;Executed by:
| 2822 | ||||||||||||||||||
| 559 | if (p2 > l
| 10588-88633 | ||||||||||||||||||
| 560 | break; executed 10588 times by 2 tests: break;Executed by:
| 10588 | ||||||||||||||||||
| 561 | - | |||||||||||||||||||
| 562 | goto executed 88633 times by 2 tests: advance;goto advance;Executed by:
executed 88633 times by 2 tests: goto advance;Executed by:
| 88633 | ||||||||||||||||||
| 563 | } | - | ||||||||||||||||||
| 564 | } | - | ||||||||||||||||||
| 565 | } executed 166051 times by 3 tests: end of blockExecuted by:
| 166051 | ||||||||||||||||||
| 566 | - | |||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | - | |||||||||||||||||||
| 569 | static bool normalizationQuickCheckHelper(QString *str, QString::NormalizationForm mode, int from, int *lastStable) | - | ||||||||||||||||||
| 570 | { | - | ||||||||||||||||||
| 571 | static_assert(bool(QString::NormalizationForm_D == 0), "QString::NormalizationForm_D == 0"); | - | ||||||||||||||||||
| 572 | static_assert(bool(QString::NormalizationForm_C == 1), "QString::NormalizationForm_C == 1"); | - | ||||||||||||||||||
| 573 | static_assert(bool(QString::NormalizationForm_KD == 2), "QString::NormalizationForm_KD == 2"); | - | ||||||||||||||||||
| 574 | static_assert(bool(QString::NormalizationForm_KC == 3), "QString::NormalizationForm_KC == 3"); | - | ||||||||||||||||||
| 575 | - | |||||||||||||||||||
| 576 | enum { NFQC_YES = 0, NFQC_NO = 1, NFQC_MAYBE = 3 }; | - | ||||||||||||||||||
| 577 | - | |||||||||||||||||||
| 578 | const ushort *string = reinterpret_cast<const ushort *>(str->constData()); | - | ||||||||||||||||||
| 579 | int length = str->length(); | - | ||||||||||||||||||
| 580 | - | |||||||||||||||||||
| 581 | - | |||||||||||||||||||
| 582 | while (length > from
| 1-566027 | ||||||||||||||||||
| 583 | -- executed 1 time by 1 test: length;--length;Executed by:
executed 1 time by 1 test: --length;Executed by:
| 1 | ||||||||||||||||||
| 584 | - | |||||||||||||||||||
| 585 | uchar lastCombining = 0; | - | ||||||||||||||||||
| 586 | for (int i = from; i < length
| 399976-1037340 | ||||||||||||||||||
| 587 | int pos = i; | - | ||||||||||||||||||
| 588 | uint uc = string[i]; | - | ||||||||||||||||||
| 589 | if (uc < 0x80
| 49201-988139 | ||||||||||||||||||
| 590 | - | |||||||||||||||||||
| 591 | lastCombining = 0; | - | ||||||||||||||||||
| 592 | *lastStable = pos; | - | ||||||||||||||||||
| 593 | continue; executed 49201 times by 6 tests: continue;Executed by:
| 49201 | ||||||||||||||||||
| 594 | } | - | ||||||||||||||||||
| 595 | - | |||||||||||||||||||
| 596 | if (QChar::isHighSurrogate(uc)
| 23838-964301 | ||||||||||||||||||
| 597 | ushort low = string[i + 1]; | - | ||||||||||||||||||
| 598 | if (!QChar::isLowSurrogate(low)
| 1-23837 | ||||||||||||||||||
| 599 | - | |||||||||||||||||||
| 600 | lastCombining = 0; | - | ||||||||||||||||||
| 601 | *lastStable = pos; | - | ||||||||||||||||||
| 602 | continue; executed 1 time by 1 test: continue;Executed by:
| 1 | ||||||||||||||||||
| 603 | } | - | ||||||||||||||||||
| 604 | ++i; | - | ||||||||||||||||||
| 605 | uc = QChar::surrogateToUcs4(uc, low); | - | ||||||||||||||||||
| 606 | } executed 23837 times by 3 tests: end of blockExecuted by:
| 23837 | ||||||||||||||||||
| 607 | - | |||||||||||||||||||
| 608 | const QUnicodeTables::Properties *p = qGetProp(uc); | - | ||||||||||||||||||
| 609 | - | |||||||||||||||||||
| 610 | if (p->combiningClass < lastCombining
| 2746-979710 | ||||||||||||||||||
| 611 | return executed 5682 times by 1 test: false;return false;Executed by:
executed 5682 times by 1 test: return false;Executed by:
| 5682 | ||||||||||||||||||
| 612 | - | |||||||||||||||||||
| 613 | const uchar check = (p->nfQuickCheck >> (mode << 1)) & 0x03; | - | ||||||||||||||||||
| 614 | if (check != NFQC_YES
| 160369-822087 | ||||||||||||||||||
| 615 | return executed 160369 times by 3 tests: false;return false;Executed by:
executed 160369 times by 3 tests: return false;Executed by:
| 160369 | ||||||||||||||||||
| 616 | - | |||||||||||||||||||
| 617 | lastCombining = p->combiningClass; | - | ||||||||||||||||||
| 618 | if (lastCombining == 0
| 87788-734299 | ||||||||||||||||||
| 619 | * executed 734299 times by 9 tests: lastStable = pos;*lastStable = pos;Executed by:
executed 734299 times by 9 tests: *lastStable = pos;Executed by:
| 734299 | ||||||||||||||||||
| 620 | } executed 822087 times by 9 tests: end of blockExecuted by:
| 822087 | ||||||||||||||||||
| 621 | - | |||||||||||||||||||
| 622 | if (length != str->length()
| 1-399975 | ||||||||||||||||||
| 623 | * executed 1 time by 1 test: lastStable = str->length() - 1;*lastStable = str->length() - 1;Executed by:
executed 1 time by 1 test: *lastStable = str->length() - 1;Executed by:
| 1 | ||||||||||||||||||
| 624 | - | |||||||||||||||||||
| 625 | return executed 399976 times by 9 tests: true;return true;Executed by:
executed 399976 times by 9 tests: return true;Executed by:
| 399976 | ||||||||||||||||||
| 626 | } | - | ||||||||||||||||||
| 627 | - | |||||||||||||||||||
| 628 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |