| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qresource_iterator.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 "qresource.h" | - | ||||||||||||
| 35 | #include "qresource_iterator_p.h" | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | #include <QtCore/qvariant.h> | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | QT_BEGIN_NAMESPACE | - | ||||||||||||
| 40 | - | |||||||||||||
| 41 | QResourceFileEngineIterator::QResourceFileEngineIterator(QDir::Filters filters, | - | ||||||||||||
| 42 | const QStringList &filterNames) | - | ||||||||||||
| 43 | : QAbstractFileEngineIterator(filters, filterNames), index(-1) | - | ||||||||||||
| 44 | { | - | ||||||||||||
| 45 | } executed 174 times by 6 tests: end of blockExecuted by:
| 174 | ||||||||||||
| 46 | - | |||||||||||||
| 47 | QResourceFileEngineIterator::~QResourceFileEngineIterator() | - | ||||||||||||
| 48 | { | - | ||||||||||||
| 49 | } | - | ||||||||||||
| 50 | - | |||||||||||||
| 51 | QString QResourceFileEngineIterator::next() | - | ||||||||||||
| 52 | { | - | ||||||||||||
| 53 | if (!hasNext())
| 0-514 | ||||||||||||
| 54 | return QString(); never executed: return QString(); | 0 | ||||||||||||
| 55 | ++index; | - | ||||||||||||
| 56 | return currentFilePath(); executed 514 times by 6 tests: return currentFilePath();Executed by:
| 514 | ||||||||||||
| 57 | } | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | bool QResourceFileEngineIterator::hasNext() const | - | ||||||||||||
| 60 | { | - | ||||||||||||
| 61 | if (index == -1) {
| 174-1028 | ||||||||||||
| 62 | // Lazy initialization of the iterator | - | ||||||||||||
| 63 | QResource resource(path()); | - | ||||||||||||
| 64 | if (!resource.isValid())
| 1-173 | ||||||||||||
| 65 | return false; executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||||||||
| 66 | - | |||||||||||||
| 67 | // Initialize and move to the next entry. | - | ||||||||||||
| 68 | entries = resource.children(); | - | ||||||||||||
| 69 | index = 0; | - | ||||||||||||
| 70 | } executed 173 times by 6 tests: end of blockExecuted by:
| 173 | ||||||||||||
| 71 | - | |||||||||||||
| 72 | return index < entries.size(); executed 1201 times by 6 tests: return index < entries.size();Executed by:
| 1201 | ||||||||||||
| 73 | } | - | ||||||||||||
| 74 | - | |||||||||||||
| 75 | QString QResourceFileEngineIterator::currentFileName() const | - | ||||||||||||
| 76 | { | - | ||||||||||||
| 77 | if (index <= 0 || index > entries.size())
| 0-1542 | ||||||||||||
| 78 | return QString(); never executed: return QString(); | 0 | ||||||||||||
| 79 | return entries.at(index - 1); executed 1542 times by 6 tests: return entries.at(index - 1);Executed by:
| 1542 | ||||||||||||
| 80 | } | - | ||||||||||||
| 81 | - | |||||||||||||
| 82 | QT_END_NAMESPACE | - | ||||||||||||
| Source code | Switch to Preprocessed file |