| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | static inline bool caseInsensitiveLessThan(const QString &s1, const QString &s2) | - |
| 4 | { | - |
| 5 | return s1.compare(s2, Qt::CaseInsensitive) < 0; executed: return s1.compare(s2, Qt::CaseInsensitive) < 0;Execution Count:16 | 16 |
| 6 | } | - |
| 7 | | - |
| 8 | void QtPrivate::QStringList_sort(QStringList *that, Qt::CaseSensitivity cs) | - |
| 9 | { | - |
| 10 | if (cs == Qt::CaseSensitive) evaluated: cs == Qt::CaseSensitive| yes Evaluation Count:150 | yes Evaluation Count:1 |
| 1-150 |
| 11 | qSort(that->begin(), that->end()); executed: qSort(that->begin(), that->end());Execution Count:150 | 150 |
| 12 | else | - |
| 13 | qSort(that->begin(), that->end(), caseInsensitiveLessThan); executed: qSort(that->begin(), that->end(), caseInsensitiveLessThan);Execution Count:1 | 1 |
| 14 | } | - |
| 15 | QStringList QtPrivate::QStringList_filter(const QStringList *that, const QString &str, | - |
| 16 | Qt::CaseSensitivity cs) | - |
| 17 | { | - |
| 18 | QStringMatcher matcher(str, cs); | - |
| 19 | QStringList res; | - |
| 20 | for (int i = 0; i < that->size(); ++i) evaluated: i < that->size()| yes Evaluation Count:1522 | yes Evaluation Count:130 |
| 130-1522 |
| 21 | if (matcher.indexIn(that->at(i)) != -1) evaluated: matcher.indexIn(that->at(i)) != -1| yes Evaluation Count:162 | yes Evaluation Count:1360 |
| 162-1360 |
| 22 | res << that->at(i); executed: res << that->at(i);Execution Count:162 | 162 |
| 23 | return res; executed: return res;Execution Count:130 | 130 |
| 24 | } | - |
| 25 | bool QtPrivate::QStringList_contains(const QStringList *that, const QString &str, | - |
| 26 | Qt::CaseSensitivity cs) | - |
| 27 | { | - |
| 28 | for (int i = 0; i < that->size(); ++i) { evaluated: i < that->size()| yes Evaluation Count:7797790 | yes Evaluation Count:64334 |
| 64334-7797790 |
| 29 | const QString & string = that->at(i); | - |
| 30 | if (string.length() == str.length() && str.compare(string, cs) == 0) evaluated: string.length() == str.length()| yes Evaluation Count:934389 | yes Evaluation Count:6862918 |
evaluated: str.compare(string, cs) == 0| yes Evaluation Count:148864 | yes Evaluation Count:785559 |
| 148864-6862918 |
| 31 | return true; executed: return true;Execution Count:148865 | 148865 |
| 32 | } executed: }Execution Count:7648832 | 7648832 |
| 33 | return false; executed: return false;Execution Count:64334 | 64334 |
| 34 | } | - |
| 35 | QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegExp &rx) | - |
| 36 | { | - |
| 37 | QStringList res; | - |
| 38 | for (int i = 0; i < that->size(); ++i) evaluated: i < that->size()| yes Evaluation Count:25 | yes Evaluation Count:2 |
| 2-25 |
| 39 | if (that->at(i).contains(rx)) evaluated: that->at(i).contains(rx)| yes Evaluation Count:3 | yes Evaluation Count:22 |
| 3-22 |
| 40 | res << that->at(i); executed: res << that->at(i);Execution Count:3 | 3 |
| 41 | return res; executed: return res;Execution Count:2 | 2 |
| 42 | } | - |
| 43 | QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegularExpression &re) | - |
| 44 | { | - |
| 45 | QStringList res; | - |
| 46 | for (int i = 0; i < that->size(); ++i) { evaluated: i < that->size()| yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
| 47 | if (that->at(i).contains(re)) evaluated: that->at(i).contains(re)| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
| 48 | res << that->at(i); executed: res << that->at(i);Execution Count:2 | 2 |
| 49 | } executed: }Execution Count:3 | 3 |
| 50 | return res; executed: return res;Execution Count:1 | 1 |
| 51 | } | - |
| 52 | void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QString &before, | - |
| 53 | const QString &after, Qt::CaseSensitivity cs) | - |
| 54 | { | - |
| 55 | for (int i = 0; i < that->size(); ++i) evaluated: i < that->size()| yes Evaluation Count:18 | yes Evaluation Count:3 |
| 3-18 |
| 56 | (*that)[i].replace(before, after, cs); executed: (*that)[i].replace(before, after, cs);Execution Count:18 | 18 |
| 57 | } executed: }Execution Count:3 | 3 |
| 58 | void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &rx, const QString &after) | - |
| 59 | { | - |
| 60 | for (int i = 0; i < that->size(); ++i) evaluated: i < that->size()| yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
| 61 | (*that)[i].replace(rx, after); executed: (*that)[i].replace(rx, after);Execution Count:6 | 6 |
| 62 | } executed: }Execution Count:2 | 2 |
| 63 | void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularExpression &re, const QString &after) | - |
| 64 | { | - |
| 65 | for (int i = 0; i < that->size(); ++i) evaluated: i < that->size()| yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
| 66 | (*that)[i].replace(re, after); executed: (*that)[i].replace(re, after);Execution Count:6 | 6 |
| 67 | } executed: }Execution Count:2 | 2 |
| 68 | QString QtPrivate::QStringList_join(const QStringList *that, const QChar *sep, int seplen) | - |
| 69 | { | - |
| 70 | int totalLength = 0; | - |
| 71 | const int size = that->size(); | - |
| 72 | | - |
| 73 | for (int i = 0; i < size; ++i) evaluated: i < size| yes Evaluation Count:28250 | yes Evaluation Count:5370 |
| 5370-28250 |
| 74 | totalLength += that->at(i).size(); executed: totalLength += that->at(i).size();Execution Count:28250 | 28250 |
| 75 | | - |
| 76 | if(size > 0) evaluated: size > 0| yes Evaluation Count:5196 | yes Evaluation Count:174 |
| 174-5196 |
| 77 | totalLength += seplen * (size - 1); executed: totalLength += seplen * (size - 1);Execution Count:5196 | 5196 |
| 78 | | - |
| 79 | QString res; | - |
| 80 | if (totalLength == 0) evaluated: totalLength == 0| yes Evaluation Count:175 | yes Evaluation Count:5195 |
| 175-5195 |
| 81 | return res; executed: return res;Execution Count:175 | 175 |
| 82 | res.reserve(totalLength); | - |
| 83 | for (int i = 0; i < that->size(); ++i) { evaluated: i < that->size()| yes Evaluation Count:28249 | yes Evaluation Count:5195 |
| 5195-28249 |
| 84 | if (i) evaluated: i| yes Evaluation Count:23054 | yes Evaluation Count:5195 |
| 5195-23054 |
| 85 | res.append(sep, seplen); executed: res.append(sep, seplen);Execution Count:23054 | 23054 |
| 86 | res += that->at(i); | - |
| 87 | } executed: }Execution Count:28249 | 28249 |
| 88 | return res; executed: return res;Execution Count:5195 | 5195 |
| 89 | } | - |
| 90 | static int indexOfMutating(const QStringList *that, QRegExp &rx, int from) | - |
| 91 | { | - |
| 92 | if (from < 0) evaluated: from < 0| yes Evaluation Count:3 | yes Evaluation Count:8 |
| 3-8 |
| 93 | from = qMax(from + that->size(), 0); executed: from = qMax(from + that->size(), 0);Execution Count:3 | 3 |
| 94 | for (int i = from; i < that->size(); ++i) { evaluated: i < that->size()| yes Evaluation Count:50 | yes Evaluation Count:6 |
| 6-50 |
| 95 | if (rx.exactMatch(that->at(i))) evaluated: rx.exactMatch(that->at(i))| yes Evaluation Count:5 | yes Evaluation Count:45 |
| 5-45 |
| 96 | return i; executed: return i;Execution Count:5 | 5 |
| 97 | } executed: }Execution Count:45 | 45 |
| 98 | return -1; executed: return -1;Execution Count:6 | 6 |
| 99 | } | - |
| 100 | | - |
| 101 | static int lastIndexOfMutating(const QStringList *that, QRegExp &rx, int from) | - |
| 102 | { | - |
| 103 | if (from < 0) evaluated: from < 0| yes Evaluation Count:6 | yes Evaluation Count:3 |
| 3-6 |
| 104 | from += that->size(); executed: from += that->size();Execution Count:6 | 6 |
| 105 | else if (from >= that->size()) evaluated: from >= that->size()| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 106 | from = that->size() - 1; executed: from = that->size() - 1;Execution Count:1 | 1 |
| 107 | for (int i = from; i >= 0; --i) { evaluated: i >= 0| yes Evaluation Count:17 | yes Evaluation Count:3 |
| 3-17 |
| 108 | if (rx.exactMatch(that->at(i))) evaluated: rx.exactMatch(that->at(i))| yes Evaluation Count:6 | yes Evaluation Count:11 |
| 6-11 |
| 109 | return i; executed: return i;Execution Count:6 | 6 |
| 110 | } executed: }Execution Count:11 | 11 |
| 111 | return -1; executed: return -1;Execution Count:3 | 3 |
| 112 | } | - |
| 113 | int QtPrivate::QStringList_indexOf(const QStringList *that, const QRegExp &rx, int from) | - |
| 114 | { | - |
| 115 | QRegExp rx2(rx); | - |
| 116 | return indexOfMutating(that, rx2, from); executed: return indexOfMutating(that, rx2, from);Execution Count:2 | 2 |
| 117 | } | - |
| 118 | int QtPrivate::QStringList_indexOf(const QStringList *that, QRegExp &rx, int from) | - |
| 119 | { | - |
| 120 | return indexOfMutating(that, rx, from); executed: return indexOfMutating(that, rx, from);Execution Count:9 | 9 |
| 121 | } | - |
| 122 | int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegExp &rx, int from) | - |
| 123 | { | - |
| 124 | QRegExp rx2(rx); | - |
| 125 | return lastIndexOfMutating(that, rx2, from); executed: return lastIndexOfMutating(that, rx2, from);Execution Count:2 | 2 |
| 126 | } | - |
| 127 | int QtPrivate::QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int from) | - |
| 128 | { | - |
| 129 | return lastIndexOfMutating(that, rx, from); executed: return lastIndexOfMutating(that, rx, from);Execution Count:7 | 7 |
| 130 | } | - |
| 131 | int QtPrivate::QStringList_indexOf(const QStringList *that, const QRegularExpression &re, int from) | - |
| 132 | { | - |
| 133 | if (from < 0) evaluated: from < 0| yes Evaluation Count:3 | yes Evaluation Count:6 |
| 3-6 |
| 134 | from = qMax(from + that->size(), 0); executed: from = qMax(from + that->size(), 0);Execution Count:3 | 3 |
| 135 | | - |
| 136 | QString exactPattern = QLatin1String("\\A(?:") + re.pattern() + QLatin1String(")\\z"); | - |
| 137 | QRegularExpression exactRe(exactPattern, re.patternOptions()); | - |
| 138 | | - |
| 139 | for (int i = from; i < that->size(); ++i) { evaluated: i < that->size()| yes Evaluation Count:16 | yes Evaluation Count:5 |
| 5-16 |
| 140 | QRegularExpressionMatch m = exactRe.match(that->at(i)); | - |
| 141 | if (m.hasMatch()) evaluated: m.hasMatch()| yes Evaluation Count:4 | yes Evaluation Count:12 |
| 4-12 |
| 142 | return i; executed: return i;Execution Count:4 | 4 |
| 143 | } executed: }Execution Count:12 | 12 |
| 144 | return -1; executed: return -1;Execution Count:5 | 5 |
| 145 | } | - |
| 146 | int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, int from) | - |
| 147 | { | - |
| 148 | if (from < 0) evaluated: from < 0| yes Evaluation Count:6 | yes Evaluation Count:3 |
| 3-6 |
| 149 | from += that->size(); executed: from += that->size();Execution Count:6 | 6 |
| 150 | else if (from >= that->size()) evaluated: from >= that->size()| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
| 151 | from = that->size() - 1; executed: from = that->size() - 1;Execution Count:1 | 1 |
| 152 | | - |
| 153 | QString exactPattern = QLatin1String("\\A(?:") + re.pattern() + QLatin1String(")\\z"); | - |
| 154 | QRegularExpression exactRe(exactPattern, re.patternOptions()); | - |
| 155 | | - |
| 156 | for (int i = from; i >= 0; --i) { evaluated: i >= 0| yes Evaluation Count:17 | yes Evaluation Count:3 |
| 3-17 |
| 157 | QRegularExpressionMatch m = exactRe.match(that->at(i)); | - |
| 158 | if (m.hasMatch()) evaluated: m.hasMatch()| yes Evaluation Count:6 | yes Evaluation Count:11 |
| 6-11 |
| 159 | return i; executed: return i;Execution Count:6 | 6 |
| 160 | } executed: }Execution Count:11 | 11 |
| 161 | return -1; executed: return -1;Execution Count:3 | 3 |
| 162 | } | - |
| 163 | int QtPrivate::QStringList_removeDuplicates(QStringList *that) | - |
| 164 | { | - |
| 165 | int n = that->size(); | - |
| 166 | int j = 0; | - |
| 167 | QSet<QString> seen; | - |
| 168 | seen.reserve(n); | - |
| 169 | for (int i = 0; i < n; ++i) { evaluated: i < n| yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
| 170 | const QString &s = that->at(i); | - |
| 171 | if (seen.contains(s)) evaluated: seen.contains(s)| yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
| 172 | continue; executed: continue;Execution Count:1 | 1 |
| 173 | seen.insert(s); | - |
| 174 | if (j != i) partially evaluated: j != i| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 175 | (*that)[j] = s; never executed: (*that)[j] = s; | 0 |
| 176 | ++j; | - |
| 177 | } executed: }Execution Count:3 | 3 |
| 178 | if (n != j) evaluated: n != j| yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
| 179 | that->erase(that->begin() + j, that->end()); executed: that->erase(that->begin() + j, that->end());Execution Count:1 | 1 |
| 180 | return n - j; executed: return n - j;Execution Count:2 | 2 |
| 181 | } | - |
| 182 | | - |
| 183 | | - |
| | |