qresource_iterator.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qresource_iterator.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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-
39QT_BEGIN_NAMESPACE-
40-
41QResourceFileEngineIterator::QResourceFileEngineIterator(QDir::Filters filters,-
42 const QStringList &filterNames)-
43 : QAbstractFileEngineIterator(filters, filterNames), index(-1)-
44{-
45}
executed 174 times by 6 tests: end of block
Executed by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
174
46-
47QResourceFileEngineIterator::~QResourceFileEngineIterator()-
48{-
49}-
50-
51QString QResourceFileEngineIterator::next()-
52{-
53 if (!hasNext())
!hasNext()Description
TRUEnever evaluated
FALSEevaluated 514 times by 6 tests
Evaluated by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
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:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
514
57}-
58-
59bool QResourceFileEngineIterator::hasNext() const-
60{-
61 if (index == -1) {
index == -1Description
TRUEevaluated 174 times by 6 tests
Evaluated by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
FALSEevaluated 1028 times by 6 tests
Evaluated by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
174-1028
62 // Lazy initialization of the iterator-
63 QResource resource(path());-
64 if (!resource.isValid())
!resource.isValid()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QDirIterator
FALSEevaluated 173 times by 6 tests
Evaluated by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
1-173
65 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QDirIterator
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 block
Executed by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
173
71-
72 return index < entries.size();
executed 1201 times by 6 tests: return index < entries.size();
Executed by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
1201
73}-
74-
75QString QResourceFileEngineIterator::currentFileName() const-
76{-
77 if (index <= 0 || index > entries.size())
index <= 0Description
TRUEnever evaluated
FALSEevaluated 1542 times by 6 tests
Evaluated by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
index > entries.size()Description
TRUEnever evaluated
FALSEevaluated 1542 times by 6 tests
Evaluated by:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
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:
  • tst_QDir
  • tst_QDirIterator
  • tst_QFileInfo
  • tst_QResourceEngine
  • tst_QVariant
  • tst_rcc
1542
80}-
81-
82QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9