OpenCoverage

qcollator_icu.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qcollator_icu.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9void QCollatorPrivate::init()-
10{-
11 cleanup();-
12-
13 UErrorCode status = U_ZERO_ERROR;-
14 QByteArray name = locale.bcp47Name().replace(QLatin1Char('-'), QLatin1Char('_')).toLatin1();-
15 collator = ucol_open_52(name.constData(), &status);-
16 if (U_FAILURE(status)
U_FAILURE(status)Description
TRUEnever evaluated
FALSEevaluated 336 times by 13 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
) {
0-336
17 QMessageLogger(__FILE__, 62, __PRETTY_FUNCTION__).warning("Could not create collator: %d", status);-
18 collator = 0;-
19 dirty = false;-
20 return;
never executed: return;
0
21 }-
22-
23-
24 ucol_setAttribute_52(collator, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);-
25 UColAttributeValue val = (
(caseSensitivi...CaseSensitive)Description
TRUEevaluated 198 times by 13 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
FALSEevaluated 138 times by 6 tests
Evaluated by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
caseSensitivity == Qt::CaseSensitive)
(caseSensitivi...CaseSensitive)Description
TRUEevaluated 198 times by 13 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
FALSEevaluated 138 times by 6 tests
Evaluated by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
? UCOL_DEFAULT_STRENGTH : UCOL_SECONDARY;
138-198
26-
27 status = U_ZERO_ERROR;-
28 ucol_setAttribute_52(collator, UCOL_STRENGTH, val, &status);-
29 if (U_FAILURE(status)
U_FAILURE(status)Description
TRUEnever evaluated
FALSEevaluated 336 times by 13 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
)
0-336
30 QMessageLogger(__FILE__, 83, __PRETTY_FUNCTION__).warning("ucol_setAttribute: Case First failed: %d", status);
never executed: QMessageLogger(__FILE__, 83, __PRETTY_FUNCTION__).warning("ucol_setAttribute: Case First failed: %d", status);
0
31-
32 status = U_ZERO_ERROR;-
33 ucol_setAttribute_52(collator, UCOL_NUMERIC_COLLATION, numericMode ? UCOL_ON : UCOL_OFF, &status);-
34 if (U_FAILURE(status)
U_FAILURE(status)Description
TRUEnever evaluated
FALSEevaluated 336 times by 13 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
)
0-336
35 QMessageLogger(__FILE__, 88, __PRETTY_FUNCTION__).warning("ucol_setAttribute: numeric collation failed: %d", status);
never executed: QMessageLogger(__FILE__, 88, __PRETTY_FUNCTION__).warning("ucol_setAttribute: numeric collation failed: %d", status);
0
36-
37 status = U_ZERO_ERROR;-
38 ucol_setAttribute_52(collator, UCOL_ALTERNATE_HANDLING, ignorePunctuation ? UCOL_SHIFTED : UCOL_NON_IGNORABLE, &status);-
39 if (U_FAILURE(status)
U_FAILURE(status)Description
TRUEnever evaluated
FALSEevaluated 336 times by 13 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
)
0-336
40 QMessageLogger(__FILE__, 93, __PRETTY_FUNCTION__).warning("ucol_setAttribute: Alternate handling failed: %d", status);
never executed: QMessageLogger(__FILE__, 93, __PRETTY_FUNCTION__).warning("ucol_setAttribute: Alternate handling failed: %d", status);
0
41-
42 dirty = false;-
43}
executed 336 times by 13 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
336
44-
45void QCollatorPrivate::cleanup()-
46{-
47 if (collator
collatorDescription
TRUEevaluated 336 times by 13 tests
Evaluated by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
  • tst_languageChange
  • tst_modeltest - unknown status
  • tst_qitemmodel - unknown status
  • tst_qlistwidget - unknown status
  • tst_qtablewidget - unknown status
  • tst_qtreewidget - unknown status
  • tst_qtreewidgetitemiterator - unknown status
FALSEevaluated 386 times by 13 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
)
336-386
48 ucol_close_52(collator);
executed 336 times by 13 tests: ucol_close_52(collator);
Executed by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
  • tst_languageChange
  • tst_modeltest - unknown status
  • tst_qitemmodel - unknown status
  • tst_qlistwidget - unknown status
  • tst_qtablewidget - unknown status
  • tst_qtreewidget - unknown status
  • tst_qtreewidgetitemiterator - unknown status
336
49 collator = 0;-
50}
executed 722 times by 19 tests: end of block
Executed by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
  • tst_languageChange
  • tst_modeltest - unknown status
  • tst_qitemmodel - unknown status
  • tst_qlistwidget - unknown status
  • tst_qtablewidget - unknown status
  • tst_qtreewidget - unknown status
  • tst_qtreewidgetitemiterator - unknown status
722
51-
52int QCollator::compare(const QChar *s1, int len1, const QChar *s2, int len2) const-
53{-
54 if (d->dirty
d->dirtyDescription
TRUEevaluated 143 times by 6 tests
Evaluated by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
FALSEevaluated 18877 times by 12 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
)
143-18877
55 d->init();
executed 143 times by 6 tests: d->init();
Executed by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
143
56-
57 if (d->collator
d->collatorDescription
TRUEevaluated 19020 times by 12 tests
Evaluated by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
FALSEnever evaluated
)
0-19020
58 return
executed 19020 times by 12 tests: return ucol_strcoll_52(d->collator, (const UChar *)s1, len1, (const UChar *)s2, len2);
Executed by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
ucol_strcoll_52(d->collator, (const UChar *)s1, len1, (const UChar *)s2, len2);
executed 19020 times by 12 tests: return ucol_strcoll_52(d->collator, (const UChar *)s1, len1, (const UChar *)s2, len2);
Executed by:
  • tst_ModelTest
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QItemModel
  • tst_QListWidget
  • tst_QPrinter
  • tst_QTableWidget
  • tst_QTreeWidget
  • tst_QTreeWidgetItemIterator
19020
59-
60 return
never executed: return QString::compare(QString(s1, len1), QString(s2, len2), d->caseSensitivity);
QString::compare(QString(s1, len1), QString(s2, len2), d->caseSensitivity);
never executed: return QString::compare(QString(s1, len1), QString(s2, len2), d->caseSensitivity);
0
61}-
62-
63int QCollator::compare(const QString &s1, const QString &s2) const-
64{-
65 if (d->collator
d->collatorDescription
TRUEevaluated 7625 times by 6 tests
Evaluated by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
FALSEnever evaluated
)
0-7625
66 return
executed 7625 times by 6 tests: return compare(s1.constData(), s1.size(), s2.constData(), s2.size());
Executed by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
compare(s1.constData(), s1.size(), s2.constData(), s2.size());
executed 7625 times by 6 tests: return compare(s1.constData(), s1.size(), s2.constData(), s2.size());
Executed by:
  • tst_QCollator
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QPrinter
7625
67-
68 return
never executed: return QString::compare(s1, s2, d->caseSensitivity);
QString::compare(s1, s2, d->caseSensitivity);
never executed: return QString::compare(s1, s2, d->caseSensitivity);
0
69}-
70-
71int QCollator::compare(const QStringRef &s1, const QStringRef &s2) const-
72{-
73 if (d->collator
d->collatorDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
74 return
never executed: return compare(s1.constData(), s1.size(), s2.constData(), s2.size());
compare(s1.constData(), s1.size(), s2.constData(), s2.size());
never executed: return compare(s1.constData(), s1.size(), s2.constData(), s2.size());
0
75-
76 return
never executed: return QStringRef::compare(s1, s2, d->caseSensitivity);
QStringRef::compare(s1, s2, d->caseSensitivity);
never executed: return QStringRef::compare(s1, s2, d->caseSensitivity);
0
77}-
78-
79QCollatorSortKey QCollator::sortKey(const QString &string) const-
80{-
81 if (d->dirty
d->dirtyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
82 d->init();
never executed: d->init();
0
83-
84 if (d->collator
d->collatorDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
85 QByteArray result(16 + string.size() + (string.size() >> 2), Qt::Uninitialized);-
86 int size = ucol_getSortKey_52(d->collator, (const UChar *)string.constData(),-
87 string.size(), (uint8_t *)result.data(), result.size());-
88 if (size > result.size()
size > result.size()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
89 result.resize(size);-
90 size = ucol_getSortKey_52(d->collator, (const UChar *)string.constData(),-
91 string.size(), (uint8_t *)result.data(), result.size());-
92 }
never executed: end of block
0
93 result.truncate(size);-
94 return
never executed: return QCollatorSortKey(new QCollatorSortKeyPrivate(result));
QCollatorSortKey(new QCollatorSortKeyPrivate(result));
never executed: return QCollatorSortKey(new QCollatorSortKeyPrivate(result));
0
95 }-
96-
97 return
never executed: return QCollatorSortKey(new QCollatorSortKeyPrivate(QByteArray()));
QCollatorSortKey(new QCollatorSortKeyPrivate(QByteArray()));
never executed: return QCollatorSortKey(new QCollatorSortKeyPrivate(QByteArray()));
0
98}-
99-
100int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const-
101{-
102 return
never executed: return qstrcmp(d->m_key, otherKey.d->m_key);
qstrcmp(d->m_key, otherKey.d->m_key);
never executed: return qstrcmp(d->m_key, otherKey.d->m_key);
0
103}-
104-
105-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9