OpenCoverage

qfilesystemwatcher_polling.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/io/qfilesystemwatcher_polling.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine(QObject *parent)-
7 : QFileSystemWatcherEngine(parent),-
8 timer(this)-
9{-
10 connect(&timer, qFlagLocation("2""timeout()" "\0" __FILE__ ":" "51"), qFlagLocation("1""timeout()" "\0" __FILE__ ":" "51"));-
11}
executed 4 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
4
12-
13QStringList QPollingFileSystemWatcherEngine::addPaths(const QStringList &paths,-
14 QStringList *files,-
15 QStringList *directories)-
16{-
17 QStringList p = paths;-
18 QMutableListIterator<QString> it(p);-
19 while (it.hasNext()
it.hasNext()Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
9
20 QString path = it.next();-
21 QFileInfo fi(path);-
22 if (!fi.exists()
!fi.exists()Description
TRUEnever evaluated
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
)
0-9
23 continue;
never executed: continue;
0
24 if (fi.isDir()
fi.isDir()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
4-5
25 if (directories->contains(path)
directories->contains(path)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
)
0-4
26 continue;
never executed: continue;
0
27 directories->append(path);-
28 if (!path.endsWith(QLatin1Char('/'))
!path.endsWith...tin1Char('/'))Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEnever evaluated
)
0-4
29 fi = QFileInfo(path + QLatin1Char('/'));
executed 4 times by 1 test: fi = QFileInfo(path + QLatin1Char('/'));
Executed by:
  • tst_QFileSystemWatcher
4
30 this->directories.insert(path, fi);-
31 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
else {
4
32 if (files->contains(path)
files->contains(path)Description
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
)
0-5
33 continue;
never executed: continue;
0
34 files->append(path);-
35 this->files.insert(path, fi);-
36 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
5
37 it.remove();-
38 }
executed 9 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
9
39-
40 if ((!this->files.isEmpty()
!this->files.isEmpty()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
||
4-5
41 !this->directories.isEmpty()
!this->directories.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEnever evaluated
) &&
0-4
42 !timer.isActive()
!timer.isActive()Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
1-8
43 timer.start(PollingInterval);-
44 }
executed 8 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
8
45-
46 return
executed 9 times by 1 test: return p;
Executed by:
  • tst_QFileSystemWatcher
p;
executed 9 times by 1 test: return p;
Executed by:
  • tst_QFileSystemWatcher
9
47}-
48-
49QStringList QPollingFileSystemWatcherEngine::removePaths(const QStringList &paths,-
50 QStringList *files,-
51 QStringList *directories)-
52{-
53 QStringList p = paths;-
54 QMutableListIterator<QString> it(p);-
55 while (it.hasNext()
it.hasNext()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
5
56 QString path = it.next();-
57 if (this->directories.remove(path)
this->directories.remove(path)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
1-4
58 directories->removeAll(path);-
59 it.remove();-
60 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
else if (this->files.remove(path)
this->files.remove(path)Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
1-3
61 files->removeAll(path);-
62 it.remove();-
63 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
3
64 }
executed 5 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
5
65-
66 if (this->files.isEmpty()
this->files.isEmpty()Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEnever evaluated
&&
0-5
67 this->directories.isEmpty()
this->directories.isEmpty()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
1-4
68 timer.stop();-
69 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
4
70-
71 return
executed 5 times by 1 test: return p;
Executed by:
  • tst_QFileSystemWatcher
p;
executed 5 times by 1 test: return p;
Executed by:
  • tst_QFileSystemWatcher
5
72}-
73-
74void QPollingFileSystemWatcherEngine::timeout()-
75{-
76 QMutableHashIterator<QString, FileInfo> fit(files);-
77 while (fit.hasNext()
fit.hasNext()Description
TRUEevaluated 11 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
11-38
78 QHash<QString, FileInfo>::iterator x = fit.next();-
79 QString path = x.key();-
80 QFileInfo fi(path);-
81 if (!fi.exists()
!fi.exists()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
2-9
82 fit.remove();-
83 fileChanged(path, true);-
84 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
else if (x.value() != fi
x.value() != fiDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
2-5
85 x.value() = fi;-
86 fileChanged(path, false);-
87 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
4
88 }
executed 11 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
11
89 QMutableHashIterator<QString, FileInfo> dit(directories);-
90 while (dit.hasNext()
dit.hasNext()Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
18-38
91 QHash<QString, FileInfo>::iterator x = dit.next();-
92 QString path = x.key();-
93 QFileInfo fi(path);-
94 if (!path.endsWith(QLatin1Char('/'))
!path.endsWith...tin1Char('/'))Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEnever evaluated
)
0-18
95 fi = QFileInfo(path + QLatin1Char('/'));
executed 18 times by 1 test: fi = QFileInfo(path + QLatin1Char('/'));
Executed by:
  • tst_QFileSystemWatcher
18
96 if (!fi.exists()
!fi.exists()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
2-16
97 dit.remove();-
98 directoryChanged(path, true);-
99 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
else if (x.value() != fi
x.value() != fiDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
2-12
100 fi.refresh();-
101 if (!fi.exists()
!fi.exists()Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QFileSystemWatcher
) {
0-4
102 dit.remove();-
103 directoryChanged(path, true);-
104 }
never executed: end of block
else {
0
105 x.value() = fi;-
106 directoryChanged(path, false);-
107 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
4
108 }-
109 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
18
110}
executed 38 times by 1 test: end of block
Executed by:
  • tst_QFileSystemWatcher
38
111-
112-
Switch to Source codePreprocessed file

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