io/qabstractfileengine.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7static bool qt_file_engine_handlers_in_use = false; -
8 -
9 -
10 -
11 -
12 -
13static QReadWriteLock *fileEngineHandlerMutex() { static QGlobalStatic<QReadWriteLock > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QReadWriteLock *x = new QReadWriteLock (QReadWriteLock::Recursive); if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QReadWriteLock > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
never executed: return thisGlobalStatic.pointer.load();
never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
never evaluated: !thisGlobalStatic.pointer.load()
never evaluated: !thisGlobalStatic.destroyed
0
14static bool qt_abstractfileenginehandlerlist_shutDown = false; -
15class QAbstractFileEngineHandlerList : public QList<QAbstractFileEngineHandler *> -
16{ -
17public: -
18 ~QAbstractFileEngineHandlerList() -
19 { -
20 QWriteLocker locker(fileEngineHandlerMutex()); -
21 qt_abstractfileenginehandlerlist_shutDown = true; -
22 }
never executed: }
0
23}; -
24static QAbstractFileEngineHandlerList *fileEngineHandlers() { static QGlobalStatic<QAbstractFileEngineHandlerList > thisGlobalStatic = { { (0) }, false }; if (!thisGlobalStatic.pointer.load() && !thisGlobalStatic.destroyed) { QAbstractFileEngineHandlerList *x = new QAbstractFileEngineHandlerList; if (!thisGlobalStatic.pointer.testAndSetOrdered(0, x)) delete x; else static QGlobalStaticDeleter<QAbstractFileEngineHandlerList > cleanup(thisGlobalStatic); } return thisGlobalStatic.pointer.load(); }
never executed: delete x;
never executed: return thisGlobalStatic.pointer.load();
never evaluated: !thisGlobalStatic.pointer.testAndSetOrdered(0, x)
never evaluated: !thisGlobalStatic.pointer.load()
never evaluated: !thisGlobalStatic.destroyed
0
25QAbstractFileEngineHandler::QAbstractFileEngineHandler() -
26{ -
27 QWriteLocker locker(fileEngineHandlerMutex()); -
28 qt_file_engine_handlers_in_use = true; -
29 fileEngineHandlers()->prepend(this); -
30}
never executed: }
0
31 -
32 -
33 -
34 -
35 -
36QAbstractFileEngineHandler::~QAbstractFileEngineHandler() -
37{ -
38 QWriteLocker locker(fileEngineHandlerMutex()); -
39 -
40 if (!qt_abstractfileenginehandlerlist_shutDown) {
never evaluated: !qt_abstractfileenginehandlerlist_shutDown
0
41 QAbstractFileEngineHandlerList *handlers = fileEngineHandlers(); -
42 handlers->removeOne(this); -
43 if (handlers->isEmpty())
never evaluated: handlers->isEmpty()
0
44 qt_file_engine_handlers_in_use = false;
never executed: qt_file_engine_handlers_in_use = false;
0
45 }
never executed: }
0
46}
never executed: }
0
47 -
48 -
49 -
50 -
51 -
52 -
53QAbstractFileEngine *qt_custom_file_engine_handler_create(const QString &path) -
54{ -
55 QAbstractFileEngine *engine = 0; -
56 -
57 if (qt_file_engine_handlers_in_use) {
partially evaluated: qt_file_engine_handlers_in_use
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:163557
0-163557
58 QReadLocker locker(fileEngineHandlerMutex()); -
59 -
60 -
61 QAbstractFileEngineHandlerList *handlers = fileEngineHandlers(); -
62 for (int i = 0; i < handlers->size(); i++) {
never evaluated: i < handlers->size()
0
63 if ((engine = handlers->at(i)->create(path)))
never evaluated: (engine = handlers->at(i)->create(path))
0
64 break;
never executed: break;
0
65 }
never executed: }
0
66 }
never executed: }
0
67 -
68 return engine;
executed: return engine;
Execution Count:163556
163556
69} -
70QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName) -
71{ -
72 QFileSystemEntry entry(fileName); -
73 QFileSystemMetaData metaData; -
74 QAbstractFileEngine *engine = QFileSystemEngine::resolveEntryAndCreateLegacyEngine(entry, metaData); -
75 -
76 -
77 if (!engine)
evaluated: !engine
TRUEFALSE
yes
Evaluation Count:24993
yes
Evaluation Count:1733
1733-24993
78 -
79 return new QFSFileEngine(entry.filePath());
executed: return new QFSFileEngine(entry.filePath());
Execution Count:24993
24993
80 -
81 -
82 return engine;
executed: return engine;
Execution Count:1733
1733
83} -
84QAbstractFileEngine::QAbstractFileEngine() : d_ptr(new QAbstractFileEnginePrivate) -
85{ -
86 d_ptr->q_ptr = this; -
87}
never executed: }
0
88 -
89 -
90 -
91 -
92 -
93 -
94QAbstractFileEngine::QAbstractFileEngine(QAbstractFileEnginePrivate &dd) : d_ptr(&dd) -
95{ -
96 d_ptr->q_ptr = this; -
97}
executed: }
Execution Count:34787
34787
98 -
99 -
100 -
101 -
102QAbstractFileEngine::~QAbstractFileEngine() -
103{ -
104} -
105bool QAbstractFileEngine::open(QIODevice::OpenMode openMode) -
106{ -
107 (void)openMode;; -
108 return false;
never executed: return false;
0
109} -
110 -
111 -
112 -
113 -
114 -
115 -
116bool QAbstractFileEngine::close() -
117{ -
118 return false;
never executed: return false;
0
119} -
120 -
121 -
122 -
123 -
124 -
125 -
126 -
127bool QAbstractFileEngine::flush() -
128{ -
129 return false;
never executed: return false;
0
130} -
131 -
132 -
133 -
134 -
135qint64 QAbstractFileEngine::size() const -
136{ -
137 return 0;
never executed: return 0;
0
138} -
139 -
140 -
141 -
142 -
143 -
144 -
145qint64 QAbstractFileEngine::pos() const -
146{ -
147 return 0;
never executed: return 0;
0
148} -
149bool QAbstractFileEngine::seek(qint64 pos) -
150{ -
151 (void)pos;; -
152 return false;
never executed: return false;
0
153} -
154bool QAbstractFileEngine::isSequential() const -
155{ -
156 return false;
never executed: return false;
0
157} -
158bool QAbstractFileEngine::remove() -
159{ -
160 return false;
never executed: return false;
0
161} -
162 -
163 -
164 -
165 -
166 -
167bool QAbstractFileEngine::copy(const QString &newName) -
168{ -
169 (void)newName;; -
170 return false;
never executed: return false;
0
171} -
172bool QAbstractFileEngine::rename(const QString &newName) -
173{ -
174 (void)newName;; -
175 return false;
never executed: return false;
0
176} -
177 -
178 -
179 -
180 -
181 -
182 -
183 -
184bool QAbstractFileEngine::link(const QString &newName) -
185{ -
186 (void)newName;; -
187 return false;
never executed: return false;
0
188} -
189bool QAbstractFileEngine::mkdir(const QString &dirName, bool createParentDirectories) const -
190{ -
191 (void)dirName;; -
192 (void)createParentDirectories;; -
193 return false;
never executed: return false;
0
194} -
195bool QAbstractFileEngine::rmdir(const QString &dirName, bool recurseParentDirectories) const -
196{ -
197 (void)dirName;; -
198 (void)recurseParentDirectories;; -
199 return false;
never executed: return false;
0
200} -
201bool QAbstractFileEngine::setSize(qint64 size) -
202{ -
203 (void)size;; -
204 return false;
never executed: return false;
0
205} -
206 -
207 -
208 -
209 -
210 -
211 -
212 -
213bool QAbstractFileEngine::caseSensitive() const -
214{ -
215 return false;
never executed: return false;
0
216} -
217bool QAbstractFileEngine::isRelativePath() const -
218{ -
219 return false;
never executed: return false;
0
220} -
221QStringList QAbstractFileEngine::entryList(QDir::Filters filters, const QStringList &filterNames) const -
222{ -
223 QStringList ret; -
224 QDirIterator it(fileName(), filterNames, filters); -
225 while (it.hasNext()) {
never evaluated: it.hasNext()
0
226 it.next(); -
227 ret << it.fileName(); -
228 }
never executed: }
0
229 return ret;
never executed: return ret;
0
230} -
231QAbstractFileEngine::FileFlags QAbstractFileEngine::fileFlags(FileFlags type) const -
232{ -
233 (void)type;; -
234 return 0;
never executed: return 0;
0
235} -
236bool QAbstractFileEngine::setPermissions(uint perms) -
237{ -
238 (void)perms;; -
239 return false;
never executed: return false;
0
240} -
241QString QAbstractFileEngine::fileName(FileName file) const -
242{ -
243 (void)file;; -
244 return QString();
never executed: return QString();
0
245} -
246uint QAbstractFileEngine::ownerId(FileOwner owner) const -
247{ -
248 (void)owner;; -
249 return 0;
never executed: return 0;
0
250} -
251QString QAbstractFileEngine::owner(FileOwner owner) const -
252{ -
253 (void)owner;; -
254 return QString();
never executed: return QString();
0
255} -
256QDateTime QAbstractFileEngine::fileTime(FileTime time) const -
257{ -
258 (void)time;; -
259 return QDateTime();
never executed: return QDateTime();
0
260} -
261void QAbstractFileEngine::setFileName(const QString &file) -
262{ -
263 (void)file;; -
264}
never executed: }
0
265 -
266 -
267 -
268 -
269 -
270 -
271int QAbstractFileEngine::handle() const -
272{ -
273 return -1;
executed: return -1;
Execution Count:6
6
274} -
275bool QAbstractFileEngine::atEnd() const -
276{ -
277 return const_cast<QAbstractFileEngine *>(this)->extension(AtEndExtension);
never executed: return const_cast<QAbstractFileEngine *>(this)->extension(AtEndExtension);
0
278} -
279uchar *QAbstractFileEngine::map(qint64 offset, qint64 size, QFile::MemoryMapFlags flags) -
280{ -
281 MapExtensionOption option; -
282 option.offset = offset; -
283 option.size = size; -
284 option.flags = flags; -
285 MapExtensionReturn r; -
286 if (!extension(MapExtension, &option, &r))
evaluated: !extension(MapExtension, &option, &r)
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:33320
24-33320
287 return 0;
executed: return 0;
Execution Count:24
24
288 return r.address;
executed: return r.address;
Execution Count:33320
33320
289} -
290bool QAbstractFileEngine::unmap(uchar *address) -
291{ -
292 UnMapExtensionOption options; -
293 options.address = address; -
294 return extension(UnMapExtension, &options);
executed: return extension(UnMapExtension, &options);
Execution Count:33335
33335
295} -
296class QAbstractFileEngineIteratorPrivate -
297{ -
298public: -
299 QString path; -
300 QDir::Filters filters; -
301 QStringList nameFilters; -
302 QFileInfo fileInfo; -
303}; -
304 -
305 -
306 -
307 -
308 -
309QAbstractFileEngineIterator::QAbstractFileEngineIterator(QDir::Filters filters, -
310 const QStringList &nameFilters) -
311 : d(new QAbstractFileEngineIteratorPrivate) -
312{ -
313 d->nameFilters = nameFilters; -
314 d->filters = filters; -
315}
executed: }
Execution Count:17
17
316 -
317 -
318 -
319 -
320 -
321 -
322QAbstractFileEngineIterator::~QAbstractFileEngineIterator() -
323{ -
324} -
325 -
326 -
327 -
328 -
329 -
330 -
331 -
332QString QAbstractFileEngineIterator::path() const -
333{ -
334 return d->path;
executed: return d->path;
Execution Count:383
383
335} -
336 -
337 -
338 -
339 -
340 -
341 -
342 -
343void QAbstractFileEngineIterator::setPath(const QString &path) -
344{ -
345 d->path = path; -
346}
executed: }
Execution Count:17
17
347 -
348 -
349 -
350 -
351 -
352 -
353QStringList QAbstractFileEngineIterator::nameFilters() const -
354{ -
355 return d->nameFilters;
never executed: return d->nameFilters;
0
356} -
357 -
358 -
359 -
360 -
361 -
362 -
363QDir::Filters QAbstractFileEngineIterator::filters() const -
364{ -
365 return d->filters;
never executed: return d->filters;
0
366} -
367QString QAbstractFileEngineIterator::currentFilePath() const -
368{ -
369 QString name = currentFileName(); -
370 if (!name.isNull()) {
partially evaluated: !name.isNull()
TRUEFALSE
yes
Evaluation Count:366
no
Evaluation Count:0
0-366
371 QString tmp = path(); -
372 if (!tmp.isEmpty()) {
partially evaluated: !tmp.isEmpty()
TRUEFALSE
yes
Evaluation Count:366
no
Evaluation Count:0
0-366
373 if (!tmp.endsWith(QLatin1Char('/')))
evaluated: !tmp.endsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:358
yes
Evaluation Count:8
8-358
374 tmp.append(QLatin1Char('/'));
executed: tmp.append(QLatin1Char('/'));
Execution Count:358
358
375 name.prepend(tmp); -
376 }
executed: }
Execution Count:366
366
377 }
executed: }
Execution Count:366
366
378 return name;
executed: return name;
Execution Count:366
366
379} -
380QFileInfo QAbstractFileEngineIterator::currentFileInfo() const -
381{ -
382 QString path = currentFilePath(); -
383 if (d->fileInfo.filePath() != path)
partially evaluated: d->fileInfo.filePath() != path
TRUEFALSE
yes
Evaluation Count:183
no
Evaluation Count:0
0-183
384 d->fileInfo.setFile(path);
executed: d->fileInfo.setFile(path);
Execution Count:183
183
385 -
386 -
387 return d->fileInfo;
executed: return d->fileInfo;
Execution Count:183
183
388} -
389QVariant QAbstractFileEngineIterator::entryInfo(EntryInfoType type) const -
390{ -
391 (void)type; -
392 return QVariant();
never executed: return QVariant();
0
393} -
394QAbstractFileEngine::Iterator *QAbstractFileEngine::beginEntryList(QDir::Filters filters, const QStringList &filterNames) -
395{ -
396 (void)filters;; -
397 (void)filterNames;; -
398 return 0;
never executed: return 0;
0
399} -
400 -
401 -
402 -
403 -
404QAbstractFileEngine::Iterator *QAbstractFileEngine::endEntryList() -
405{ -
406 return 0;
never executed: return 0;
0
407} -
408qint64 QAbstractFileEngine::read(char *data, qint64 maxlen) -
409{ -
410 (void)data;; -
411 (void)maxlen;; -
412 return -1;
never executed: return -1;
0
413} -
414 -
415 -
416 -
417 -
418 -
419qint64 QAbstractFileEngine::write(const char *data, qint64 len) -
420{ -
421 (void)data;; -
422 (void)len;; -
423 return -1;
never executed: return -1;
0
424} -
425 -
426 -
427 -
428 -
429 -
430 -
431qint64 QAbstractFileEngine::readLine(char *data, qint64 maxlen) -
432{ -
433 qint64 readSoFar = 0; -
434 while (readSoFar < maxlen) {
partially evaluated: readSoFar < maxlen
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
435 char c; -
436 qint64 readResult = read(&c, 1); -
437 if (readResult <= 0)
partially evaluated: readResult <= 0
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
438 return (readSoFar > 0) ? readSoFar : -1;
executed: return (readSoFar > 0) ? readSoFar : -1;
Execution Count:8
8
439 ++readSoFar; -
440 *data++ = c; -
441 if (c == '\n')
never evaluated: c == '\n'
0
442 return readSoFar;
never executed: return readSoFar;
0
443 }
never executed: }
0
444 return readSoFar;
never executed: return readSoFar;
0
445} -
446bool QAbstractFileEngine::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output) -
447{ -
448 (void)extension;; -
449 (void)option;; -
450 (void)output;; -
451 return false;
never executed: return false;
0
452} -
453bool QAbstractFileEngine::supportsExtension(Extension extension) const -
454{ -
455 (void)extension;; -
456 return false;
never executed: return false;
0
457} -
458QFile::FileError QAbstractFileEngine::error() const -
459{ -
460 const QAbstractFileEnginePrivate * const d = d_func(); -
461 return d->fileError;
executed: return d->fileError;
Execution Count:3334
3334
462} -
463QString QAbstractFileEngine::errorString() const -
464{ -
465 const QAbstractFileEnginePrivate * const d = d_func(); -
466 return d->errorString;
executed: return d->errorString;
Execution Count:3955
3955
467} -
468void QAbstractFileEngine::setError(QFile::FileError error, const QString &errorString) -
469{ -
470 QAbstractFileEnginePrivate * const d = d_func(); -
471 d->fileError = error; -
472 d->errorString = errorString; -
473}
executed: }
Execution Count:5326
5326
474 -
475 -
476 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial