io/qfilesystemwatcher_polling.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine(QObject *parent) -
7 : QFileSystemWatcherEngine(parent), -
8 timer(this) -
9{ -
10 connect(&timer, "2""timeout()", "1""timeout()"); -
11}
executed: }
Execution Count:4
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()) {
evaluated: it.hasNext()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:9
9
20 QString path = it.next(); -
21 QFileInfo fi(path); -
22 if (!fi.exists())
partially evaluated: !fi.exists()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
23 continue;
never executed: continue;
0
24 if (fi.isDir()) {
evaluated: fi.isDir()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5
4-5
25 if (!directories->contains(path))
partially evaluated: !directories->contains(path)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
26 directories->append(path);
executed: directories->append(path);
Execution Count:4
4
27 if (!path.endsWith(QLatin1Char('/')))
partially evaluated: !path.endsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
28 fi = QFileInfo(path + QLatin1Char('/'));
executed: fi = QFileInfo(path + QLatin1Char('/'));
Execution Count:4
4
29 this->directories.insert(path, fi); -
30 } else {
executed: }
Execution Count:4
4
31 if (!files->contains(path))
partially evaluated: !files->contains(path)
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
32 files->append(path);
executed: files->append(path);
Execution Count:5
5
33 this->files.insert(path, fi); -
34 }
executed: }
Execution Count:5
5
35 it.remove(); -
36 }
executed: }
Execution Count:9
9
37 -
38 if ((!this->files.isEmpty() ||
evaluated: !this->files.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
39 !this->directories.isEmpty()) &&
partially evaluated: !this->directories.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
40 !timer.isActive()) {
evaluated: !timer.isActive()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
1-8
41 timer.start(PollingInterval); -
42 }
executed: }
Execution Count:8
8
43 -
44 return p;
executed: return p;
Execution Count:9
9
45} -
46 -
47QStringList QPollingFileSystemWatcherEngine::removePaths(const QStringList &paths, -
48 QStringList *files, -
49 QStringList *directories) -
50{ -
51 QStringList p = paths; -
52 QMutableListIterator<QString> it(p); -
53 while (it.hasNext()) {
evaluated: it.hasNext()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
5
54 QString path = it.next(); -
55 if (this->directories.remove(path)) {
evaluated: this->directories.remove(path)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
56 directories->removeAll(path); -
57 it.remove(); -
58 } else if (this->files.remove(path)) {
executed: }
Execution Count:1
evaluated: this->files.remove(path)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
59 files->removeAll(path); -
60 it.remove(); -
61 }
executed: }
Execution Count:3
3
62 } -
63 -
64 if (this->files.isEmpty() &&
partially evaluated: this->files.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
65 this->directories.isEmpty()) {
evaluated: this->directories.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
66 timer.stop(); -
67 }
executed: }
Execution Count:4
4
68 -
69 return p;
executed: return p;
Execution Count:5
5
70} -
71 -
72void QPollingFileSystemWatcherEngine::timeout() -
73{ -
74 QMutableHashIterator<QString, FileInfo> fit(files); -
75 while (fit.hasNext()) {
evaluated: fit.hasNext()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:35
13-35
76 QHash<QString, FileInfo>::iterator x = fit.next(); -
77 QString path = x.key(); -
78 QFileInfo fi(path); -
79 if (!fi.exists()) {
evaluated: !fi.exists()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:11
2-11
80 fit.remove(); -
81 fileChanged(path, true); -
82 } else if (x.value() != fi) {
executed: }
Execution Count:2
evaluated: x.value() != fi
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:7
2-7
83 x.value() = fi; -
84 fileChanged(path, false); -
85 }
executed: }
Execution Count:4
4
86 } -
87 QMutableHashIterator<QString, FileInfo> dit(directories); -
88 while (dit.hasNext()) {
evaluated: dit.hasNext()
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:35
19-35
89 QHash<QString, FileInfo>::iterator x = dit.next(); -
90 QString path = x.key(); -
91 QFileInfo fi(path); -
92 if (!path.endsWith(QLatin1Char('/')))
partially evaluated: !path.endsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
0-19
93 fi = QFileInfo(path + QLatin1Char('/'));
executed: fi = QFileInfo(path + QLatin1Char('/'));
Execution Count:19
19
94 if (!fi.exists()) {
evaluated: !fi.exists()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:17
2-17
95 dit.remove(); -
96 directoryChanged(path, true); -
97 } else if (x.value() != fi) {
executed: }
Execution Count:2
evaluated: x.value() != fi
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:13
2-13
98 fi.refresh(); -
99 if (!fi.exists()) {
partially evaluated: !fi.exists()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
100 dit.remove(); -
101 directoryChanged(path, true); -
102 } else {
never executed: }
0
103 x.value() = fi; -
104 directoryChanged(path, false); -
105 }
executed: }
Execution Count:4
4
106 } -
107 } -
108}
executed: }
Execution Count:35
35
109 -
110 -
111 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial