| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qlocale_icu.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | typedef int32_t (*Ptr_u_strToCase)(UChar *dest, int32_t destCapacity, const UChar *src, int32_t srcLength, const char *locale, UErrorCode *pErrorCode); | - | ||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | static bool qt_u_strToCase(const QString &str, QString *out, const char *localeID, Ptr_u_strToCase caseFunc) | - | ||||||||||||
| 10 | { | - | ||||||||||||
| 11 | ((!(out)) ? qt_assert("out",__FILE__,50) : qt_noop()); | - | ||||||||||||
| 12 | - | |||||||||||||
| 13 | int32_t size = str.size(); | - | ||||||||||||
| 14 | size += size >> 2; | - | ||||||||||||
| 15 | QString result(size, Qt::Uninitialized); | - | ||||||||||||
| 16 | - | |||||||||||||
| 17 | UErrorCode status = U_ZERO_ERROR; | - | ||||||||||||
| 18 | - | |||||||||||||
| 19 | size = caseFunc(reinterpret_cast<UChar *>(result.data()), result.size(), | - | ||||||||||||
| 20 | reinterpret_cast<const UChar *>(str.constData()), str.size(), | - | ||||||||||||
| 21 | localeID, &status); | - | ||||||||||||
| 22 | - | |||||||||||||
| 23 |     if (U_FAILURE(status)
 
  | 0-8 | ||||||||||||
| 24 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||
| 25 | - | |||||||||||||
| 26 |     if (size < result.size()
  | 0-8 | ||||||||||||
| 27 | result.resize(size); | - | ||||||||||||
| 28 |     } never executed:   else if (size > result.size()end of block
  | 0-8 | ||||||||||||
| 29 | - | |||||||||||||
| 30 | result.resize(size); | - | ||||||||||||
| 31 | - | |||||||||||||
| 32 | status = U_ZERO_ERROR; | - | ||||||||||||
| 33 | size = caseFunc(reinterpret_cast<UChar *>(result.data()), result.size(), | - | ||||||||||||
| 34 | reinterpret_cast<const UChar *>(str.constData()), str.size(), | - | ||||||||||||
| 35 | localeID, &status); | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 |         if (U_FAILURE(status)
  | 0 | ||||||||||||
| 38 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||
| 39 | - | |||||||||||||
| 40 | - | |||||||||||||
| 41 |         if (size != result.size()
  | 0 | ||||||||||||
| 42 |             return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||
| 43 |     } never executed:  end of block | 0 | ||||||||||||
| 44 | - | |||||||||||||
| 45 | *out = result; | - | ||||||||||||
| 46 |     return executed 8 times by 1 test:   true;return true;Executed by: 
 executed 8 times by 1 test:  return true;Executed by: 
  | 8 | ||||||||||||
| 47 | } | - | ||||||||||||
| 48 | - | |||||||||||||
| 49 | QString QIcu::toUpper(const QByteArray &localeID, const QString &str, bool *ok) | - | ||||||||||||
| 50 | { | - | ||||||||||||
| 51 | QString out; | - | ||||||||||||
| 52 | bool err = qt_u_strToCase(str, &out, localeID, u_strToUpper_52); | - | ||||||||||||
| 53 |     if (ok
  | 0-3 | ||||||||||||
| 54 |         * executed 3 times by 1 test:  ok = err;*ok = err;Executed by: 
 executed 3 times by 1 test:  *ok = err;Executed by: 
  | 3 | ||||||||||||
| 55 |     return executed 3 times by 1 test:   out;return out;Executed by: 
 executed 3 times by 1 test:  return out;Executed by: 
  | 3 | ||||||||||||
| 56 | } | - | ||||||||||||
| 57 | - | |||||||||||||
| 58 | QString QIcu::toLower(const QByteArray &localeID, const QString &str, bool *ok) | - | ||||||||||||
| 59 | { | - | ||||||||||||
| 60 | QString out; | - | ||||||||||||
| 61 | bool err = qt_u_strToCase(str, &out, localeID, u_strToLower_52); | - | ||||||||||||
| 62 |     if (ok
  | 0-5 | ||||||||||||
| 63 |         * executed 5 times by 1 test:  ok = err;*ok = err;Executed by: 
 executed 5 times by 1 test:  *ok = err;Executed by: 
  | 5 | ||||||||||||
| 64 |     return executed 5 times by 1 test:   out;return out;Executed by: 
 executed 5 times by 1 test:  return out;Executed by: 
  | 5 | ||||||||||||
| 65 | } | - | ||||||||||||
| 66 | - | |||||||||||||
| 67 | - | |||||||||||||
| Switch to Source code | Preprocessed file |