tools/qlocale_icu.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5typedef int32_t (*Ptr_u_strToCase)(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode); -
6 -
7 -
8static bool qt_u_strToCase(const QString &str, QString *out, const char *localeID, Ptr_u_strToCase caseFunc) -
9{ -
10 qt_noop(); -
11 -
12 int32_t size = str.size(); -
13 size += size >> 2; -
14 QString result(size, Qt::Uninitialized); -
15 -
16 UErrorCode status = U_ZERO_ERROR; -
17 -
18 size = caseFunc(reinterpret_cast<UChar *>(result.data()), result.size(), -
19 reinterpret_cast<const UChar *>(str.constData()), str.size(), -
20 localeID, &status); -
21 -
22 if (U_FAILURE(status) && status != U_BUFFER_OVERFLOW_ERROR)
partially evaluated: U_FAILURE(status)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
never evaluated: status != U_BUFFER_OVERFLOW_ERROR
0-8
23 return false;
never executed: return false;
0
24 -
25 if (size < result.size()) {
partially evaluated: size < result.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
26 result.resize(size); -
27 } else if (size > result.size()) {
never executed: }
partially evaluated: size > result.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
28 -
29 result.resize(size); -
30 -
31 status = U_ZERO_ERROR; -
32 size = caseFunc(reinterpret_cast<UChar *>(result.data()), result.size(), -
33 reinterpret_cast<const UChar *>(str.constData()), str.size(), -
34 localeID, &status); -
35 -
36 if (U_FAILURE(status))
never evaluated: U_FAILURE(status)
0
37 return false;
never executed: return false;
0
38 -
39 -
40 if (size != result.size())
never evaluated: size != result.size()
0
41 return false;
never executed: return false;
0
42 }
never executed: }
0
43 -
44 *out = result; -
45 return true;
executed: return true;
Execution Count:8
8
46} -
47 -
48QString QIcu::toUpper(const QByteArray &localeID, const QString &str, bool *ok) -
49{ -
50 QString out; -
51 bool err = qt_u_strToCase(str, &out, localeID, u_strToUpper_44); -
52 if (ok)
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
53 *ok = err;
executed: *ok = err;
Execution Count:3
3
54 return out;
executed: return out;
Execution Count:3
3
55} -
56 -
57QString QIcu::toLower(const QByteArray &localeID, const QString &str, bool *ok) -
58{ -
59 QString out; -
60 bool err = qt_u_strToCase(str, &out, localeID, u_strToLower_44); -
61 if (ok)
partially evaluated: ok
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
62 *ok = err;
executed: *ok = err;
Execution Count:5
5
63 return out;
executed: return out;
Execution Count:5
5
64} -
65 -
66 -
67 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial