| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qfilesystemiterator_unix.cpp |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | /**************************************************************************** | - | ||||||
| 2 | ** | - | ||||||
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. | - | ||||||
| 4 | ** Contact: http://www.qt.io/licensing/ | - | ||||||
| 5 | ** | - | ||||||
| 6 | ** This file is part of the QtCore module of the Qt Toolkit. | - | ||||||
| 7 | ** | - | ||||||
| 8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - | ||||||
| 9 | ** Commercial License Usage | - | ||||||
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
| 11 | ** accordance with the commercial license agreement provided with the | - | ||||||
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - | ||||||
| 15 | ** information use the contact form at http://www.qt.io/contact-us. | - | ||||||
| 16 | ** | - | ||||||
| 17 | ** GNU Lesser General Public License Usage | - | ||||||
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
| 19 | ** General Public License version 2.1 or version 3 as published by the Free | - | ||||||
| 20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - | ||||||
| 21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - | ||||||
| 22 | ** following information to ensure the GNU Lesser General Public License | - | ||||||
| 23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - | ||||||
| 24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - | ||||||
| 25 | ** | - | ||||||
| 26 | ** As a special exception, The Qt Company gives you certain additional | - | ||||||
| 27 | ** rights. These rights are described in The Qt Company LGPL Exception | - | ||||||
| 28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - | ||||||
| 29 | ** | - | ||||||
| 30 | ** $QT_END_LICENSE$ | - | ||||||
| 31 | ** | - | ||||||
| 32 | ****************************************************************************/ | - | ||||||
| 33 | - | |||||||
| 34 | #include "qplatformdefs.h" | - | ||||||
| 35 | #include "qfilesystemiterator_p.h" | - | ||||||
| 36 | - | |||||||
| 37 | #ifndef QT_NO_FILESYSTEMITERATOR | - | ||||||
| 38 | - | |||||||
| 39 | #include <stdlib.h> | - | ||||||
| 40 | #include <errno.h> | - | ||||||
| 41 | - | |||||||
| 42 | QT_BEGIN_NAMESPACE | - | ||||||
| 43 | - | |||||||
| 44 | QFileSystemIterator::QFileSystemIterator(const QFileSystemEntry &entry, QDir::Filters filters, | - | ||||||
| 45 | const QStringList &nameFilters, QDirIterator::IteratorFlags flags) | - | ||||||
| 46 | : nativePath(entry.nativeFilePath()) | - | ||||||
| 47 | , dir(0) | - | ||||||
| 48 | , dirEntry(0) | - | ||||||
| 49 | , lastError(0) | - | ||||||
| 50 | { | - | ||||||
| 51 | Q_UNUSED(filters) | - | ||||||
| 52 | Q_UNUSED(nameFilters) | - | ||||||
| 53 | Q_UNUSED(flags) | - | ||||||
| 54 | - | |||||||
| 55 | if ((dir = QT_OPENDIR(nativePath.constData())) == 0) {
| 468-6909 | ||||||
| 56 | lastError = errno; | - | ||||||
| 57 | } else { executed 468 times by 8 tests: end of blockExecuted by:
| 468 | ||||||
| 58 | if (!nativePath.endsWith('/'))
| 184-6725 | ||||||
| 59 | nativePath.append('/'); executed 6725 times by 159 tests: nativePath.append('/');Executed by:
| 6725 | ||||||
| 60 | } executed 6909 times by 164 tests: end of blockExecuted by:
| 6909 | ||||||
| 61 | } | - | ||||||
| 62 | - | |||||||
| 63 | QFileSystemIterator::~QFileSystemIterator() | - | ||||||
| 64 | { | - | ||||||
| 65 | if (dir)
| 468-6909 | ||||||
| 66 | QT_CLOSEDIR(dir); executed 6909 times by 164 tests: ::closedir(dir);Executed by:
| 6909 | ||||||
| 67 | } executed 7377 times by 165 tests: end of blockExecuted by:
| 7377 | ||||||
| 68 | - | |||||||
| 69 | bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaData &metaData) | - | ||||||
| 70 | { | - | ||||||
| 71 | if (!dir)
| 468-107102 | ||||||
| 72 | return false; executed 468 times by 8 tests: return false;Executed by:
| 468 | ||||||
| 73 | - | |||||||
| 74 | dirEntry = QT_READDIR(dir); | - | ||||||
| 75 | - | |||||||
| 76 | if (dirEntry) {
| 6891-100211 | ||||||
| 77 | fileEntry = QFileSystemEntry(nativePath + QByteArray(dirEntry->d_name), QFileSystemEntry::FromNativePath()); | - | ||||||
| 78 | metaData.fillFromDirEnt(*dirEntry); | - | ||||||
| 79 | return true; executed 100211 times by 164 tests: return true;Executed by:
| 100211 | ||||||
| 80 | } | - | ||||||
| 81 | - | |||||||
| 82 | lastError = errno; | - | ||||||
| 83 | return false; executed 6891 times by 159 tests: return false;Executed by:
| 6891 | ||||||
| 84 | } | - | ||||||
| 85 | - | |||||||
| 86 | QT_END_NAMESPACE | - | ||||||
| 87 | - | |||||||
| 88 | #endif // QT_NO_FILESYSTEMITERATOR | - | ||||||
| Source code | Switch to Preprocessed file |