| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | QFileSystemEntry::QFileSystemEntry() | - |
| 8 | : m_lastSeparator(-1), | - |
| 9 | m_firstDotInFileName(-1), | - |
| 10 | m_lastDotInFileName(-1) | - |
| 11 | { | - |
| 12 | } executed: }Execution Count:171176 | 171176 |
| 13 | | - |
| 14 | | - |
| 15 | | - |
| 16 | | - |
| 17 | | - |
| 18 | | - |
| 19 | QFileSystemEntry::QFileSystemEntry(const QString &filePath) | - |
| 20 | : m_filePath(QDir::fromNativeSeparators(filePath)), | - |
| 21 | m_lastSeparator(-2), | - |
| 22 | m_firstDotInFileName(-2), | - |
| 23 | m_lastDotInFileName(0) | - |
| 24 | { | - |
| 25 | } executed: }Execution Count:97523 | 97523 |
| 26 | | - |
| 27 | | - |
| 28 | | - |
| 29 | | - |
| 30 | | - |
| 31 | | - |
| 32 | QFileSystemEntry::QFileSystemEntry(const QString &filePath, FromInternalPath ) | - |
| 33 | : m_filePath(filePath), | - |
| 34 | m_lastSeparator(-2), | - |
| 35 | m_firstDotInFileName(-2), | - |
| 36 | m_lastDotInFileName(0) | - |
| 37 | { | - |
| 38 | } executed: }Execution Count:11799 | 11799 |
| 39 | | - |
| 40 | | - |
| 41 | | - |
| 42 | | - |
| 43 | | - |
| 44 | QFileSystemEntry::QFileSystemEntry(const NativePath &nativeFilePath, FromNativePath ) | - |
| 45 | : m_nativeFilePath(nativeFilePath), | - |
| 46 | m_lastSeparator(-2), | - |
| 47 | m_firstDotInFileName(-2), | - |
| 48 | m_lastDotInFileName(0) | - |
| 49 | { | - |
| 50 | } executed: }Execution Count:90742 | 90742 |
| 51 | | - |
| 52 | QFileSystemEntry::QFileSystemEntry(const QString &filePath, const NativePath &nativeFilePath) | - |
| 53 | : m_filePath(QDir::fromNativeSeparators(filePath)), | - |
| 54 | m_nativeFilePath(nativeFilePath), | - |
| 55 | m_lastSeparator(-2), | - |
| 56 | m_firstDotInFileName(-2), | - |
| 57 | m_lastDotInFileName(0) | - |
| 58 | { | - |
| 59 | } | 0 |
| 60 | | - |
| 61 | QString QFileSystemEntry::filePath() const | - |
| 62 | { | - |
| 63 | resolveFilePath(); | - |
| 64 | return m_filePath; executed: return m_filePath;Execution Count:336226 | 336226 |
| 65 | } | - |
| 66 | | - |
| 67 | QFileSystemEntry::NativePath QFileSystemEntry::nativeFilePath() const | - |
| 68 | { | - |
| 69 | resolveNativeFilePath(); | - |
| 70 | return m_nativeFilePath; executed: return m_nativeFilePath;Execution Count:136123 | 136123 |
| 71 | } | - |
| 72 | | - |
| 73 | void QFileSystemEntry::resolveFilePath() const | - |
| 74 | { | - |
| 75 | if (m_filePath.isEmpty() && !m_nativeFilePath.isEmpty()) { evaluated: m_filePath.isEmpty()| yes Evaluation Count:177645 | yes Evaluation Count:468964 |
evaluated: !m_nativeFilePath.isEmpty()| yes Evaluation Count:176989 | yes Evaluation Count:655 |
| 655-468964 |
| 76 | m_filePath = QDir::fromNativeSeparators(QFile::decodeName(m_nativeFilePath)); | - |
| 77 | | - |
| 78 | } executed: }Execution Count:176974 | 176974 |
| 79 | } executed: }Execution Count:646437 | 646437 |
| 80 | | - |
| 81 | void QFileSystemEntry::resolveNativeFilePath() const | - |
| 82 | { | - |
| 83 | if (!m_filePath.isEmpty() && m_nativeFilePath.isEmpty()) { evaluated: !m_filePath.isEmpty()| yes Evaluation Count:135420 | yes Evaluation Count:701 |
evaluated: m_nativeFilePath.isEmpty()| yes Evaluation Count:47036 | yes Evaluation Count:88385 |
| 701-135420 |
| 84 | m_nativeFilePath = QFile::encodeName(QDir::toNativeSeparators(m_filePath)); | - |
| 85 | | - |
| 86 | } executed: }Execution Count:47037 | 47037 |
| 87 | } executed: }Execution Count:136123 | 136123 |
| 88 | | - |
| 89 | QString QFileSystemEntry::fileName() const | - |
| 90 | { | - |
| 91 | findLastSeparator(); | - |
| 92 | | - |
| 93 | | - |
| 94 | | - |
| 95 | | - |
| 96 | return m_filePath.mid(m_lastSeparator + 1); executed: return m_filePath.mid(m_lastSeparator + 1);Execution Count:265141 | 265141 |
| 97 | } | - |
| 98 | | - |
| 99 | QString QFileSystemEntry::path() const | - |
| 100 | { | - |
| 101 | findLastSeparator(); | - |
| 102 | if (m_lastSeparator == -1) { evaluated: m_lastSeparator == -1| yes Evaluation Count:206 | yes Evaluation Count:10333 |
| 206-10333 |
| 103 | | - |
| 104 | | - |
| 105 | | - |
| 106 | | - |
| 107 | return QString(QLatin1Char('.')); executed: return QString(QLatin1Char('.'));Execution Count:206 | 206 |
| 108 | } | - |
| 109 | if (m_lastSeparator == 0) evaluated: m_lastSeparator == 0| yes Evaluation Count:944 | yes Evaluation Count:9389 |
| 944-9389 |
| 110 | return QString(QLatin1Char('/')); executed: return QString(QLatin1Char('/'));Execution Count:944 | 944 |
| 111 | | - |
| 112 | | - |
| 113 | | - |
| 114 | | - |
| 115 | return m_filePath.left(m_lastSeparator); executed: return m_filePath.left(m_lastSeparator);Execution Count:9389 | 9389 |
| 116 | } | - |
| 117 | | - |
| 118 | QString QFileSystemEntry::baseName() const | - |
| 119 | { | - |
| 120 | findFileNameSeparators(); | - |
| 121 | int length = -1; | - |
| 122 | if (m_firstDotInFileName >= 0) { evaluated: m_firstDotInFileName >= 0| yes Evaluation Count:1754 | yes Evaluation Count:233 |
| 233-1754 |
| 123 | length = m_firstDotInFileName; | - |
| 124 | if (m_lastSeparator != -1) evaluated: m_lastSeparator != -1| yes Evaluation Count:1595 | yes Evaluation Count:159 |
| 159-1595 |
| 125 | length--; executed: length--;Execution Count:1595 | 1595 |
| 126 | } executed: }Execution Count:1754 | 1754 |
| 127 | | - |
| 128 | | - |
| 129 | | - |
| 130 | | - |
| 131 | return m_filePath.mid(m_lastSeparator + 1, length); executed: return m_filePath.mid(m_lastSeparator + 1, length);Execution Count:1987 | 1987 |
| 132 | } | - |
| 133 | | - |
| 134 | QString QFileSystemEntry::completeBaseName() const | - |
| 135 | { | - |
| 136 | findFileNameSeparators(); | - |
| 137 | int length = -1; | - |
| 138 | if (m_firstDotInFileName >= 0) { evaluated: m_firstDotInFileName >= 0| yes Evaluation Count:20 | yes Evaluation Count:11 |
| 11-20 |
| 139 | length = m_firstDotInFileName + m_lastDotInFileName; | - |
| 140 | if (m_lastSeparator != -1) evaluated: m_lastSeparator != -1| yes Evaluation Count:16 | yes Evaluation Count:4 |
| 4-16 |
| 141 | length--; executed: length--;Execution Count:16 | 16 |
| 142 | } executed: }Execution Count:20 | 20 |
| 143 | | - |
| 144 | | - |
| 145 | | - |
| 146 | | - |
| 147 | return m_filePath.mid(m_lastSeparator + 1, length); executed: return m_filePath.mid(m_lastSeparator + 1, length);Execution Count:31 | 31 |
| 148 | } | - |
| 149 | | - |
| 150 | QString QFileSystemEntry::suffix() const | - |
| 151 | { | - |
| 152 | findFileNameSeparators(); | - |
| 153 | | - |
| 154 | if (m_lastDotInFileName == -1) evaluated: m_lastDotInFileName == -1| yes Evaluation Count:13021 | yes Evaluation Count:29859 |
| 13021-29859 |
| 155 | return QString(); executed: return QString();Execution Count:13021 | 13021 |
| 156 | | - |
| 157 | return m_filePath.mid(qMax((qint16)0, m_lastSeparator) + m_firstDotInFileName + m_lastDotInFileName + 1); executed: return m_filePath.mid(qMax((qint16)0, m_lastSeparator) + m_firstDotInFileName + m_lastDotInFileName + 1);Execution Count:29859 | 29859 |
| 158 | } | - |
| 159 | | - |
| 160 | QString QFileSystemEntry::completeSuffix() const | - |
| 161 | { | - |
| 162 | findFileNameSeparators(); | - |
| 163 | if (m_firstDotInFileName == -1) evaluated: m_firstDotInFileName == -1| yes Evaluation Count:18 | yes Evaluation Count:1742 |
| 18-1742 |
| 164 | return QString(); executed: return QString();Execution Count:18 | 18 |
| 165 | | - |
| 166 | return m_filePath.mid(qMax((qint16)0, m_lastSeparator) + m_firstDotInFileName + 1); executed: return m_filePath.mid(qMax((qint16)0, m_lastSeparator) + m_firstDotInFileName + 1);Execution Count:1742 | 1742 |
| 167 | } | - |
| 168 | bool QFileSystemEntry::isRelative() const | - |
| 169 | { | - |
| 170 | return !isAbsolute(); executed: return !isAbsolute();Execution Count:14093 | 14093 |
| 171 | } | - |
| 172 | | - |
| 173 | bool QFileSystemEntry::isAbsolute() const | - |
| 174 | { | - |
| 175 | resolveFilePath(); | - |
| 176 | return (!m_filePath.isEmpty() && (m_filePath[0].unicode() == '/')); executed: return (!m_filePath.isEmpty() && (m_filePath[0].unicode() == '/'));Execution Count:24154 | 24154 |
| 177 | } | - |
| 178 | bool QFileSystemEntry::isRoot() const | - |
| 179 | { | - |
| 180 | resolveFilePath(); | - |
| 181 | if (m_filePath == QLatin1String("/") evaluated: m_filePath == QLatin1String("/")| yes Evaluation Count:152 | yes Evaluation Count:62674 |
| 152-62674 |
| 182 | | - |
| 183 | | - |
| 184 | | - |
| 185 | | - |
| 186 | ) | - |
| 187 | return true; executed: return true;Execution Count:152 | 152 |
| 188 | | - |
| 189 | return false; executed: return false;Execution Count:62674 | 62674 |
| 190 | } | - |
| 191 | | - |
| 192 | bool QFileSystemEntry::isEmpty() const | - |
| 193 | { | - |
| 194 | return m_filePath.isEmpty() && m_nativeFilePath.isEmpty(); executed: return m_filePath.isEmpty() && m_nativeFilePath.isEmpty();Execution Count:40834 | 40834 |
| 195 | } | - |
| 196 | | - |
| 197 | | - |
| 198 | | - |
| 199 | void QFileSystemEntry::findLastSeparator() const | - |
| 200 | { | - |
| 201 | if (m_lastSeparator == -2) { evaluated: m_lastSeparator == -2| yes Evaluation Count:176558 | yes Evaluation Count:99242 |
| 99242-176558 |
| 202 | resolveFilePath(); | - |
| 203 | m_lastSeparator = -1; | - |
| 204 | for (int i = m_filePath.size() - 1; i >= 0; --i) { evaluated: i >= 0| yes Evaluation Count:2706043 | yes Evaluation Count:336 |
| 336-2706043 |
| 205 | if (m_filePath[i].unicode() == '/') { evaluated: m_filePath[i].unicode() == '/'| yes Evaluation Count:176109 | yes Evaluation Count:2530127 |
| 176109-2530127 |
| 206 | m_lastSeparator = i; | - |
| 207 | break; executed: break;Execution Count:176112 | 176112 |
| 208 | } | - |
| 209 | } executed: }Execution Count:2530169 | 2530169 |
| 210 | } executed: }Execution Count:176454 | 176454 |
| 211 | } executed: }Execution Count:275666 | 275666 |
| 212 | | - |
| 213 | void QFileSystemEntry::findFileNameSeparators() const | - |
| 214 | { | - |
| 215 | if (m_firstDotInFileName == -2) { evaluated: m_firstDotInFileName == -2| yes Evaluation Count:32110 | yes Evaluation Count:14548 |
| 14548-32110 |
| 216 | resolveFilePath(); | - |
| 217 | int firstDotInFileName = -1; | - |
| 218 | int lastDotInFileName = -1; | - |
| 219 | int lastSeparator = m_lastSeparator; | - |
| 220 | | - |
| 221 | int stop; | - |
| 222 | if (lastSeparator < 0) { evaluated: lastSeparator < 0| yes Evaluation Count:6718 | yes Evaluation Count:25392 |
| 6718-25392 |
| 223 | lastSeparator = -1; | - |
| 224 | stop = 0; | - |
| 225 | } else { executed: }Execution Count:6718 | 6718 |
| 226 | stop = lastSeparator; | - |
| 227 | } executed: }Execution Count:25392 | 25392 |
| 228 | | - |
| 229 | int i = m_filePath.size() - 1; | - |
| 230 | for (; i >= stop; --i) { evaluated: i >= stop| yes Evaluation Count:195269 | yes Evaluation Count:314 |
| 314-195269 |
| 231 | if (m_filePath[i].unicode() == '.') { evaluated: m_filePath[i].unicode() == '.'| yes Evaluation Count:20025 | yes Evaluation Count:175244 |
| 20025-175244 |
| 232 | firstDotInFileName = lastDotInFileName = i; | - |
| 233 | break; executed: break;Execution Count:20025 | 20025 |
| 234 | } else if (m_filePath[i].unicode() == '/') { evaluated: m_filePath[i].unicode() == '/'| yes Evaluation Count:11771 | yes Evaluation Count:163473 |
| 11771-163473 |
| 235 | lastSeparator = i; | - |
| 236 | break; executed: break;Execution Count:11771 | 11771 |
| 237 | } | - |
| 238 | } | - |
| 239 | | - |
| 240 | if (lastSeparator != i) { evaluated: lastSeparator != i| yes Evaluation Count:20025 | yes Evaluation Count:12085 |
| 12085-20025 |
| 241 | for (--i; i >= stop; --i) { evaluated: i >= stop| yes Evaluation Count:371720 | yes Evaluation Count:260 |
| 260-371720 |
| 242 | if (m_filePath[i].unicode() == '.') evaluated: m_filePath[i].unicode() == '.'| yes Evaluation Count:7789 | yes Evaluation Count:363931 |
| 7789-363931 |
| 243 | firstDotInFileName = i; executed: firstDotInFileName = i;Execution Count:7789 | 7789 |
| 244 | else if (m_filePath[i].unicode() == '/') { evaluated: m_filePath[i].unicode() == '/'| yes Evaluation Count:19765 | yes Evaluation Count:344166 |
| 19765-344166 |
| 245 | lastSeparator = i; | - |
| 246 | break; executed: break;Execution Count:19765 | 19765 |
| 247 | } | - |
| 248 | } | - |
| 249 | } executed: }Execution Count:20025 | 20025 |
| 250 | m_lastSeparator = lastSeparator; | - |
| 251 | m_firstDotInFileName = firstDotInFileName == -1 ? -1 : firstDotInFileName - qMax(0, lastSeparator); evaluated: firstDotInFileName == -1| yes Evaluation Count:12085 | yes Evaluation Count:20025 |
| 12085-20025 |
| 252 | if (lastDotInFileName == -1) evaluated: lastDotInFileName == -1| yes Evaluation Count:12085 | yes Evaluation Count:20025 |
| 12085-20025 |
| 253 | m_lastDotInFileName = -1; executed: m_lastDotInFileName = -1;Execution Count:12085 | 12085 |
| 254 | else if (firstDotInFileName == lastDotInFileName) evaluated: firstDotInFileName == lastDotInFileName| yes Evaluation Count:16047 | yes Evaluation Count:3978 |
| 3978-16047 |
| 255 | m_lastDotInFileName = 0; executed: m_lastDotInFileName = 0;Execution Count:16047 | 16047 |
| 256 | else | - |
| 257 | m_lastDotInFileName = lastDotInFileName - firstDotInFileName; executed: m_lastDotInFileName = lastDotInFileName - firstDotInFileName;Execution Count:3978 | 3978 |
| 258 | } | - |
| 259 | } executed: }Execution Count:46658 | 46658 |
| 260 | | - |
| 261 | bool QFileSystemEntry::isClean() const | - |
| 262 | { | - |
| 263 | resolveFilePath(); | - |
| 264 | int dots = 0; | - |
| 265 | bool dotok = true; | - |
| 266 | bool slashok = true; | - |
| 267 | for (QString::const_iterator iter = m_filePath.constBegin(); iter != m_filePath.constEnd(); iter++) { evaluated: iter != m_filePath.constEnd()| yes Evaluation Count:604929 | yes Evaluation Count:14600 |
| 14600-604929 |
| 268 | if (*iter == QLatin1Char('/')) { evaluated: *iter == QLatin1Char('/')| yes Evaluation Count:70859 | yes Evaluation Count:534072 |
| 70859-534072 |
| 269 | if (dots == 1 || dots == 2) evaluated: dots == 1| yes Evaluation Count:2 | yes Evaluation Count:70857 |
evaluated: dots == 2| yes Evaluation Count:153 | yes Evaluation Count:70704 |
| 2-70857 |
| 270 | return false; executed: return false;Execution Count:155 | 155 |
| 271 | if (!slashok) evaluated: !slashok| yes Evaluation Count:17 | yes Evaluation Count:70687 |
| 17-70687 |
| 272 | return false; executed: return false;Execution Count:17 | 17 |
| 273 | dots = 0; | - |
| 274 | dotok = true; | - |
| 275 | slashok = false; | - |
| 276 | } else if (dotok) { executed: }Execution Count:70687 evaluated: dotok| yes Evaluation Count:71588 | yes Evaluation Count:462484 |
| 70687-462484 |
| 277 | slashok = true; | - |
| 278 | if (*iter == QLatin1Char('.')) { evaluated: *iter == QLatin1Char('.')| yes Evaluation Count:1654 | yes Evaluation Count:69934 |
| 1654-69934 |
| 279 | dots++; | - |
| 280 | if (dots > 2) evaluated: dots > 2| yes Evaluation Count:1 | yes Evaluation Count:1653 |
| 1-1653 |
| 281 | dotok = false; executed: dotok = false;Execution Count:1 | 1 |
| 282 | } else { executed: }Execution Count:1654 | 1654 |
| 283 | | - |
| 284 | dots = 0; | - |
| 285 | dotok = false; | - |
| 286 | } executed: }Execution Count:69934 | 69934 |
| 287 | } | - |
| 288 | } | - |
| 289 | return (dots != 1 && dots != 2); executed: return (dots != 1 && dots != 2);Execution Count:14600 | 14600 |
| 290 | } | - |
| 291 | | - |
| 292 | | - |
| 293 | | - |
| | |