| Line | Source Code | Coverage |
|---|
| 1 | | - |
| 2 | | - |
| 3 | | - |
| 4 | | - |
| 5 | | - |
| 6 | | - |
| 7 | | - |
| 8 | | - |
| 9 | | - |
| 10 | | - |
| 11 | | - |
| 12 | QDirPrivate::QDirPrivate(const QString &path, const QStringList &nameFilters_, QDir::SortFlags sort_, QDir::Filters filters_) | - |
| 13 | : QSharedData() | - |
| 14 | , nameFilters(nameFilters_) | - |
| 15 | , sort(sort_) | - |
| 16 | , filters(filters_) | - |
| 17 | , fileListsInitialized(false) | - |
| 18 | { | - |
| 19 | setPath(path.isEmpty() ? QString::fromLatin1(".") : path); | - |
| 20 | | - |
| 21 | bool empty = nameFilters.isEmpty(); | - |
| 22 | if (!empty) { evaluated: !empty| yes Evaluation Count:27 | yes Evaluation Count:9517 |
| 27-9517 |
| 23 | empty = true; | - |
| 24 | for (int i = 0; i < nameFilters.size(); ++i) { partially evaluated: i < nameFilters.size()| yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
| 25 | if (!nameFilters.at(i).isEmpty()) { partially evaluated: !nameFilters.at(i).isEmpty()| yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-27 |
| 26 | empty = false; | - |
| 27 | break; executed: break;Execution Count:27 | 27 |
| 28 | } | - |
| 29 | } | 0 |
| 30 | } executed: }Execution Count:27 | 27 |
| 31 | if (empty) evaluated: empty| yes Evaluation Count:9517 | yes Evaluation Count:27 |
| 27-9517 |
| 32 | nameFilters = QStringList(QString::fromLatin1("*")); executed: nameFilters = QStringList(QString::fromLatin1("*"));Execution Count:9517 | 9517 |
| 33 | } executed: }Execution Count:9544 | 9544 |
| 34 | | - |
| 35 | QDirPrivate::QDirPrivate(const QDirPrivate ©) | - |
| 36 | : QSharedData(copy) | - |
| 37 | , nameFilters(copy.nameFilters) | - |
| 38 | , sort(copy.sort) | - |
| 39 | , filters(copy.filters) | - |
| 40 | , fileListsInitialized(false) | - |
| 41 | , dirEntry(copy.dirEntry) | - |
| 42 | , metaData(copy.metaData) | - |
| 43 | { | - |
| 44 | } executed: }Execution Count:287 | 287 |
| 45 | | - |
| 46 | bool QDirPrivate::exists() const | - |
| 47 | { | - |
| 48 | if (fileEngine.isNull()) { evaluated: fileEngine.isNull()| yes Evaluation Count:2960 | yes Evaluation Count:7 |
| 7-2960 |
| 49 | QFileSystemEngine::fillMetaData(dirEntry, metaData, | - |
| 50 | QFileSystemMetaData::ExistsAttribute | QFileSystemMetaData::DirectoryType); | - |
| 51 | return metaData.exists() && metaData.isDirectory(); executed: return metaData.exists() && metaData.isDirectory();Execution Count:2960 | 2960 |
| 52 | } | - |
| 53 | const QAbstractFileEngine::FileFlags info = | - |
| 54 | fileEngine->fileFlags(QAbstractFileEngine::DirectoryType | - |
| 55 | | QAbstractFileEngine::ExistsFlag | - |
| 56 | | QAbstractFileEngine::Refresh); | - |
| 57 | if (!(info & QAbstractFileEngine::DirectoryType)) evaluated: !(info & QAbstractFileEngine::DirectoryType)| yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-6 |
| 58 | return false; executed: return false;Execution Count:1 | 1 |
| 59 | return info & QAbstractFileEngine::ExistsFlag; executed: return info & QAbstractFileEngine::ExistsFlag;Execution Count:6 | 6 |
| 60 | } | - |
| 61 | | - |
| 62 | | - |
| 63 | inline QChar QDirPrivate::getFilterSepChar(const QString &nameFilter) | - |
| 64 | { | - |
| 65 | QChar sep(QLatin1Char(';')); | - |
| 66 | int i = nameFilter.indexOf(sep, 0); | - |
| 67 | if (i == -1 && nameFilter.indexOf(QLatin1Char(' '), 0) != -1) evaluated: i == -1| yes Evaluation Count:29 | yes Evaluation Count:3 |
partially evaluated: nameFilter.indexOf(QLatin1Char(' '), 0) != -1| no Evaluation Count:0 | yes Evaluation Count:29 |
| 0-29 |
| 68 | sep = QChar(QLatin1Char(' ')); never executed: sep = QChar(QLatin1Char(' ')); | 0 |
| 69 | return sep; executed: return sep;Execution Count:32 | 32 |
| 70 | } | - |
| 71 | | - |
| 72 | | - |
| 73 | inline QStringList QDirPrivate::splitFilters(const QString &nameFilter, QChar sep) | - |
| 74 | { | - |
| 75 | if (sep == 0) partially evaluated: sep == 0| yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
| 76 | sep = getFilterSepChar(nameFilter); executed: sep = getFilterSepChar(nameFilter);Execution Count:32 | 32 |
| 77 | QStringList ret = nameFilter.split(sep); | - |
| 78 | for (int i = 0; i < ret.count(); ++i) evaluated: i < ret.count()| yes Evaluation Count:35 | yes Evaluation Count:32 |
| 32-35 |
| 79 | ret[i] = ret[i].trimmed(); executed: ret[i] = ret[i].trimmed();Execution Count:35 | 35 |
| 80 | return ret; executed: return ret;Execution Count:32 | 32 |
| 81 | } | - |
| 82 | | - |
| 83 | inline void QDirPrivate::setPath(const QString &path) | - |
| 84 | { | - |
| 85 | QString p = QDir::fromNativeSeparators(path); | - |
| 86 | if (p.endsWith(QLatin1Char('/')) evaluated: p.endsWith(QLatin1Char('/'))| yes Evaluation Count:335 | yes Evaluation Count:9569 |
| 335-9569 |
| 87 | && p.length() > 1 evaluated: p.length() > 1| yes Evaluation Count:185 | yes Evaluation Count:150 |
| 150-185 |
| 88 | | - |
| 89 | | - |
| 90 | | - |
| 91 | ) { | - |
| 92 | p.truncate(p.length() - 1); | - |
| 93 | } executed: }Execution Count:185 | 185 |
| 94 | | - |
| 95 | dirEntry = QFileSystemEntry(p, QFileSystemEntry::FromInternalPath()); | - |
| 96 | metaData.clear(); | - |
| 97 | initFileEngine(); | - |
| 98 | clearFileLists(); | - |
| 99 | absoluteDirEntry = QFileSystemEntry(); | - |
| 100 | } executed: }Execution Count:9904 | 9904 |
| 101 | | - |
| 102 | inline void QDirPrivate::clearFileLists() | - |
| 103 | { | - |
| 104 | fileListsInitialized = false; | - |
| 105 | files.clear(); | - |
| 106 | fileInfos.clear(); | - |
| 107 | } executed: }Execution Count:10404 | 10404 |
| 108 | | - |
| 109 | inline void QDirPrivate::resolveAbsoluteEntry() const | - |
| 110 | { | - |
| 111 | if (!absoluteDirEntry.isEmpty() || dirEntry.isEmpty()) evaluated: !absoluteDirEntry.isEmpty()| yes Evaluation Count:2833 | yes Evaluation Count:5882 |
partially evaluated: dirEntry.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:5882 |
| 0-5882 |
| 112 | return; executed: return;Execution Count:2833 | 2833 |
| 113 | | - |
| 114 | QString absoluteName; | - |
| 115 | if (fileEngine.isNull()) { evaluated: fileEngine.isNull()| yes Evaluation Count:5877 | yes Evaluation Count:5 |
| 5-5877 |
| 116 | if (!dirEntry.isRelative() && dirEntry.isClean()) { evaluated: !dirEntry.isRelative()| yes Evaluation Count:5552 | yes Evaluation Count:325 |
evaluated: dirEntry.isClean()| yes Evaluation Count:5467 | yes Evaluation Count:85 |
| 85-5552 |
| 117 | absoluteDirEntry = dirEntry; | - |
| 118 | return; executed: return;Execution Count:5467 | 5467 |
| 119 | } | - |
| 120 | | - |
| 121 | absoluteName = QFileSystemEngine::absoluteName(dirEntry).filePath(); | - |
| 122 | } else { executed: }Execution Count:410 | 410 |
| 123 | absoluteName = fileEngine->fileName(QAbstractFileEngine::AbsoluteName); | - |
| 124 | } executed: }Execution Count:5 | 5 |
| 125 | | - |
| 126 | absoluteDirEntry = QFileSystemEntry(QDir::cleanPath(absoluteName), QFileSystemEntry::FromInternalPath()); | - |
| 127 | } executed: }Execution Count:415 | 415 |
| 128 | | - |
| 129 | | - |
| 130 | struct QDirSortItem | - |
| 131 | { | - |
| 132 | mutable QString filename_cache; | - |
| 133 | mutable QString suffix_cache; | - |
| 134 | QFileInfo item; | - |
| 135 | }; | - |
| 136 | | - |
| 137 | | - |
| 138 | class QDirSortItemComparator | - |
| 139 | { | - |
| 140 | int qt_cmp_si_sort_flags; | - |
| 141 | public: | - |
| 142 | QDirSortItemComparator(int flags) : qt_cmp_si_sort_flags(flags) {} executed: }Execution Count:883 | 883 |
| 143 | bool operator()(const QDirSortItem &, const QDirSortItem &); | - |
| 144 | }; | - |
| 145 | | - |
| 146 | bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortItem &n2) | - |
| 147 | { | - |
| 148 | const QDirSortItem* f1 = &n1; | - |
| 149 | const QDirSortItem* f2 = &n2; | - |
| 150 | | - |
| 151 | if ((qt_cmp_si_sort_flags & QDir::DirsFirst) && (f1->item.isDir() != f2->item.isDir())) evaluated: (qt_cmp_si_sort_flags & QDir::DirsFirst)| yes Evaluation Count:10323 | yes Evaluation Count:87810 |
evaluated: (f1->item.isDir() != f2->item.isDir())| yes Evaluation Count:1463 | yes Evaluation Count:8860 |
| 1463-87810 |
| 152 | return f1->item.isDir(); executed: return f1->item.isDir();Execution Count:1463 | 1463 |
| 153 | if ((qt_cmp_si_sort_flags & QDir::DirsLast) && (f1->item.isDir() != f2->item.isDir())) evaluated: (qt_cmp_si_sort_flags & QDir::DirsLast)| yes Evaluation Count:218 | yes Evaluation Count:96452 |
evaluated: (f1->item.isDir() != f2->item.isDir())| yes Evaluation Count:38 | yes Evaluation Count:180 |
| 38-96452 |
| 154 | return !f1->item.isDir(); executed: return !f1->item.isDir();Execution Count:38 | 38 |
| 155 | | - |
| 156 | int r = 0; | - |
| 157 | int sortBy = (qt_cmp_si_sort_flags & QDir::SortByMask) | - |
| 158 | | (qt_cmp_si_sort_flags & QDir::Type); | - |
| 159 | | - |
| 160 | switch (sortBy) { | - |
| 161 | case QDir::Time: { | - |
| 162 | QDateTime firstModified = f1->item.lastModified(); | - |
| 163 | QDateTime secondModified = f2->item.lastModified(); | - |
| 164 | | - |
| 165 | | - |
| 166 | | - |
| 167 | | - |
| 168 | | - |
| 169 | firstModified.setTimeSpec(Qt::UTC); | - |
| 170 | secondModified.setTimeSpec(Qt::UTC); | - |
| 171 | | - |
| 172 | r = firstModified.secsTo(secondModified); | - |
| 173 | break; executed: break;Execution Count:627 | 627 |
| 174 | } | - |
| 175 | case QDir::Size: | - |
| 176 | r = int(qBound<qint64>(-1, f2->item.size() - f1->item.size(), 1)); | - |
| 177 | break; executed: break;Execution Count:833 | 833 |
| 178 | case QDir::Type: | - |
| 179 | { | - |
| 180 | bool ic = qt_cmp_si_sort_flags & QDir::IgnoreCase; | - |
| 181 | | - |
| 182 | if (f1->suffix_cache.isNull()) evaluated: f1->suffix_cache.isNull()| yes Evaluation Count:729 | yes Evaluation Count:358 |
| 358-729 |
| 183 | f1->suffix_cache = ic ? f1->item.suffix().toLower() evaluated: ic| yes Evaluation Count:591 | yes Evaluation Count:138 |
| 138-729 |
| 184 | : f1->item.suffix(); executed: f1->suffix_cache = ic ? f1->item.suffix().toLower() : f1->item.suffix();Execution Count:729 | 729 |
| 185 | if (f2->suffix_cache.isNull()) evaluated: f2->suffix_cache.isNull()| yes Evaluation Count:731 | yes Evaluation Count:356 |
| 356-731 |
| 186 | f2->suffix_cache = ic ? f2->item.suffix().toLower() evaluated: ic| yes Evaluation Count:594 | yes Evaluation Count:137 |
| 137-731 |
| 187 | : f2->item.suffix(); executed: f2->suffix_cache = ic ? f2->item.suffix().toLower() : f2->item.suffix();Execution Count:731 | 731 |
| 188 | | - |
| 189 | r = qt_cmp_si_sort_flags & QDir::LocaleAware partially evaluated: qt_cmp_si_sort_flags & QDir::LocaleAware| no Evaluation Count:0 | yes Evaluation Count:1087 |
| 0-1087 |
| 190 | ? f1->suffix_cache.localeAwareCompare(f2->suffix_cache) | - |
| 191 | : f1->suffix_cache.compare(f2->suffix_cache); | - |
| 192 | } | - |
| 193 | break; executed: break;Execution Count:1087 | 1087 |
| 194 | default: | - |
| 195 | ; | - |
| 196 | } executed: }Execution Count:94085 | 94085 |
| 197 | | - |
| 198 | if (r == 0 && sortBy != QDir::Unsorted) { evaluated: r == 0| yes Evaluation Count:95626 | yes Evaluation Count:1006 |
partially evaluated: sortBy != QDir::Unsorted| yes Evaluation Count:95626 | no Evaluation Count:0 |
| 0-95626 |
| 199 | | - |
| 200 | bool ic = qt_cmp_si_sort_flags & QDir::IgnoreCase; | - |
| 201 | | - |
| 202 | if (f1->filename_cache.isNull()) evaluated: f1->filename_cache.isNull()| yes Evaluation Count:9282 | yes Evaluation Count:86344 |
| 9282-86344 |
| 203 | f1->filename_cache = ic ? f1->item.fileName().toLower() evaluated: ic| yes Evaluation Count:3954 | yes Evaluation Count:5328 |
| 3954-9282 |
| 204 | : f1->item.fileName(); executed: f1->filename_cache = ic ? f1->item.fileName().toLower() : f1->item.fileName();Execution Count:9282 | 9282 |
| 205 | if (f2->filename_cache.isNull()) evaluated: f2->filename_cache.isNull()| yes Evaluation Count:5702 | yes Evaluation Count:89924 |
| 5702-89924 |
| 206 | f2->filename_cache = ic ? f2->item.fileName().toLower() evaluated: ic| yes Evaluation Count:2307 | yes Evaluation Count:3395 |
| 2307-5702 |
| 207 | : f2->item.fileName(); executed: f2->filename_cache = ic ? f2->item.fileName().toLower() : f2->item.fileName();Execution Count:5702 | 5702 |
| 208 | | - |
| 209 | r = qt_cmp_si_sort_flags & QDir::LocaleAware partially evaluated: qt_cmp_si_sort_flags & QDir::LocaleAware| no Evaluation Count:0 | yes Evaluation Count:95626 |
| 0-95626 |
| 210 | ? f1->filename_cache.localeAwareCompare(f2->filename_cache) | - |
| 211 | : f1->filename_cache.compare(f2->filename_cache); | - |
| 212 | } executed: }Execution Count:95626 | 95626 |
| 213 | if (r == 0) evaluated: r == 0| yes Evaluation Count:2 | yes Evaluation Count:96630 |
| 2-96630 |
| 214 | r = (&n1) - (&n2); executed: r = (&n1) - (&n2);Execution Count:2 | 2 |
| 215 | if (qt_cmp_si_sort_flags & QDir::Reversed) evaluated: qt_cmp_si_sort_flags & QDir::Reversed| yes Evaluation Count:1043 | yes Evaluation Count:95589 |
| 1043-95589 |
| 216 | return r > 0; executed: return r > 0;Execution Count:1043 | 1043 |
| 217 | return r < 0; executed: return r < 0;Execution Count:95589 | 95589 |
| 218 | } | - |
| 219 | | - |
| 220 | inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QFileInfoList &l, | - |
| 221 | QStringList *names, QFileInfoList *infos) | - |
| 222 | { | - |
| 223 | | - |
| 224 | int n = l.size(); | - |
| 225 | if (n > 0) { evaluated: n > 0| yes Evaluation Count:950 | yes Evaluation Count:262 |
| 262-950 |
| 226 | if (n == 1 || (sort & QDir::SortByMask) == QDir::Unsorted) { evaluated: n == 1| yes Evaluation Count:67 | yes Evaluation Count:883 |
partially evaluated: (sort & QDir::SortByMask) == QDir::Unsorted| no Evaluation Count:0 | yes Evaluation Count:883 |
| 0-883 |
| 227 | if (infos) evaluated: infos| yes Evaluation Count:49 | yes Evaluation Count:18 |
| 18-49 |
| 228 | *infos = l; executed: *infos = l;Execution Count:49 | 49 |
| 229 | if (names) { evaluated: names| yes Evaluation Count:20 | yes Evaluation Count:47 |
| 20-47 |
| 230 | for (int i = 0; i < n; ++i) evaluated: i < n| yes Evaluation Count:20 | yes Evaluation Count:20 |
| 20 |
| 231 | names->append(l.at(i).fileName()); executed: names->append(l.at(i).fileName());Execution Count:20 | 20 |
| 232 | } executed: }Execution Count:20 | 20 |
| 233 | } else { executed: }Execution Count:67 | 67 |
| 234 | QScopedArrayPointer<QDirSortItem> si(new QDirSortItem[n]); | - |
| 235 | for (int i = 0; i < n; ++i) evaluated: i < n| yes Evaluation Count:15195 | yes Evaluation Count:883 |
| 883-15195 |
| 236 | si[i].item = l.at(i); executed: si[i].item = l.at(i);Execution Count:15195 | 15195 |
| 237 | qSort(si.data(), si.data() + n, QDirSortItemComparator(sort)); | - |
| 238 | | - |
| 239 | if (infos) { evaluated: infos| yes Evaluation Count:704 | yes Evaluation Count:179 |
| 179-704 |
| 240 | for (int i = 0; i < n; ++i) evaluated: i < n| yes Evaluation Count:12043 | yes Evaluation Count:704 |
| 704-12043 |
| 241 | infos->append(si[i].item); executed: infos->append(si[i].item);Execution Count:12043 | 12043 |
| 242 | } executed: }Execution Count:704 | 704 |
| 243 | if (names) { evaluated: names| yes Evaluation Count:238 | yes Evaluation Count:645 |
| 238-645 |
| 244 | for (int i = 0; i < n; ++i) evaluated: i < n| yes Evaluation Count:3461 | yes Evaluation Count:238 |
| 238-3461 |
| 245 | names->append(si[i].item.fileName()); executed: names->append(si[i].item.fileName());Execution Count:3461 | 3461 |
| 246 | } executed: }Execution Count:238 | 238 |
| 247 | } executed: }Execution Count:883 | 883 |
| 248 | } | - |
| 249 | } executed: }Execution Count:1212 | 1212 |
| 250 | inline void QDirPrivate::initFileLists(const QDir &dir) const | - |
| 251 | { | - |
| 252 | if (!fileListsInitialized) { evaluated: !fileListsInitialized| yes Evaluation Count:65 | yes Evaluation Count:30 |
| 30-65 |
| 253 | QFileInfoList l; | - |
| 254 | QDirIterator it(dir); | - |
| 255 | while (it.hasNext()) { evaluated: it.hasNext()| yes Evaluation Count:311 | yes Evaluation Count:65 |
| 65-311 |
| 256 | it.next(); | - |
| 257 | l.append(it.fileInfo()); | - |
| 258 | } executed: }Execution Count:311 | 311 |
| 259 | sortFileList(sort, l, &files, &fileInfos); | - |
| 260 | fileListsInitialized = true; | - |
| 261 | } executed: }Execution Count:65 | 65 |
| 262 | } executed: }Execution Count:95 | 95 |
| 263 | | - |
| 264 | inline void QDirPrivate::initFileEngine() | - |
| 265 | { | - |
| 266 | fileEngine.reset(QFileSystemEngine::resolveEntryAndCreateLegacyEngine(dirEntry, metaData)); | - |
| 267 | } executed: }Execution Count:10404 | 10404 |
| 268 | QDir::QDir(QDirPrivate &p) : d_ptr(&p) | - |
| 269 | { | - |
| 270 | } | 0 |
| 271 | | - |
| 272 | | - |
| 273 | | - |
| 274 | | - |
| 275 | | - |
| 276 | | - |
| 277 | | - |
| 278 | QDir::QDir(const QString &path) : d_ptr(new QDirPrivate(path)) | - |
| 279 | { | - |
| 280 | } executed: }Execution Count:9517 | 9517 |
| 281 | QDir::QDir(const QString &path, const QString &nameFilter, | - |
| 282 | SortFlags sort, Filters filters) | - |
| 283 | : d_ptr(new QDirPrivate(path, QDir::nameFiltersFromString(nameFilter), sort, filters)) | - |
| 284 | { | - |
| 285 | } executed: }Execution Count:27 | 27 |
| 286 | | - |
| 287 | | - |
| 288 | | - |
| 289 | | - |
| 290 | | - |
| 291 | | - |
| 292 | | - |
| 293 | QDir::QDir(const QDir &dir) | - |
| 294 | : d_ptr(dir.d_ptr) | - |
| 295 | { | - |
| 296 | } executed: }Execution Count:246 | 246 |
| 297 | | - |
| 298 | | - |
| 299 | | - |
| 300 | | - |
| 301 | | - |
| 302 | QDir::~QDir() | - |
| 303 | { | - |
| 304 | } | - |
| 305 | void QDir::setPath(const QString &path) | - |
| 306 | { | - |
| 307 | d_ptr->setPath(path); | - |
| 308 | } executed: }Execution Count:317 | 317 |
| 309 | QString QDir::path() const | - |
| 310 | { | - |
| 311 | const QDirPrivate* d = d_ptr.constData(); | - |
| 312 | return d->dirEntry.filePath(); executed: return d->dirEntry.filePath();Execution Count:11265 | 11265 |
| 313 | } | - |
| 314 | QString QDir::absolutePath() const | - |
| 315 | { | - |
| 316 | const QDirPrivate* d = d_ptr.constData(); | - |
| 317 | d->resolveAbsoluteEntry(); | - |
| 318 | return d->absoluteDirEntry.filePath(); executed: return d->absoluteDirEntry.filePath();Execution Count:8214 | 8214 |
| 319 | } | - |
| 320 | QString QDir::canonicalPath() const | - |
| 321 | { | - |
| 322 | const QDirPrivate* d = d_ptr.constData(); | - |
| 323 | if (d->fileEngine.isNull()) { evaluated: d->fileEngine.isNull()| yes Evaluation Count:653 | yes Evaluation Count:1 |
| 1-653 |
| 324 | QFileSystemEntry answer = QFileSystemEngine::canonicalName(d->dirEntry, d->metaData); | - |
| 325 | return answer.filePath(); executed: return answer.filePath();Execution Count:653 | 653 |
| 326 | } | - |
| 327 | return d->fileEngine->fileName(QAbstractFileEngine::CanonicalName); executed: return d->fileEngine->fileName(QAbstractFileEngine::CanonicalName);Execution Count:1 | 1 |
| 328 | } | - |
| 329 | QString QDir::dirName() const | - |
| 330 | { | - |
| 331 | const QDirPrivate* d = d_ptr.constData(); | - |
| 332 | return d->dirEntry.fileName(); executed: return d->dirEntry.fileName();Execution Count:22 | 22 |
| 333 | } | - |
| 334 | QString QDir::filePath(const QString &fileName) const | - |
| 335 | { | - |
| 336 | const QDirPrivate* d = d_ptr.constData(); | - |
| 337 | if (isAbsolutePath(fileName)) evaluated: isAbsolutePath(fileName)| yes Evaluation Count:3583 | yes Evaluation Count:3151 |
| 3151-3583 |
| 338 | return QString(fileName); executed: return QString(fileName);Execution Count:3583 | 3583 |
| 339 | | - |
| 340 | QString ret = d->dirEntry.filePath(); | - |
| 341 | if (!fileName.isEmpty()) { evaluated: !fileName.isEmpty()| yes Evaluation Count:3148 | yes Evaluation Count:3 |
| 3-3148 |
| 342 | if (!ret.isEmpty() && ret[(int)ret.length()-1] != QLatin1Char('/') && fileName[0] != QLatin1Char('/')) partially evaluated: !ret.isEmpty()| yes Evaluation Count:3148 | no Evaluation Count:0 |
evaluated: ret[(int)ret.length()-1] != QLatin1Char('/')| yes Evaluation Count:3147 | yes Evaluation Count:1 |
partially evaluated: fileName[0] != QLatin1Char('/')| yes Evaluation Count:3147 | no Evaluation Count:0 |
| 0-3148 |
| 343 | ret += QLatin1Char('/'); executed: ret += QLatin1Char('/');Execution Count:3147 | 3147 |
| 344 | ret += fileName; | - |
| 345 | } executed: }Execution Count:3148 | 3148 |
| 346 | return ret; executed: return ret;Execution Count:3151 | 3151 |
| 347 | } | - |
| 348 | QString QDir::absoluteFilePath(const QString &fileName) const | - |
| 349 | { | - |
| 350 | const QDirPrivate* d = d_ptr.constData(); | - |
| 351 | if (isAbsolutePath(fileName)) evaluated: isAbsolutePath(fileName)| yes Evaluation Count:121 | yes Evaluation Count:492 |
| 121-492 |
| 352 | return fileName; executed: return fileName;Execution Count:121 | 121 |
| 353 | | - |
| 354 | d->resolveAbsoluteEntry(); | - |
| 355 | if (fileName.isEmpty()) evaluated: fileName.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:491 |
| 1-491 |
| 356 | return d->absoluteDirEntry.filePath(); executed: return d->absoluteDirEntry.filePath();Execution Count:1 | 1 |
| 357 | if (!d->absoluteDirEntry.isRoot()) evaluated: !d->absoluteDirEntry.isRoot()| yes Evaluation Count:490 | yes Evaluation Count:1 |
| 1-490 |
| 358 | return d->absoluteDirEntry.filePath() % QLatin1Char('/') % fileName; executed: return d->absoluteDirEntry.filePath() % QLatin1Char('/') % fileName;Execution Count:490 | 490 |
| 359 | return d->absoluteDirEntry.filePath() % fileName; executed: return d->absoluteDirEntry.filePath() % fileName;Execution Count:1 | 1 |
| 360 | } | - |
| 361 | QString QDir::relativeFilePath(const QString &fileName) const | - |
| 362 | { | - |
| 363 | QString dir = cleanPath(absolutePath()); | - |
| 364 | QString file = cleanPath(fileName); | - |
| 365 | | - |
| 366 | if (isRelativePath(file) || isRelativePath(dir)) evaluated: isRelativePath(file)| yes Evaluation Count:41 | yes Evaluation Count:59 |
partially evaluated: isRelativePath(dir)| no Evaluation Count:0 | yes Evaluation Count:59 |
| 0-59 |
| 367 | return file; executed: return file;Execution Count:41 | 41 |
| 368 | QString result; | - |
| 369 | QStringList dirElts = dir.split(QLatin1Char('/'), QString::SkipEmptyParts); | - |
| 370 | QStringList fileElts = file.split(QLatin1Char('/'), QString::SkipEmptyParts); | - |
| 371 | | - |
| 372 | int i = 0; | - |
| 373 | while (i < dirElts.size() && i < fileElts.size() && evaluated: i < dirElts.size()| yes Evaluation Count:489 | yes Evaluation Count:56 |
partially evaluated: i < fileElts.size()| yes Evaluation Count:489 | no Evaluation Count:0 |
| 0-489 |
| 374 | | - |
| 375 | | - |
| 376 | | - |
| 377 | dirElts.at(i) == fileElts.at(i)) evaluated: dirElts.at(i) == fileElts.at(i)| yes Evaluation Count:486 | yes Evaluation Count:3 |
| 3-486 |
| 378 | | - |
| 379 | ++i; executed: ++i;Execution Count:486 | 486 |
| 380 | | - |
| 381 | for (int j = 0; j < dirElts.size() - i; ++j) evaluated: j < dirElts.size() - i| yes Evaluation Count:22 | yes Evaluation Count:59 |
| 22-59 |
| 382 | result += QLatin1String("../"); executed: result += QLatin1String("../");Execution Count:22 | 22 |
| 383 | | - |
| 384 | for (int j = i; j < fileElts.size(); ++j) { evaluated: j < fileElts.size()| yes Evaluation Count:85 | yes Evaluation Count:59 |
| 59-85 |
| 385 | result += fileElts.at(j); | - |
| 386 | if (j < fileElts.size() - 1) evaluated: j < fileElts.size() - 1| yes Evaluation Count:26 | yes Evaluation Count:59 |
| 26-59 |
| 387 | result += QLatin1Char('/'); executed: result += QLatin1Char('/');Execution Count:26 | 26 |
| 388 | } executed: }Execution Count:85 | 85 |
| 389 | | - |
| 390 | return result; executed: return result;Execution Count:59 | 59 |
| 391 | } | - |
| 392 | QString QDir::toNativeSeparators(const QString &pathName) | - |
| 393 | { | - |
| 394 | return pathName; executed: return pathName;Execution Count:50746 | 50746 |
| 395 | } | - |
| 396 | QString QDir::fromNativeSeparators(const QString &pathName) | - |
| 397 | { | - |
| 398 | return pathName; executed: return pathName;Execution Count:324249 | 324249 |
| 399 | } | - |
| 400 | bool QDir::cd(const QString &dirName) | - |
| 401 | { | - |
| 402 | | - |
| 403 | const QDirPrivate * const d = d_ptr.constData(); | - |
| 404 | | - |
| 405 | if (dirName.isEmpty() || dirName == QLatin1String(".")) partially evaluated: dirName.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:47 |
evaluated: dirName == QLatin1String(".")| yes Evaluation Count:1 | yes Evaluation Count:46 |
| 0-47 |
| 406 | return true; executed: return true;Execution Count:1 | 1 |
| 407 | QString newPath; | - |
| 408 | if (isAbsolutePath(dirName)) { evaluated: isAbsolutePath(dirName)| yes Evaluation Count:3 | yes Evaluation Count:43 |
| 3-43 |
| 409 | newPath = cleanPath(dirName); | - |
| 410 | } else { executed: }Execution Count:3 | 3 |
| 411 | if (isRoot()) evaluated: isRoot()| yes Evaluation Count:4 | yes Evaluation Count:39 |
| 4-39 |
| 412 | newPath = d->dirEntry.filePath(); executed: newPath = d->dirEntry.filePath();Execution Count:4 | 4 |
| 413 | else | - |
| 414 | newPath = d->dirEntry.filePath() % QLatin1Char('/'); executed: newPath = d->dirEntry.filePath() % QLatin1Char('/');Execution Count:39 | 39 |
| 415 | newPath += dirName; | - |
| 416 | if (dirName.indexOf(QLatin1Char('/')) >= 0 evaluated: dirName.indexOf(QLatin1Char('/')) >= 0| yes Evaluation Count:4 | yes Evaluation Count:39 |
| 4-39 |
| 417 | || dirName == QLatin1String("..") evaluated: dirName == QLatin1String("..")| yes Evaluation Count:26 | yes Evaluation Count:13 |
| 13-26 |
| 418 | || d->dirEntry.filePath() == QLatin1String(".")) { evaluated: d->dirEntry.filePath() == QLatin1String(".")| yes Evaluation Count:2 | yes Evaluation Count:11 |
| 2-11 |
| 419 | newPath = cleanPath(newPath); | - |
| 420 | | - |
| 421 | | - |
| 422 | if (newPath.startsWith(QLatin1String("/../")) || newPath == QLatin1String("/..")) partially evaluated: newPath.startsWith(QLatin1String("/../"))| no Evaluation Count:0 | yes Evaluation Count:32 |
evaluated: newPath == QLatin1String("/..")| yes Evaluation Count:5 | yes Evaluation Count:27 |
| 0-32 |
| 423 | return false; executed: return false;Execution Count:5 | 5 |
| 424 | if (newPath.startsWith(QLatin1String(".."))) { evaluated: newPath.startsWith(QLatin1String(".."))| yes Evaluation Count:2 | yes Evaluation Count:25 |
| 2-25 |
| 425 | newPath = QFileInfo(newPath).absoluteFilePath(); | - |
| 426 | } executed: }Execution Count:2 | 2 |
| 427 | } executed: }Execution Count:27 | 27 |
| 428 | } executed: }Execution Count:38 | 38 |
| 429 | | - |
| 430 | QScopedPointer<QDirPrivate> dir(new QDirPrivate(*d_ptr.constData())); | - |
| 431 | dir->setPath(newPath); | - |
| 432 | if (!dir->exists()) evaluated: !dir->exists()| yes Evaluation Count:3 | yes Evaluation Count:38 |
| 3-38 |
| 433 | return false; executed: return false;Execution Count:3 | 3 |
| 434 | | - |
| 435 | d_ptr = dir.take(); | - |
| 436 | return true; executed: return true;Execution Count:38 | 38 |
| 437 | } | - |
| 438 | bool QDir::cdUp() | - |
| 439 | { | - |
| 440 | return cd(QString::fromLatin1("..")); executed: return cd(QString::fromLatin1(".."));Execution Count:23 | 23 |
| 441 | } | - |
| 442 | | - |
| 443 | | - |
| 444 | | - |
| 445 | | - |
| 446 | QStringList QDir::nameFilters() const | - |
| 447 | { | - |
| 448 | const QDirPrivate* d = d_ptr.constData(); | - |
| 449 | return d->nameFilters; executed: return d->nameFilters;Execution Count:13 | 13 |
| 450 | } | - |
| 451 | void QDir::setNameFilters(const QStringList &nameFilters) | - |
| 452 | { | - |
| 453 | QDirPrivate* d = d_ptr.data(); | - |
| 454 | d->initFileEngine(); | - |
| 455 | d->clearFileLists(); | - |
| 456 | | - |
| 457 | d->nameFilters = nameFilters; | - |
| 458 | } executed: }Execution Count:248 | 248 |
| 459 | void QDir::addResourceSearchPath(const QString &path) | - |
| 460 | { | - |
| 461 | | - |
| 462 | QResource::addSearchPath(path); | - |
| 463 | | - |
| 464 | | - |
| 465 | | - |
| 466 | } | 0 |
| 467 | void QDir::setSearchPaths(const QString &prefix, const QStringList &searchPaths) | - |
| 468 | { | - |
| 469 | if (prefix.length() < 2) { partially evaluated: prefix.length() < 2| no Evaluation Count:0 | yes Evaluation Count:35 |
| 0-35 |
| 470 | QMessageLogger("io/qdir.cpp", 1008, __PRETTY_FUNCTION__).warning("QDir::setSearchPaths: Prefix must be longer than 1 character"); | - |
| 471 | return; | 0 |
| 472 | } | - |
| 473 | | - |
| 474 | for (int i = 0; i < prefix.count(); ++i) { evaluated: i < prefix.count()| yes Evaluation Count:318 | yes Evaluation Count:35 |
| 35-318 |
| 475 | if (!prefix.at(i).isLetterOrNumber()) { partially evaluated: !prefix.at(i).isLetterOrNumber()| no Evaluation Count:0 | yes Evaluation Count:318 |
| 0-318 |
| 476 | QMessageLogger("io/qdir.cpp", 1014, __PRETTY_FUNCTION__).warning("QDir::setSearchPaths: Prefix can only contain letters or numbers"); | - |
| 477 | return; | 0 |
| 478 | } | - |
| 479 | } executed: }Execution Count:318 | 318 |
| 480 | | - |
| 481 | QWriteLocker lock(&QCoreGlobalData::instance()->dirSearchPathsLock); | - |
| 482 | QMap<QString, QStringList> &paths = QCoreGlobalData::instance()->dirSearchPaths; | - |
| 483 | if (searchPaths.isEmpty()) { evaluated: searchPaths.isEmpty()| yes Evaluation Count:22 | yes Evaluation Count:13 |
| 13-22 |
| 484 | paths.remove(prefix); | - |
| 485 | } else { executed: }Execution Count:22 | 22 |
| 486 | paths.insert(prefix, searchPaths); | - |
| 487 | } executed: }Execution Count:13 | 13 |
| 488 | } | - |
| 489 | void QDir::addSearchPath(const QString &prefix, const QString &path) | - |
| 490 | { | - |
| 491 | if (path.isEmpty()) partially evaluated: path.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-13 |
| 492 | return; | 0 |
| 493 | | - |
| 494 | QWriteLocker lock(&QCoreGlobalData::instance()->dirSearchPathsLock); | - |
| 495 | QCoreGlobalData::instance()->dirSearchPaths[prefix] += path; | - |
| 496 | } executed: }Execution Count:13 | 13 |
| 497 | QStringList QDir::searchPaths(const QString &prefix) | - |
| 498 | { | - |
| 499 | QReadLocker lock(&QCoreGlobalData::instance()->dirSearchPathsLock); | - |
| 500 | return QCoreGlobalData::instance()->dirSearchPaths.value(prefix); executed: return QCoreGlobalData::instance()->dirSearchPaths.value(prefix);Execution Count:116 | 116 |
| 501 | } | - |
| 502 | | - |
| 503 | | - |
| 504 | | - |
| 505 | | - |
| 506 | | - |
| 507 | | - |
| 508 | QDir::Filters QDir::filter() const | - |
| 509 | { | - |
| 510 | const QDirPrivate* d = d_ptr.constData(); | - |
| 511 | return d->filters; executed: return d->filters;Execution Count:16 | 16 |
| 512 | } | - |
| 513 | void QDir::setFilter(Filters filters) | - |
| 514 | { | - |
| 515 | QDirPrivate* d = d_ptr.data(); | - |
| 516 | d->initFileEngine(); | - |
| 517 | d->clearFileLists(); | - |
| 518 | | - |
| 519 | d->filters = filters; | - |
| 520 | } executed: }Execution Count:245 | 245 |
| 521 | | - |
| 522 | | - |
| 523 | | - |
| 524 | | - |
| 525 | | - |
| 526 | | - |
| 527 | QDir::SortFlags QDir::sorting() const | - |
| 528 | { | - |
| 529 | const QDirPrivate* d = d_ptr.constData(); | - |
| 530 | return d->sort; executed: return d->sort;Execution Count:16 | 16 |
| 531 | } | - |
| 532 | void QDir::setSorting(SortFlags sort) | - |
| 533 | { | - |
| 534 | QDirPrivate* d = d_ptr.data(); | - |
| 535 | d->initFileEngine(); | - |
| 536 | d->clearFileLists(); | - |
| 537 | | - |
| 538 | d->sort = sort; | - |
| 539 | } executed: }Execution Count:5 | 5 |
| 540 | uint QDir::count() const | - |
| 541 | { | - |
| 542 | const QDirPrivate* d = d_ptr.constData(); | - |
| 543 | d->initFileLists(*this); | - |
| 544 | return d->files.count(); executed: return d->files.count();Execution Count:10 | 10 |
| 545 | } | - |
| 546 | QString QDir::operator[](int pos) const | - |
| 547 | { | - |
| 548 | const QDirPrivate* d = d_ptr.constData(); | - |
| 549 | d->initFileLists(*this); | - |
| 550 | return d->files[pos]; executed: return d->files[pos];Execution Count:4 | 4 |
| 551 | } | - |
| 552 | QStringList QDir::entryList(Filters filters, SortFlags sort) const | - |
| 553 | { | - |
| 554 | const QDirPrivate* d = d_ptr.constData(); | - |
| 555 | return entryList(d->nameFilters, filters, sort); executed: return entryList(d->nameFilters, filters, sort);Execution Count:441 | 441 |
| 556 | } | - |
| 557 | QFileInfoList QDir::entryInfoList(Filters filters, SortFlags sort) const | - |
| 558 | { | - |
| 559 | const QDirPrivate* d = d_ptr.constData(); | - |
| 560 | return entryInfoList(d->nameFilters, filters, sort); executed: return entryInfoList(d->nameFilters, filters, sort);Execution Count:163 | 163 |
| 561 | } | - |
| 562 | QStringList QDir::entryList(const QStringList &nameFilters, Filters filters, | - |
| 563 | SortFlags sort) const | - |
| 564 | { | - |
| 565 | const QDirPrivate* d = d_ptr.constData(); | - |
| 566 | | - |
| 567 | if (filters == NoFilter) evaluated: filters == NoFilter| yes Evaluation Count:64 | yes Evaluation Count:430 |
| 64-430 |
| 568 | filters = d->filters; executed: filters = d->filters;Execution Count:64 | 64 |
| 569 | if (sort == NoSort) evaluated: sort == NoSort| yes Evaluation Count:456 | yes Evaluation Count:38 |
| 38-456 |
| 570 | sort = d->sort; executed: sort = d->sort;Execution Count:456 | 456 |
| 571 | | - |
| 572 | if (filters == d->filters && sort == d->sort && nameFilters == d->nameFilters) { evaluated: filters == d->filters| yes Evaluation Count:90 | yes Evaluation Count:404 |
evaluated: sort == d->sort| yes Evaluation Count:78 | yes Evaluation Count:12 |
evaluated: nameFilters == d->nameFilters| yes Evaluation Count:72 | yes Evaluation Count:6 |
| 6-404 |
| 573 | d->initFileLists(*this); | - |
| 574 | return d->files; executed: return d->files;Execution Count:72 | 72 |
| 575 | } | - |
| 576 | | - |
| 577 | QFileInfoList l; | - |
| 578 | QDirIterator it(d->dirEntry.filePath(), nameFilters, filters); | - |
| 579 | while (it.hasNext()) { evaluated: it.hasNext()| yes Evaluation Count:3170 | yes Evaluation Count:422 |
| 422-3170 |
| 580 | it.next(); | - |
| 581 | l.append(it.fileInfo()); | - |
| 582 | } executed: }Execution Count:3170 | 3170 |
| 583 | QStringList ret; | - |
| 584 | d->sortFileList(sort, l, &ret, 0); | - |
| 585 | return ret; executed: return ret;Execution Count:422 | 422 |
| 586 | } | - |
| 587 | QFileInfoList QDir::entryInfoList(const QStringList &nameFilters, Filters filters, | - |
| 588 | SortFlags sort) const | - |
| 589 | { | - |
| 590 | const QDirPrivate* d = d_ptr.constData(); | - |
| 591 | | - |
| 592 | if (filters == NoFilter) evaluated: filters == NoFilter| yes Evaluation Count:13 | yes Evaluation Count:721 |
| 13-721 |
| 593 | filters = d->filters; executed: filters = d->filters;Execution Count:13 | 13 |
| 594 | if (sort == NoSort) evaluated: sort == NoSort| yes Evaluation Count:170 | yes Evaluation Count:564 |
| 170-564 |
| 595 | sort = d->sort; executed: sort = d->sort;Execution Count:170 | 170 |
| 596 | | - |
| 597 | if (filters == d->filters && sort == d->sort && nameFilters == d->nameFilters) { evaluated: filters == d->filters| yes Evaluation Count:13 | yes Evaluation Count:721 |
partially evaluated: sort == d->sort| yes Evaluation Count:13 | no Evaluation Count:0 |
evaluated: nameFilters == d->nameFilters| yes Evaluation Count:9 | yes Evaluation Count:4 |
| 0-721 |
| 598 | d->initFileLists(*this); | - |
| 599 | return d->fileInfos; executed: return d->fileInfos;Execution Count:9 | 9 |
| 600 | } | - |
| 601 | | - |
| 602 | QFileInfoList l; | - |
| 603 | QDirIterator it(d->dirEntry.filePath(), nameFilters, filters); | - |
| 604 | while (it.hasNext()) { evaluated: it.hasNext()| yes Evaluation Count:11781 | yes Evaluation Count:725 |
| 725-11781 |
| 605 | it.next(); | - |
| 606 | l.append(it.fileInfo()); | - |
| 607 | } executed: }Execution Count:11781 | 11781 |
| 608 | QFileInfoList ret; | - |
| 609 | d->sortFileList(sort, l, 0, &ret); | - |
| 610 | return ret; executed: return ret;Execution Count:725 | 725 |
| 611 | } | - |
| 612 | bool QDir::mkdir(const QString &dirName) const | - |
| 613 | { | - |
| 614 | const QDirPrivate* d = d_ptr.constData(); | - |
| 615 | | - |
| 616 | if (dirName.isEmpty()) { partially evaluated: dirName.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:1332 |
| 0-1332 |
| 617 | QMessageLogger("io/qdir.cpp", 1381, __PRETTY_FUNCTION__).warning("QDir::mkdir: Empty or null file name(s)"); | - |
| 618 | return false; never executed: return false; | 0 |
| 619 | } | - |
| 620 | | - |
| 621 | QString fn = filePath(dirName); | - |
| 622 | if (d->fileEngine.isNull()) partially evaluated: d->fileEngine.isNull()| yes Evaluation Count:1332 | no Evaluation Count:0 |
| 0-1332 |
| 623 | return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), false); executed: return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), false);Execution Count:1332 | 1332 |
| 624 | return d->fileEngine->mkdir(fn, false); never executed: return d->fileEngine->mkdir(fn, false); | 0 |
| 625 | } | - |
| 626 | bool QDir::rmdir(const QString &dirName) const | - |
| 627 | { | - |
| 628 | const QDirPrivate* d = d_ptr.constData(); | - |
| 629 | | - |
| 630 | if (dirName.isEmpty()) { evaluated: dirName.isEmpty()| yes Evaluation Count:2 | yes Evaluation Count:2392 |
| 2-2392 |
| 631 | QMessageLogger("io/qdir.cpp", 1405, __PRETTY_FUNCTION__).warning("QDir::rmdir: Empty or null file name(s)"); | - |
| 632 | return false; executed: return false;Execution Count:2 | 2 |
| 633 | } | - |
| 634 | | - |
| 635 | QString fn = filePath(dirName); | - |
| 636 | if (d->fileEngine.isNull()) partially evaluated: d->fileEngine.isNull()| yes Evaluation Count:2392 | no Evaluation Count:0 |
| 0-2392 |
| 637 | return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), false); executed: return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), false);Execution Count:2392 | 2392 |
| 638 | | - |
| 639 | return d->fileEngine->rmdir(fn, false); never executed: return d->fileEngine->rmdir(fn, false); | 0 |
| 640 | } | - |
| 641 | bool QDir::mkpath(const QString &dirPath) const | - |
| 642 | { | - |
| 643 | const QDirPrivate* d = d_ptr.constData(); | - |
| 644 | | - |
| 645 | if (dirPath.isEmpty()) { partially evaluated: dirPath.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:216 |
| 0-216 |
| 646 | QMessageLogger("io/qdir.cpp", 1433, __PRETTY_FUNCTION__).warning("QDir::mkpath: Empty or null file name(s)"); | - |
| 647 | return false; never executed: return false; | 0 |
| 648 | } | - |
| 649 | | - |
| 650 | QString fn = filePath(dirPath); | - |
| 651 | if (d->fileEngine.isNull()) partially evaluated: d->fileEngine.isNull()| yes Evaluation Count:216 | no Evaluation Count:0 |
| 0-216 |
| 652 | return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), true); executed: return QFileSystemEngine::createDirectory(QFileSystemEntry(fn), true);Execution Count:216 | 216 |
| 653 | return d->fileEngine->mkdir(fn, true); never executed: return d->fileEngine->mkdir(fn, true); | 0 |
| 654 | } | - |
| 655 | bool QDir::rmpath(const QString &dirPath) const | - |
| 656 | { | - |
| 657 | const QDirPrivate* d = d_ptr.constData(); | - |
| 658 | | - |
| 659 | if (dirPath.isEmpty()) { partially evaluated: dirPath.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 660 | QMessageLogger("io/qdir.cpp", 1459, __PRETTY_FUNCTION__).warning("QDir::rmpath: Empty or null file name(s)"); | - |
| 661 | return false; never executed: return false; | 0 |
| 662 | } | - |
| 663 | | - |
| 664 | QString fn = filePath(dirPath); | - |
| 665 | if (d->fileEngine.isNull()) partially evaluated: d->fileEngine.isNull()| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 666 | return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), true); executed: return QFileSystemEngine::removeDirectory(QFileSystemEntry(fn), true);Execution Count:4 | 4 |
| 667 | return d->fileEngine->rmdir(fn, true); never executed: return d->fileEngine->rmdir(fn, true); | 0 |
| 668 | } | - |
| 669 | bool QDir::removeRecursively() | - |
| 670 | { | - |
| 671 | if (!d_ptr->exists()) evaluated: !d_ptr->exists()| yes Evaluation Count:5 | yes Evaluation Count:2025 |
| 5-2025 |
| 672 | return true; executed: return true;Execution Count:5 | 5 |
| 673 | | - |
| 674 | bool success = true; | - |
| 675 | const QString dirPath = path(); | - |
| 676 | | - |
| 677 | QDirIterator di(dirPath, QDir::AllEntries | QDir::Hidden | QDir::System | QDir::NoDotAndDotDot); | - |
| 678 | while (di.hasNext()) { evaluated: di.hasNext()| yes Evaluation Count:2571 | yes Evaluation Count:2025 |
| 2025-2571 |
| 679 | di.next(); | - |
| 680 | const QFileInfo& fi = di.fileInfo(); | - |
| 681 | bool ok; | - |
| 682 | if (fi.isDir() && !fi.isSymLink()) evaluated: fi.isDir()| yes Evaluation Count:862 | yes Evaluation Count:1709 |
evaluated: !fi.isSymLink()| yes Evaluation Count:861 | yes Evaluation Count:1 |
| 1-1709 |
| 683 | ok = QDir(di.filePath()).removeRecursively(); executed: ok = QDir(di.filePath()).removeRecursively();Execution Count:861 | 861 |
| 684 | else | - |
| 685 | ok = QFile::remove(di.filePath()); executed: ok = QFile::remove(di.filePath());Execution Count:1710 | 1710 |
| 686 | if (!ok) partially evaluated: !ok| no Evaluation Count:0 | yes Evaluation Count:2571 |
| 0-2571 |
| 687 | success = false; never executed: success = false; | 0 |
| 688 | } executed: }Execution Count:2571 | 2571 |
| 689 | | - |
| 690 | if (success) partially evaluated: success| yes Evaluation Count:2025 | no Evaluation Count:0 |
| 0-2025 |
| 691 | success = rmdir(absolutePath()); executed: success = rmdir(absolutePath());Execution Count:2025 | 2025 |
| 692 | | - |
| 693 | return success; executed: return success;Execution Count:2025 | 2025 |
| 694 | } | - |
| 695 | bool QDir::isReadable() const | - |
| 696 | { | - |
| 697 | const QDirPrivate* d = d_ptr.constData(); | - |
| 698 | | - |
| 699 | if (d->fileEngine.isNull()) { partially evaluated: d->fileEngine.isNull()| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 700 | if (!d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission)) partially evaluated: !d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 701 | QFileSystemEngine::fillMetaData(d->dirEntry, d->metaData, QFileSystemMetaData::UserReadPermission); executed: QFileSystemEngine::fillMetaData(d->dirEntry, d->metaData, QFileSystemMetaData::UserReadPermission);Execution Count:2 | 2 |
| 702 | | - |
| 703 | return (d->metaData.permissions() & QFile::ReadUser) != 0; executed: return (d->metaData.permissions() & QFile::ReadUser) != 0;Execution Count:2 | 2 |
| 704 | } | - |
| 705 | | - |
| 706 | const QAbstractFileEngine::FileFlags info = | - |
| 707 | d->fileEngine->fileFlags(QAbstractFileEngine::DirectoryType | - |
| 708 | | QAbstractFileEngine::PermsMask); | - |
| 709 | if (!(info & QAbstractFileEngine::DirectoryType)) never evaluated: !(info & QAbstractFileEngine::DirectoryType) | 0 |
| 710 | return false; never executed: return false; | 0 |
| 711 | return info & QAbstractFileEngine::ReadUserPerm; never executed: return info & QAbstractFileEngine::ReadUserPerm; | 0 |
| 712 | } | - |
| 713 | bool QDir::exists() const | - |
| 714 | { | - |
| 715 | return d_ptr->exists(); executed: return d_ptr->exists();Execution Count:896 | 896 |
| 716 | } | - |
| 717 | bool QDir::isRoot() const | - |
| 718 | { | - |
| 719 | if (d_ptr->fileEngine.isNull()) evaluated: d_ptr->fileEngine.isNull()| yes Evaluation Count:47 | yes Evaluation Count:2 |
| 2-47 |
| 720 | return d_ptr->dirEntry.isRoot(); executed: return d_ptr->dirEntry.isRoot();Execution Count:47 | 47 |
| 721 | return d_ptr->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag; executed: return d_ptr->fileEngine->fileFlags(QAbstractFileEngine::FlagsMask) & QAbstractFileEngine::RootFlag;Execution Count:2 | 2 |
| 722 | } | - |
| 723 | bool QDir::isRelative() const | - |
| 724 | { | - |
| 725 | if (d_ptr->fileEngine.isNull()) evaluated: d_ptr->fileEngine.isNull()| yes Evaluation Count:15 | yes Evaluation Count:1 |
| 1-15 |
| 726 | return d_ptr->dirEntry.isRelative(); executed: return d_ptr->dirEntry.isRelative();Execution Count:15 | 15 |
| 727 | return d_ptr->fileEngine->isRelativePath(); executed: return d_ptr->fileEngine->isRelativePath();Execution Count:1 | 1 |
| 728 | } | - |
| 729 | bool QDir::makeAbsolute() | - |
| 730 | { | - |
| 731 | const QDirPrivate *d = d_ptr.constData(); | - |
| 732 | QScopedPointer<QDirPrivate> dir; | - |
| 733 | if (!d->fileEngine.isNull()) { partially evaluated: !d->fileEngine.isNull()| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 734 | QString absolutePath = d->fileEngine->fileName(QAbstractFileEngine::AbsoluteName); | - |
| 735 | if (QDir::isRelativePath(absolutePath)) never evaluated: QDir::isRelativePath(absolutePath) | 0 |
| 736 | return false; never executed: return false; | 0 |
| 737 | | - |
| 738 | dir.reset(new QDirPrivate(*d_ptr.constData())); | - |
| 739 | dir->setPath(absolutePath); | - |
| 740 | } else { | 0 |
| 741 | d->resolveAbsoluteEntry(); | - |
| 742 | dir.reset(new QDirPrivate(*d_ptr.constData())); | - |
| 743 | dir->setPath(d->absoluteDirEntry.filePath()); | - |
| 744 | } executed: }Execution Count:1 | 1 |
| 745 | d_ptr = dir.take(); | - |
| 746 | return true; executed: return true;Execution Count:1 | 1 |
| 747 | } | - |
| 748 | bool QDir::operator==(const QDir &dir) const | - |
| 749 | { | - |
| 750 | const QDirPrivate *d = d_ptr.constData(); | - |
| 751 | const QDirPrivate *other = dir.d_ptr.constData(); | - |
| 752 | | - |
| 753 | if (d == other) partially evaluated: d == other| no Evaluation Count:0 | yes Evaluation Count:60 |
| 0-60 |
| 754 | return true; never executed: return true; | 0 |
| 755 | Qt::CaseSensitivity sensitive; | - |
| 756 | if (d->fileEngine.isNull() || other->fileEngine.isNull()) { partially evaluated: d->fileEngine.isNull()| yes Evaluation Count:60 | no Evaluation Count:0 |
never evaluated: other->fileEngine.isNull() | 0-60 |
| 757 | if (d->fileEngine.data() != other->fileEngine.data()) partially evaluated: d->fileEngine.data() != other->fileEngine.data()| no Evaluation Count:0 | yes Evaluation Count:60 |
| 0-60 |
| 758 | return false; never executed: return false; | 0 |
| 759 | | - |
| 760 | sensitive = QFileSystemEngine::isCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive; partially evaluated: QFileSystemEngine::isCaseSensitive()| yes Evaluation Count:60 | no Evaluation Count:0 |
| 0-60 |
| 761 | } else { executed: }Execution Count:60 | 60 |
| 762 | if (d->fileEngine->caseSensitive() != other->fileEngine->caseSensitive()) never evaluated: d->fileEngine->caseSensitive() != other->fileEngine->caseSensitive() | 0 |
| 763 | return false; never executed: return false; | 0 |
| 764 | sensitive = d->fileEngine->caseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive; never evaluated: d->fileEngine->caseSensitive() | 0 |
| 765 | } | 0 |
| 766 | | - |
| 767 | if (d->filters == other->filters evaluated: d->filters == other->filters| yes Evaluation Count:56 | yes Evaluation Count:4 |
| 4-56 |
| 768 | && d->sort == other->sort evaluated: d->sort == other->sort| yes Evaluation Count:52 | yes Evaluation Count:4 |
| 4-52 |
| 769 | && d->nameFilters == other->nameFilters) { evaluated: d->nameFilters == other->nameFilters| yes Evaluation Count:48 | yes Evaluation Count:4 |
| 4-48 |
| 770 | | - |
| 771 | | - |
| 772 | if (d->dirEntry.filePath() == other->dirEntry.filePath()) evaluated: d->dirEntry.filePath() == other->dirEntry.filePath()| yes Evaluation Count:22 | yes Evaluation Count:26 |
| 22-26 |
| 773 | return true; executed: return true;Execution Count:22 | 22 |
| 774 | | - |
| 775 | if (exists()) { evaluated: exists()| yes Evaluation Count:22 | yes Evaluation Count:4 |
| 4-22 |
| 776 | if (!dir.exists()) partially evaluated: !dir.exists()| no Evaluation Count:0 | yes Evaluation Count:22 |
| 0-22 |
| 777 | return false; never executed: return false; | 0 |
| 778 | | - |
| 779 | return canonicalPath().compare(dir.canonicalPath(), sensitive) == 0; executed: return canonicalPath().compare(dir.canonicalPath(), sensitive) == 0;Execution Count:22 | 22 |
| 780 | } else { | - |
| 781 | if (dir.exists()) partially evaluated: dir.exists()| no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
| 782 | return false; never executed: return false; | 0 |
| 783 | | - |
| 784 | d->resolveAbsoluteEntry(); | - |
| 785 | other->resolveAbsoluteEntry(); | - |
| 786 | return d->absoluteDirEntry.filePath().compare(other->absoluteDirEntry.filePath(), sensitive) == 0; executed: return d->absoluteDirEntry.filePath().compare(other->absoluteDirEntry.filePath(), sensitive) == 0;Execution Count:4 | 4 |
| 787 | } | - |
| 788 | } | - |
| 789 | return false; executed: return false;Execution Count:12 | 12 |
| 790 | } | - |
| 791 | | - |
| 792 | | - |
| 793 | | - |
| 794 | | - |
| 795 | | - |
| 796 | QDir &QDir::operator=(const QDir &dir) | - |
| 797 | { | - |
| 798 | d_ptr = dir.d_ptr; | - |
| 799 | return *this; executed: return *this;Execution Count:303 | 303 |
| 800 | } | - |
| 801 | QDir &QDir::operator=(const QString &path) | - |
| 802 | { | - |
| 803 | d_ptr->setPath(path); | - |
| 804 | return *this; executed: return *this;Execution Count:1 | 1 |
| 805 | } | - |
| 806 | bool QDir::remove(const QString &fileName) | - |
| 807 | { | - |
| 808 | if (fileName.isEmpty()) { evaluated: fileName.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:17 |
| 1-17 |
| 809 | QMessageLogger("io/qdir.cpp", 1745, __PRETTY_FUNCTION__).warning("QDir::remove: Empty or null file name"); | - |
| 810 | return false; executed: return false;Execution Count:1 | 1 |
| 811 | } | - |
| 812 | return QFile::remove(filePath(fileName)); executed: return QFile::remove(filePath(fileName));Execution Count:17 | 17 |
| 813 | } | - |
| 814 | bool QDir::rename(const QString &oldName, const QString &newName) | - |
| 815 | { | - |
| 816 | if (oldName.isEmpty() || newName.isEmpty()) { evaluated: oldName.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:7 |
evaluated: newName.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:6 |
| 1-7 |
| 817 | QMessageLogger("io/qdir.cpp", 1770, __PRETTY_FUNCTION__).warning("QDir::rename: Empty or null file name(s)"); | - |
| 818 | return false; executed: return false;Execution Count:2 | 2 |
| 819 | } | - |
| 820 | | - |
| 821 | QFile file(filePath(oldName)); | - |
| 822 | if (!file.exists()) evaluated: !file.exists()| yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
| 823 | return false; executed: return false;Execution Count:1 | 1 |
| 824 | return file.rename(filePath(newName)); executed: return file.rename(filePath(newName));Execution Count:5 | 5 |
| 825 | } | - |
| 826 | bool QDir::exists(const QString &name) const | - |
| 827 | { | - |
| 828 | if (name.isEmpty()) { evaluated: name.isEmpty()| yes Evaluation Count:1 | yes Evaluation Count:2262 |
| 1-2262 |
| 829 | QMessageLogger("io/qdir.cpp", 1793, __PRETTY_FUNCTION__).warning("QDir::exists: Empty or null file name"); | - |
| 830 | return false; executed: return false;Execution Count:1 | 1 |
| 831 | } | - |
| 832 | return QFile::exists(filePath(name)); executed: return QFile::exists(filePath(name));Execution Count:2262 | 2262 |
| 833 | } | - |
| 834 | QFileInfoList QDir::drives() | - |
| 835 | { | - |
| 836 | | - |
| 837 | | - |
| 838 | | - |
| 839 | return QFSFileEngine::drives(); executed: return QFSFileEngine::drives();Execution Count:147 | 147 |
| 840 | | - |
| 841 | } | - |
| 842 | QChar QDir::separator() | - |
| 843 | { | - |
| 844 | | - |
| 845 | | - |
| 846 | | - |
| 847 | return QLatin1Char('/'); executed: return QLatin1Char('/');Execution Count:28089 | 28089 |
| 848 | | - |
| 849 | } | - |
| 850 | bool QDir::setCurrent(const QString &path) | - |
| 851 | { | - |
| 852 | return QFileSystemEngine::setCurrentPath(QFileSystemEntry(path)); executed: return QFileSystemEngine::setCurrentPath(QFileSystemEntry(path));Execution Count:312 | 312 |
| 853 | } | - |
| 854 | QString QDir::currentPath() | - |
| 855 | { | - |
| 856 | return QFileSystemEngine::currentPath().filePath(); executed: return QFileSystemEngine::currentPath().filePath();Execution Count:818 | 818 |
| 857 | } | - |
| 858 | QString QDir::homePath() | - |
| 859 | { | - |
| 860 | return QFileSystemEngine::homePath(); executed: return QFileSystemEngine::homePath();Execution Count:794 | 794 |
| 861 | } | - |
| 862 | QString QDir::tempPath() | - |
| 863 | { | - |
| 864 | return QFileSystemEngine::tempPath(); executed: return QFileSystemEngine::tempPath();Execution Count:2929 | 2929 |
| 865 | } | - |
| 866 | QString QDir::rootPath() | - |
| 867 | { | - |
| 868 | return QFileSystemEngine::rootPath(); executed: return QFileSystemEngine::rootPath();Execution Count:39 | 39 |
| 869 | } | - |
| 870 | bool QDir::match(const QStringList &filters, const QString &fileName) | - |
| 871 | { | - |
| 872 | for (QStringList::ConstIterator sit = filters.constBegin(); sit != filters.constEnd(); ++sit) { evaluated: sit != filters.constEnd()| yes Evaluation Count:14 | yes Evaluation Count:4 |
| 4-14 |
| 873 | QRegExp rx(*sit, Qt::CaseInsensitive, QRegExp::Wildcard); | - |
| 874 | if (rx.exactMatch(fileName)) evaluated: rx.exactMatch(fileName)| yes Evaluation Count:6 | yes Evaluation Count:8 |
| 6-8 |
| 875 | return true; executed: return true;Execution Count:6 | 6 |
| 876 | } executed: }Execution Count:8 | 8 |
| 877 | return false; executed: return false;Execution Count:4 | 4 |
| 878 | } | - |
| 879 | bool QDir::match(const QString &filter, const QString &fileName) | - |
| 880 | { | - |
| 881 | return match(nameFiltersFromString(filter), fileName); executed: return match(nameFiltersFromString(filter), fileName);Execution Count:5 | 5 |
| 882 | } | - |
| 883 | QString QDir::cleanPath(const QString &path) | - |
| 884 | { | - |
| 885 | if (path.isEmpty()) evaluated: path.isEmpty()| yes Evaluation Count:299 | yes Evaluation Count:19911 |
| 299-19911 |
| 886 | return path; executed: return path;Execution Count:299 | 299 |
| 887 | QString name = path; | - |
| 888 | QChar dir_separator = separator(); | - |
| 889 | if (dir_separator != QLatin1Char('/')) partially evaluated: dir_separator != QLatin1Char('/')| no Evaluation Count:0 | yes Evaluation Count:19911 |
| 0-19911 |
| 890 | name.replace(dir_separator, QLatin1Char('/')); never executed: name.replace(dir_separator, QLatin1Char('/')); | 0 |
| 891 | | - |
| 892 | int used = 0, levels = 0; | - |
| 893 | const int len = name.length(); | - |
| 894 | QVarLengthArray<QChar> outVector(len); | - |
| 895 | QChar *out = outVector.data(); | - |
| 896 | | - |
| 897 | const QChar *p = name.unicode(); | - |
| 898 | for (int i = 0, last = -1, iwrite = 0; i < len; ++i) { evaluated: i < len| yes Evaluation Count:784287 | yes Evaluation Count:19542 |
| 19542-784287 |
| 899 | if (p[i] == QLatin1Char('/')) { evaluated: p[i] == QLatin1Char('/')| yes Evaluation Count:90258 | yes Evaluation Count:694029 |
| 90258-694029 |
| 900 | while (i+1 < len && p[i+1] == QLatin1Char('/')) { evaluated: i+1 < len| yes Evaluation Count:87125 | yes Evaluation Count:3186 |
evaluated: p[i+1] == QLatin1Char('/')| yes Evaluation Count:53 | yes Evaluation Count:87072 |
| 53-87125 |
| 901 | | - |
| 902 | | - |
| 903 | | - |
| 904 | | - |
| 905 | i++; | - |
| 906 | } executed: }Execution Count:53 | 53 |
| 907 | bool eaten = false; | - |
| 908 | if (i+1 < len && p[i+1] == QLatin1Char('.')) { evaluated: i+1 < len| yes Evaluation Count:87072 | yes Evaluation Count:3186 |
evaluated: p[i+1] == QLatin1Char('.')| yes Evaluation Count:3416 | yes Evaluation Count:83656 |
| 3186-87072 |
| 909 | int dotcount = 1; | - |
| 910 | if (i+2 < len && p[i+2] == QLatin1Char('.')) evaluated: i+2 < len| yes Evaluation Count:3245 | yes Evaluation Count:171 |
evaluated: p[i+2] == QLatin1Char('.')| yes Evaluation Count:3203 | yes Evaluation Count:42 |
| 42-3245 |
| 911 | dotcount++; executed: dotcount++;Execution Count:3203 | 3203 |
| 912 | if (i == len - dotcount - 1) { evaluated: i == len - dotcount - 1| yes Evaluation Count:563 | yes Evaluation Count:2853 |
| 563-2853 |
| 913 | if (dotcount == 1) { evaluated: dotcount == 1| yes Evaluation Count:171 | yes Evaluation Count:392 |
| 171-392 |
| 914 | break; executed: break;Execution Count:171 | 171 |
| 915 | } else if (levels) { evaluated: levels| yes Evaluation Count:198 | yes Evaluation Count:194 |
| 194-198 |
| 916 | if (last == -1) { evaluated: last == -1| yes Evaluation Count:9 | yes Evaluation Count:189 |
| 9-189 |
| 917 | for (int i2 = iwrite-1; i2 >= 0; i2--) { partially evaluated: i2 >= 0| yes Evaluation Count:62 | no Evaluation Count:0 |
| 0-62 |
| 918 | if (out[i2] == QLatin1Char('/')) { evaluated: out[i2] == QLatin1Char('/')| yes Evaluation Count:9 | yes Evaluation Count:53 |
| 9-53 |
| 919 | last = i2; | - |
| 920 | break; executed: break;Execution Count:9 | 9 |
| 921 | } | - |
| 922 | } executed: }Execution Count:53 | 53 |
| 923 | } executed: }Execution Count:9 | 9 |
| 924 | used -= iwrite - last - 1; | - |
| 925 | break; executed: break;Execution Count:198 | 198 |
| 926 | } | - |
| 927 | } else if (p[i+dotcount+1] == QLatin1Char('/')) { evaluated: p[i+dotcount+1] == QLatin1Char('/')| yes Evaluation Count:2799 | yes Evaluation Count:54 |
| 54-2799 |
| 928 | if (dotcount == 2 && levels) { evaluated: dotcount == 2| yes Evaluation Count:2785 | yes Evaluation Count:14 |
evaluated: levels| yes Evaluation Count:339 | yes Evaluation Count:2446 |
| 14-2785 |
| 929 | if (last == -1 || iwrite - last == 1) { evaluated: last == -1| yes Evaluation Count:144 | yes Evaluation Count:195 |
partially evaluated: iwrite - last == 1| no Evaluation Count:0 | yes Evaluation Count:195 |
| 0-195 |
| 930 | for (int i2 = (last == -1) ? (iwrite-1) : (last-1); i2 >= 0; i2--) { partially evaluated: i2 >= 0| yes Evaluation Count:996 | no Evaluation Count:0 |
| 0-996 |
| 931 | if (out[i2] == QLatin1Char('/')) { evaluated: out[i2] == QLatin1Char('/')| yes Evaluation Count:144 | yes Evaluation Count:852 |
| 144-852 |
| 932 | eaten = true; | - |
| 933 | last = i2; | - |
| 934 | break; executed: break;Execution Count:144 | 144 |
| 935 | } | - |
| 936 | } executed: }Execution Count:852 | 852 |
| 937 | } else { executed: }Execution Count:144 | 144 |
| 938 | eaten = true; | - |
| 939 | } executed: }Execution Count:195 | 195 |
| 940 | if (eaten) { partially evaluated: eaten| yes Evaluation Count:339 | no Evaluation Count:0 |
| 0-339 |
| 941 | levels--; | - |
| 942 | used -= iwrite - last; | - |
| 943 | iwrite = last; | - |
| 944 | last = -1; | - |
| 945 | } executed: }Execution Count:339 | 339 |
| 946 | } else if (dotcount == 2 && i > 0 && p[i - 1] != QLatin1Char('.')) { executed: }Execution Count:339 evaluated: dotcount == 2| yes Evaluation Count:2446 | yes Evaluation Count:14 |
evaluated: i > 0| yes Evaluation Count:2358 | yes Evaluation Count:88 |
partially evaluated: p[i - 1] != QLatin1Char('.')| no Evaluation Count:0 | yes Evaluation Count:2358 |
| 0-2446 |
| 947 | eaten = true; | - |
| 948 | used -= iwrite - qMax(0, last); | - |
| 949 | iwrite = qMax(0, last); | - |
| 950 | last = -1; | - |
| 951 | ++i; | - |
| 952 | } else if (dotcount == 1) { evaluated: dotcount == 1| yes Evaluation Count:14 | yes Evaluation Count:2446 |
| 0-2446 |
| 953 | eaten = true; | - |
| 954 | } executed: }Execution Count:14 | 14 |
| 955 | if (eaten) evaluated: eaten| yes Evaluation Count:353 | yes Evaluation Count:2446 |
| 353-2446 |
| 956 | i += dotcount; executed: i += dotcount;Execution Count:353 | 353 |
| 957 | } else { executed: }Execution Count:2799 | 2799 |
| 958 | levels++; | - |
| 959 | } executed: }Execution Count:54 | 54 |
| 960 | } else if (last != -1 && iwrite - last == 1) { evaluated: last != -1| yes Evaluation Count:66992 | yes Evaluation Count:19850 |
partially evaluated: iwrite - last == 1| no Evaluation Count:0 | yes Evaluation Count:66992 |
| 0-66992 |
| 961 | | - |
| 962 | | - |
| 963 | | - |
| 964 | eaten = true; | - |
| 965 | | - |
| 966 | last = -1; | - |
| 967 | } else if (last != -1 && i == len-1) { evaluated: last != -1| yes Evaluation Count:66992 | yes Evaluation Count:19850 |
evaluated: i == len-1| yes Evaluation Count:3055 | yes Evaluation Count:63937 |
| 0-66992 |
| 968 | eaten = true; | - |
| 969 | } else { executed: }Execution Count:3055 | 3055 |
| 970 | levels++; | - |
| 971 | } executed: }Execution Count:83787 | 83787 |
| 972 | if (!eaten) evaluated: !eaten| yes Evaluation Count:86481 | yes Evaluation Count:3408 |
| 3408-86481 |
| 973 | last = i - (i - iwrite); executed: last = i - (i - iwrite);Execution Count:86481 | 86481 |
| 974 | else | - |
| 975 | continue; executed: continue;Execution Count:3408 | 3408 |
| 976 | } else if (!i && p[i] == QLatin1Char('.')) { evaluated: !i| yes Evaluation Count:68 | yes Evaluation Count:693961 |
evaluated: p[i] == QLatin1Char('.')| yes Evaluation Count:20 | yes Evaluation Count:48 |
| 20-693961 |
| 977 | int dotcount = 1; | - |
| 978 | if (len >= 1 && p[1] == QLatin1Char('.')) partially evaluated: len >= 1| yes Evaluation Count:20 | no Evaluation Count:0 |
evaluated: p[1] == QLatin1Char('.')| yes Evaluation Count:9 | yes Evaluation Count:11 |
| 0-20 |
| 979 | dotcount++; executed: dotcount++;Execution Count:9 | 9 |
| 980 | if (len >= dotcount && p[dotcount] == QLatin1Char('/')) { partially evaluated: len >= dotcount| yes Evaluation Count:20 | no Evaluation Count:0 |
evaluated: p[dotcount] == QLatin1Char('/')| yes Evaluation Count:10 | yes Evaluation Count:10 |
| 0-20 |
| 981 | if (dotcount == 1) { evaluated: dotcount == 1| yes Evaluation Count:6 | yes Evaluation Count:4 |
| 4-6 |
| 982 | i++; | - |
| 983 | while (i+1 < len-1 && p[i+1] == QLatin1Char('/')) partially evaluated: i+1 < len-1| yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: p[i+1] == QLatin1Char('/')| yes Evaluation Count:1 | yes Evaluation Count:6 |
| 0-7 |
| 984 | i++; executed: i++;Execution Count:1 | 1 |
| 985 | continue; executed: continue;Execution Count:6 | 6 |
| 986 | } | - |
| 987 | } executed: }Execution Count:4 | 4 |
| 988 | } executed: }Execution Count:14 | 14 |
| 989 | out[iwrite++] = p[i]; | - |
| 990 | used++; | - |
| 991 | } executed: }Execution Count:780504 | 780504 |
| 992 | | - |
| 993 | QString ret = (used == len ? name : QString(out, used)); evaluated: used == len| yes Evaluation Count:16243 | yes Evaluation Count:3668 |
| 3668-16243 |
| 994 | | - |
| 995 | if (ret.length() > 1 && ret.endsWith(QLatin1Char('/'))) { evaluated: ret.length() > 1| yes Evaluation Count:19743 | yes Evaluation Count:168 |
evaluated: ret.endsWith(QLatin1Char('/'))| yes Evaluation Count:174 | yes Evaluation Count:19569 |
| 168-19743 |
| 996 | | - |
| 997 | | - |
| 998 | | - |
| 999 | ret.chop(1); | - |
| 1000 | } executed: }Execution Count:174 | 174 |
| 1001 | | - |
| 1002 | return ret; executed: return ret;Execution Count:19911 | 19911 |
| 1003 | } | - |
| 1004 | | - |
| 1005 | | - |
| 1006 | | - |
| 1007 | | - |
| 1008 | | - |
| 1009 | | - |
| 1010 | | - |
| 1011 | bool QDir::isRelativePath(const QString &path) | - |
| 1012 | { | - |
| 1013 | return QFileInfo(path).isRelative(); executed: return QFileInfo(path).isRelative();Execution Count:7780 | 7780 |
| 1014 | } | - |
| 1015 | | - |
| 1016 | | - |
| 1017 | | - |
| 1018 | | - |
| 1019 | void QDir::refresh() const | - |
| 1020 | { | - |
| 1021 | QDirPrivate *d = const_cast<QDir*>(this)->d_ptr.data(); | - |
| 1022 | d->metaData.clear(); | - |
| 1023 | d->initFileEngine(); | - |
| 1024 | d->clearFileLists(); | - |
| 1025 | } executed: }Execution Count:2 | 2 |
| 1026 | | - |
| 1027 | | - |
| 1028 | | - |
| 1029 | | - |
| 1030 | QDirPrivate* QDir::d_func() | - |
| 1031 | { | - |
| 1032 | return d_ptr.data(); never executed: return d_ptr.data(); | 0 |
| 1033 | } | - |
| 1034 | QStringList QDir::nameFiltersFromString(const QString &nameFilter) | - |
| 1035 | { | - |
| 1036 | return QDirPrivate::splitFilters(nameFilter); executed: return QDirPrivate::splitFilters(nameFilter);Execution Count:32 | 32 |
| 1037 | } | - |
| 1038 | QDebug operator<<(QDebug debug, QDir::Filters filters) | - |
| 1039 | { | - |
| 1040 | QStringList flags; | - |
| 1041 | if (filters == QDir::NoFilter) { never evaluated: filters == QDir::NoFilter | 0 |
| 1042 | flags << QLatin1String("NoFilter"); | - |
| 1043 | } else { | 0 |
| 1044 | if (filters & QDir::Dirs) flags << QLatin1String("Dirs"); never executed: flags << QLatin1String("Dirs"); never evaluated: filters & QDir::Dirs | 0 |
| 1045 | if (filters & QDir::AllDirs) flags << QLatin1String("AllDirs"); never executed: flags << QLatin1String("AllDirs"); never evaluated: filters & QDir::AllDirs | 0 |
| 1046 | if (filters & QDir::Files) flags << QLatin1String("Files"); never executed: flags << QLatin1String("Files"); never evaluated: filters & QDir::Files | 0 |
| 1047 | if (filters & QDir::Drives) flags << QLatin1String("Drives"); never executed: flags << QLatin1String("Drives"); never evaluated: filters & QDir::Drives | 0 |
| 1048 | if (filters & QDir::NoSymLinks) flags << QLatin1String("NoSymLinks"); never executed: flags << QLatin1String("NoSymLinks"); never evaluated: filters & QDir::NoSymLinks | 0 |
| 1049 | if (filters & QDir::NoDot) flags << QLatin1String("NoDot"); never executed: flags << QLatin1String("NoDot"); never evaluated: filters & QDir::NoDot | 0 |
| 1050 | if (filters & QDir::NoDotDot) flags << QLatin1String("NoDotDot"); never executed: flags << QLatin1String("NoDotDot"); never evaluated: filters & QDir::NoDotDot | 0 |
| 1051 | if ((filters & QDir::AllEntries) == QDir::AllEntries) flags << QLatin1String("AllEntries"); never executed: flags << QLatin1String("AllEntries"); never evaluated: (filters & QDir::AllEntries) == QDir::AllEntries | 0 |
| 1052 | if (filters & QDir::Readable) flags << QLatin1String("Readable"); never executed: flags << QLatin1String("Readable"); never evaluated: filters & QDir::Readable | 0 |
| 1053 | if (filters & QDir::Writable) flags << QLatin1String("Writable"); never executed: flags << QLatin1String("Writable"); never evaluated: filters & QDir::Writable | 0 |
| 1054 | if (filters & QDir::Executable) flags << QLatin1String("Executable"); never executed: flags << QLatin1String("Executable"); never evaluated: filters & QDir::Executable | 0 |
| 1055 | if (filters & QDir::Modified) flags << QLatin1String("Modified"); never executed: flags << QLatin1String("Modified"); never evaluated: filters & QDir::Modified | 0 |
| 1056 | if (filters & QDir::Hidden) flags << QLatin1String("Hidden"); never executed: flags << QLatin1String("Hidden"); never evaluated: filters & QDir::Hidden | 0 |
| 1057 | if (filters & QDir::System) flags << QLatin1String("System"); never executed: flags << QLatin1String("System"); never evaluated: filters & QDir::System | 0 |
| 1058 | if (filters & QDir::CaseSensitive) flags << QLatin1String("CaseSensitive"); never executed: flags << QLatin1String("CaseSensitive"); never evaluated: filters & QDir::CaseSensitive | 0 |
| 1059 | } | 0 |
| 1060 | debug << "QDir::Filters(" << QString(flags.join(QLatin1Char('|'))).toLocal8Bit().constData() << ')'; | - |
| 1061 | return debug; never executed: return debug; | 0 |
| 1062 | } | - |
| 1063 | | - |
| 1064 | static QDebug operator<<(QDebug debug, QDir::SortFlags sorting) | - |
| 1065 | { | - |
| 1066 | if (sorting == QDir::NoSort) { never evaluated: sorting == QDir::NoSort | 0 |
| 1067 | debug << "QDir::SortFlags(NoSort)"; | - |
| 1068 | } else { | 0 |
| 1069 | QString type; | - |
| 1070 | if ((sorting & 3) == QDir::Name) type = QLatin1String("Name"); never executed: type = QLatin1String("Name"); never evaluated: (sorting & 3) == QDir::Name | 0 |
| 1071 | if ((sorting & 3) == QDir::Time) type = QLatin1String("Time"); never executed: type = QLatin1String("Time"); never evaluated: (sorting & 3) == QDir::Time | 0 |
| 1072 | if ((sorting & 3) == QDir::Size) type = QLatin1String("Size"); never executed: type = QLatin1String("Size"); never evaluated: (sorting & 3) == QDir::Size | 0 |
| 1073 | if ((sorting & 3) == QDir::Unsorted) type = QLatin1String("Unsorted"); never executed: type = QLatin1String("Unsorted"); never evaluated: (sorting & 3) == QDir::Unsorted | 0 |
| 1074 | | - |
| 1075 | QStringList flags; | - |
| 1076 | if (sorting & QDir::DirsFirst) flags << QLatin1String("DirsFirst"); never executed: flags << QLatin1String("DirsFirst"); never evaluated: sorting & QDir::DirsFirst | 0 |
| 1077 | if (sorting & QDir::DirsLast) flags << QLatin1String("DirsLast"); never executed: flags << QLatin1String("DirsLast"); never evaluated: sorting & QDir::DirsLast | 0 |
| 1078 | if (sorting & QDir::IgnoreCase) flags << QLatin1String("IgnoreCase"); never executed: flags << QLatin1String("IgnoreCase"); never evaluated: sorting & QDir::IgnoreCase | 0 |
| 1079 | if (sorting & QDir::LocaleAware) flags << QLatin1String("LocaleAware"); never executed: flags << QLatin1String("LocaleAware"); never evaluated: sorting & QDir::LocaleAware | 0 |
| 1080 | if (sorting & QDir::Type) flags << QLatin1String("Type"); never executed: flags << QLatin1String("Type"); never evaluated: sorting & QDir::Type | 0 |
| 1081 | debug << "QDir::SortFlags(" << QString(type).toLocal8Bit().constData() | - |
| 1082 | << '|' | - |
| 1083 | << QString(flags.join(QLatin1Char('|'))).toLocal8Bit().constData() << ')'; | - |
| 1084 | } | 0 |
| 1085 | return debug; never executed: return debug; | 0 |
| 1086 | } | - |
| 1087 | | - |
| 1088 | QDebug operator<<(QDebug debug, const QDir &dir) | - |
| 1089 | { | - |
| 1090 | debug.maybeSpace() << "QDir(" << dir.path() | - |
| 1091 | << ", nameFilters = {" | - |
| 1092 | << QString(dir.nameFilters().join(QLatin1Char(','))).toLocal8Bit().constData() | - |
| 1093 | << "}, " | - |
| 1094 | << dir.sorting() | - |
| 1095 | << ',' | - |
| 1096 | << dir.filter() | - |
| 1097 | << ')'; | - |
| 1098 | return debug.space(); never executed: return debug.space(); | 0 |
| 1099 | } | - |
| 1100 | | - |
| 1101 | | - |
| 1102 | | - |
| 1103 | | - |
| | |