io/qabstractfileengine.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtCore module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
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 Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/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 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "private/qabstractfileengine_p.h" -
43#include "private/qfsfileengine_p.h" -
44#ifdef QT_BUILD_CORE_LIB -
45#include "private/qresource_p.h" -
46#endif -
47#include "qdatetime.h" -
48#include "qreadwritelock.h" -
49#include "qvariant.h" -
50// built-in handlers -
51#include "qdiriterator.h" -
52#include "qstringbuilder.h" -
53 -
54#include <QtCore/private/qfilesystementry_p.h> -
55#include <QtCore/private/qfilesystemmetadata_p.h> -
56#include <QtCore/private/qfilesystemengine_p.h> -
57 -
58QT_BEGIN_NAMESPACE -
59 -
60/*! -
61 \class QAbstractFileEngineHandler -
62 \inmodule QtCore -
63 \reentrant -
64 \internal -
65 -
66 \brief The QAbstractFileEngineHandler class provides a way to register -
67 custom file engines with your application. -
68 -
69 \ingroup io -
70 \since 4.1 -
71 -
72 QAbstractFileEngineHandler is a factory for creating QAbstractFileEngine -
73 objects (file engines), which are used internally by QFile, QFileInfo, and -
74 QDir when working with files and directories. -
75 -
76 When you open a file, Qt chooses a suitable file engine by passing the -
77 file name from QFile or QDir through an internal list of registered file -
78 engine handlers. The first handler to recognize the file name is used to -
79 create the engine. Qt provides internal file engines for working with -
80 regular files and resources, but you can also register your own -
81 QAbstractFileEngine subclasses. -
82 -
83 To install an application-specific file engine, you subclass -
84 QAbstractFileEngineHandler and reimplement create(). When you instantiate -
85 the handler (e.g. by creating an instance on the stack or on the heap), it -
86 will automatically register with Qt. (The latest registered handler takes -
87 precedence over existing handlers.) -
88 -
89 For example: -
90 -
91 \snippet code/src_corelib_io_qabstractfileengine.cpp 0 -
92 -
93 When the handler is destroyed, it is automatically removed from Qt. -
94 -
95 The most common approach to registering a handler is to create an instance -
96 as part of the start-up phase of your application. It is also possible to -
97 limit the scope of the file engine handler to a particular area of -
98 interest (e.g. a special file dialog that needs a custom file engine). By -
99 creating the handler inside a local scope, you can precisely control the -
100 area in which your engine will be applied without disturbing file -
101 operations in other parts of your application. -
102 -
103 \sa QAbstractFileEngine, QAbstractFileEngine::create() -
104*/ -
105 -
106static bool qt_file_engine_handlers_in_use = false; -
107 -
108/* -
109 All application-wide handlers are stored in this list. The mutex must be -
110 acquired to ensure thread safety. -
111 */ -
112Q_GLOBAL_STATIC_WITH_ARGS(QReadWriteLock, fileEngineHandlerMutex, (QReadWriteLock::Recursive))
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
113static bool qt_abstractfileenginehandlerlist_shutDown = false; -
114class QAbstractFileEngineHandlerList : public QList<QAbstractFileEngineHandler *> -
115{ -
116public: -
117 ~QAbstractFileEngineHandlerList() -
118 { -
119 QWriteLocker locker(fileEngineHandlerMutex());
never executed (the execution status of this line is deduced): QWriteLocker locker(fileEngineHandlerMutex());
-
120 qt_abstractfileenginehandlerlist_shutDown = true;
never executed (the execution status of this line is deduced): qt_abstractfileenginehandlerlist_shutDown = true;
-
121 }
never executed: }
0
122}; -
123Q_GLOBAL_STATIC(QAbstractFileEngineHandlerList, fileEngineHandlers)
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
124 -
125/*! -
126 Constructs a file handler and registers it with Qt. Once created this -
127 handler's create() function will be called (along with all the other -
128 handlers) for any paths used. The most recently created handler that -
129 recognizes the given path (i.e. that returns a QAbstractFileEngine) is -
130 used for the new path. -
131 -
132 \sa create() -
133 */ -
134QAbstractFileEngineHandler::QAbstractFileEngineHandler() -
135{ -
136 QWriteLocker locker(fileEngineHandlerMutex());
never executed (the execution status of this line is deduced): QWriteLocker locker(fileEngineHandlerMutex());
-
137 qt_file_engine_handlers_in_use = true;
never executed (the execution status of this line is deduced): qt_file_engine_handlers_in_use = true;
-
138 fileEngineHandlers()->prepend(this);
never executed (the execution status of this line is deduced): fileEngineHandlers()->prepend(this);
-
139}
never executed: }
0
140 -
141/*! -
142 Destroys the file handler. This will automatically unregister the handler -
143 from Qt. -
144 */ -
145QAbstractFileEngineHandler::~QAbstractFileEngineHandler() -
146{ -
147 QWriteLocker locker(fileEngineHandlerMutex());
never executed (the execution status of this line is deduced): QWriteLocker locker(fileEngineHandlerMutex());
-
148 // Remove this handler from the handler list only if the list is valid. -
149 if (!qt_abstractfileenginehandlerlist_shutDown) {
never evaluated: !qt_abstractfileenginehandlerlist_shutDown
0
150 QAbstractFileEngineHandlerList *handlers = fileEngineHandlers();
never executed (the execution status of this line is deduced): QAbstractFileEngineHandlerList *handlers = fileEngineHandlers();
-
151 handlers->removeOne(this);
never executed (the execution status of this line is deduced): handlers->removeOne(this);
-
152 if (handlers->isEmpty())
never evaluated: handlers->isEmpty()
0
153 qt_file_engine_handlers_in_use = false;
never executed: qt_file_engine_handlers_in_use = false;
0
154 }
never executed: }
0
155}
never executed: }
0
156 -
157/* -
158 \internal -
159 -
160 Handles calls to custom file engine handlers. -
161*/ -
162QAbstractFileEngine *qt_custom_file_engine_handler_create(const QString &path) -
163{ -
164 QAbstractFileEngine *engine = 0;
executed (the execution status of this line is deduced): QAbstractFileEngine *engine = 0;
-
165 -
166 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
167 QReadLocker locker(fileEngineHandlerMutex());
never executed (the execution status of this line is deduced): QReadLocker locker(fileEngineHandlerMutex());
-
168 -
169 // check for registered handlers that can load the file -
170 QAbstractFileEngineHandlerList *handlers = fileEngineHandlers();
never executed (the execution status of this line is deduced): QAbstractFileEngineHandlerList *handlers = fileEngineHandlers();
-
171 for (int i = 0; i < handlers->size(); i++) {
never evaluated: i < handlers->size()
0
172 if ((engine = handlers->at(i)->create(path)))
never evaluated: (engine = handlers->at(i)->create(path))
0
173 break;
never executed: break;
0
174 }
never executed: }
0
175 }
never executed: }
0
176 -
177 return engine;
executed: return engine;
Execution Count:163556
163556
178} -
179 -
180/*! -
181 \fn QAbstractFileEngine *QAbstractFileEngineHandler::create(const QString &fileName) const -
182 -
183 Creates a file engine for file \a fileName. Returns 0 if this -
184 file handler cannot handle \a fileName. -
185 -
186 Example: -
187 -
188 \snippet code/src_corelib_io_qabstractfileengine.cpp 1 -
189 -
190 \sa QAbstractFileEngine::create() -
191*/ -
192 -
193/*! -
194 Creates and returns a QAbstractFileEngine suitable for processing \a -
195 fileName. -
196 -
197 You should not need to call this function; use QFile, QFileInfo or -
198 QDir directly instead. -
199 -
200 If you reimplemnt this function, it should only return file -
201 engines that knows how to handle \a fileName; otherwise, it should -
202 return 0. -
203 -
204 \sa QAbstractFileEngineHandler -
205*/ -
206QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName) -
207{ -
208 QFileSystemEntry entry(fileName);
executed (the execution status of this line is deduced): QFileSystemEntry entry(fileName);
-
209 QFileSystemMetaData metaData;
executed (the execution status of this line is deduced): QFileSystemMetaData metaData;
-
210 QAbstractFileEngine *engine = QFileSystemEngine::resolveEntryAndCreateLegacyEngine(entry, metaData);
executed (the execution status of this line is deduced): QAbstractFileEngine *engine = QFileSystemEngine::resolveEntryAndCreateLegacyEngine(entry, metaData);
-
211 -
212#ifndef QT_NO_FSFILEENGINE -
213 if (!engine)
evaluated: !engine
TRUEFALSE
yes
Evaluation Count:24993
yes
Evaluation Count:1733
1733-24993
214 // fall back to regular file engine -
215 return new QFSFileEngine(entry.filePath());
executed: return new QFSFileEngine(entry.filePath());
Execution Count:24993
24993
216#endif -
217 -
218 return engine;
executed: return engine;
Execution Count:1733
1733
219} -
220 -
221/*! -
222 \class QAbstractFileEngine -
223 \inmodule QtCore -
224 \reentrant -
225 \internal -
226 -
227 \brief The QAbstractFileEngine class provides an abstraction for accessing -
228 the filesystem. -
229 -
230 \ingroup io -
231 \since 4.1 -
232 -
233 The QDir, QFile, and QFileInfo classes all make use of a -
234 QAbstractFileEngine internally. If you create your own QAbstractFileEngine -
235 subclass (and register it with Qt by creating a QAbstractFileEngineHandler -
236 subclass), your file engine will be used when the path is one that your -
237 file engine handles. -
238 -
239 A QAbstractFileEngine refers to one file or one directory. If the referent -
240 is a file, the setFileName(), rename(), and remove() functions are -
241 applicable. If the referent is a directory the mkdir(), rmdir(), and -
242 entryList() functions are applicable. In all cases the caseSensitive(), -
243 isRelativePath(), fileFlags(), ownerId(), owner(), and fileTime() -
244 functions are applicable. -
245 -
246 A QAbstractFileEngine subclass can be created to do synchronous network I/O -
247 based file system operations, local file system operations, or to operate -
248 as a resource system to access file based resources. -
249 -
250 \sa QAbstractFileEngineHandler -
251*/ -
252 -
253/*! -
254 \enum QAbstractFileEngine::FileName -
255 -
256 These values are used to request a file name in a particular -
257 format. -
258 -
259 \value DefaultName The same filename that was passed to the -
260 QAbstractFileEngine. -
261 \value BaseName The name of the file excluding the path. -
262 \value PathName The path to the file excluding the base name. -
263 \value AbsoluteName The absolute path to the file (including -
264 the base name). -
265 \value AbsolutePathName The absolute path to the file (excluding -
266 the base name). -
267 \value LinkName The full file name of the file that this file is a -
268 link to. (This will be empty if this file is not a link.) -
269 \value CanonicalName Often very similar to LinkName. Will return the true path to the file. -
270 \value CanonicalPathName Same as CanonicalName, excluding the base name. -
271 \value BundleName Returns the name of the bundle implies BundleType is set. -
272 -
273 \omitvalue NFileNames -
274 -
275 \sa fileName(), setFileName() -
276*/ -
277 -
278/*! -
279 \enum QAbstractFileEngine::FileFlag -
280 -
281 The permissions and types of a file, suitable for OR'ing together. -
282 -
283 \value ReadOwnerPerm The owner of the file has permission to read -
284 it. -
285 \value WriteOwnerPerm The owner of the file has permission to -
286 write to it. -
287 \value ExeOwnerPerm The owner of the file has permission to -
288 execute it. -
289 \value ReadUserPerm The current user has permission to read the -
290 file. -
291 \value WriteUserPerm The current user has permission to write to -
292 the file. -
293 \value ExeUserPerm The current user has permission to execute the -
294 file. -
295 \value ReadGroupPerm Members of the current user's group have -
296 permission to read the file. -
297 \value WriteGroupPerm Members of the current user's group have -
298 permission to write to the file. -
299 \value ExeGroupPerm Members of the current user's group have -
300 permission to execute the file. -
301 \value ReadOtherPerm All users have permission to read the file. -
302 \value WriteOtherPerm All users have permission to write to the -
303 file. -
304 \value ExeOtherPerm All users have permission to execute the file. -
305 -
306 \value LinkType The file is a link to another file (or link) in -
307 the file system (i.e. not a file or directory). -
308 \value FileType The file is a regular file to the file system -
309 (i.e. not a link or directory) -
310 \value BundleType The file is a Mac OS X bundle implies DirectoryType -
311 \value DirectoryType The file is a directory in the file system -
312 (i.e. not a link or file). -
313 -
314 \value HiddenFlag The file is hidden. -
315 \value ExistsFlag The file actually exists in the file system. -
316 \value RootFlag The file or the file pointed to is the root of the filesystem. -
317 \value LocalDiskFlag The file resides on the local disk and can be passed to standard file functions. -
318 \value Refresh Passing this flag will force the file engine to refresh all flags. -
319 -
320 \omitvalue PermsMask -
321 \omitvalue TypesMask -
322 \omitvalue FlagsMask -
323 \omitvalue FileInfoAll -
324 -
325 \sa fileFlags(), setFileName() -
326*/ -
327 -
328/*! -
329 \enum QAbstractFileEngine::FileTime -
330 -
331 These are used by the fileTime() function. -
332 -
333 \value CreationTime When the file was created. -
334 \value ModificationTime When the file was most recently modified. -
335 \value AccessTime When the file was most recently accessed (e.g. -
336 read or written to). -
337 -
338 \sa setFileName() -
339*/ -
340 -
341/*! -
342 \enum QAbstractFileEngine::FileOwner -
343 -
344 \value OwnerUser The user who owns the file. -
345 \value OwnerGroup The group who owns the file. -
346 -
347 \sa owner(), ownerId(), setFileName() -
348*/ -
349 -
350/*! -
351 Constructs a new QAbstractFileEngine that does not refer to any file or directory. -
352 -
353 \sa setFileName() -
354 */ -
355QAbstractFileEngine::QAbstractFileEngine() : d_ptr(new QAbstractFileEnginePrivate) -
356{ -
357 d_ptr->q_ptr = this;
never executed (the execution status of this line is deduced): d_ptr->q_ptr = this;
-
358}
never executed: }
0
359 -
360/*! -
361 \internal -
362 -
363 Constructs a QAbstractFileEngine. -
364 */ -
365QAbstractFileEngine::QAbstractFileEngine(QAbstractFileEnginePrivate &dd) : d_ptr(&dd) -
366{ -
367 d_ptr->q_ptr = this;
executed (the execution status of this line is deduced): d_ptr->q_ptr = this;
-
368}
executed: }
Execution Count:34787
34787
369 -
370/*! -
371 Destroys the QAbstractFileEngine. -
372 */ -
373QAbstractFileEngine::~QAbstractFileEngine() -
374{ -
375} -
376 -
377/*! -
378 \fn bool QAbstractFileEngine::open(QIODevice::OpenMode mode) -
379 -
380 Opens the file in the specified \a mode. Returns true if the file -
381 was successfully opened; otherwise returns false. -
382 -
383 The \a mode is an OR combination of QIODevice::OpenMode and -
384 QIODevice::HandlingMode values. -
385*/ -
386bool QAbstractFileEngine::open(QIODevice::OpenMode openMode) -
387{ -
388 Q_UNUSED(openMode);
never executed (the execution status of this line is deduced): (void)openMode;;
-
389 return false;
never executed: return false;
0
390} -
391 -
392/*! -
393 Closes the file, returning true if successful; otherwise returns false. -
394 -
395 The default implementation always returns false. -
396*/ -
397bool QAbstractFileEngine::close() -
398{ -
399 return false;
never executed: return false;
0
400} -
401 -
402/*! -
403 Flushes the open file, returning true if successful; otherwise returns -
404 false. -
405 -
406 The default implementation always returns false. -
407*/ -
408bool QAbstractFileEngine::flush() -
409{ -
410 return false;
never executed: return false;
0
411} -
412 -
413/*! -
414 Returns the size of the file. -
415*/ -
416qint64 QAbstractFileEngine::size() const -
417{ -
418 return 0;
never executed: return 0;
0
419} -
420 -
421/*! -
422 Returns the current file position. -
423 -
424 This is the position of the data read/write head of the file. -
425*/ -
426qint64 QAbstractFileEngine::pos() const -
427{ -
428 return 0;
never executed: return 0;
0
429} -
430 -
431/*! -
432 \fn bool QAbstractFileEngine::seek(qint64 offset) -
433 -
434 Sets the file position to the given \a offset. Returns true if -
435 the position was successfully set; otherwise returns false. -
436 -
437 The offset is from the beginning of the file, unless the -
438 file is sequential. -
439 -
440 \sa isSequential() -
441*/ -
442bool QAbstractFileEngine::seek(qint64 pos) -
443{ -
444 Q_UNUSED(pos);
never executed (the execution status of this line is deduced): (void)pos;;
-
445 return false;
never executed: return false;
0
446} -
447 -
448/*! -
449 Returns true if the file is a sequential access device; returns -
450 false if the file is a direct access device. -
451 -
452 Operations involving size() and seek(int) are not valid on -
453 sequential devices. -
454*/ -
455bool QAbstractFileEngine::isSequential() const -
456{ -
457 return false;
never executed: return false;
0
458} -
459 -
460/*! -
461 Requests that the file is deleted from the file system. If the -
462 operation succeeds return true; otherwise return false. -
463 -
464 This virtual function must be reimplemented by all subclasses. -
465 -
466 \sa setFileName(), rmdir() -
467 */ -
468bool QAbstractFileEngine::remove() -
469{ -
470 return false;
never executed: return false;
0
471} -
472 -
473/*! -
474 Copies the contents of this file to a file with the name \a newName. -
475 Returns true on success; otherwise, false is returned. -
476*/ -
477bool QAbstractFileEngine::copy(const QString &newName) -
478{ -
479 Q_UNUSED(newName);
never executed (the execution status of this line is deduced): (void)newName;;
-
480 return false;
never executed: return false;
0
481} -
482 -
483/*! -
484 Requests that the file be renamed to \a newName in the file -
485 system. If the operation succeeds return true; otherwise return -
486 false. -
487 -
488 This virtual function must be reimplemented by all subclasses. -
489 -
490 \sa setFileName() -
491 */ -
492bool QAbstractFileEngine::rename(const QString &newName) -
493{ -
494 Q_UNUSED(newName);
never executed (the execution status of this line is deduced): (void)newName;;
-
495 return false;
never executed: return false;
0
496} -
497 -
498/*! -
499 Creates a link from the file currently specified by fileName() to -
500 \a newName. What a link is depends on the underlying filesystem -
501 (be it a shortcut on Windows or a symbolic link on Unix). Returns -
502 true if successful; otherwise returns false. -
503*/ -
504bool QAbstractFileEngine::link(const QString &newName) -
505{ -
506 Q_UNUSED(newName);
never executed (the execution status of this line is deduced): (void)newName;;
-
507 return false;
never executed: return false;
0
508} -
509 -
510/*! -
511 Requests that the directory \a dirName be created. If -
512 \a createParentDirectories is true, then any sub-directories in \a dirName -
513 that don't exist must be created. If \a createParentDirectories is false then -
514 any sub-directories in \a dirName must already exist for the function to -
515 succeed. If the operation succeeds return true; otherwise return -
516 false. -
517 -
518 This virtual function must be reimplemented by all subclasses. -
519 -
520 \sa setFileName(), rmdir(), isRelativePath() -
521 */ -
522bool QAbstractFileEngine::mkdir(const QString &dirName, bool createParentDirectories) const -
523{ -
524 Q_UNUSED(dirName);
never executed (the execution status of this line is deduced): (void)dirName;;
-
525 Q_UNUSED(createParentDirectories);
never executed (the execution status of this line is deduced): (void)createParentDirectories;;
-
526 return false;
never executed: return false;
0
527} -
528 -
529/*! -
530 Requests that the directory \a dirName is deleted from the file -
531 system. When \a recurseParentDirectories is true, then any empty -
532 parent-directories in \a dirName must also be deleted. If -
533 \a recurseParentDirectories is false, only the \a dirName leaf-node -
534 should be deleted. In most file systems a directory cannot be deleted -
535 using this function if it is non-empty. If the operation succeeds -
536 return true; otherwise return false. -
537 -
538 This virtual function must be reimplemented by all subclasses. -
539 -
540 \sa setFileName(), remove(), mkdir(), isRelativePath() -
541 */ -
542bool QAbstractFileEngine::rmdir(const QString &dirName, bool recurseParentDirectories) const -
543{ -
544 Q_UNUSED(dirName);
never executed (the execution status of this line is deduced): (void)dirName;;
-
545 Q_UNUSED(recurseParentDirectories);
never executed (the execution status of this line is deduced): (void)recurseParentDirectories;;
-
546 return false;
never executed: return false;
0
547} -
548 -
549/*! -
550 Requests that the file be set to size \a size. If \a size is larger -
551 than the current file then it is filled with 0's, if smaller it is -
552 simply truncated. If the operations succceeds return true; otherwise -
553 return false; -
554 -
555 This virtual function must be reimplemented by all subclasses. -
556 -
557 \sa size() -
558*/ -
559bool QAbstractFileEngine::setSize(qint64 size) -
560{ -
561 Q_UNUSED(size);
never executed (the execution status of this line is deduced): (void)size;;
-
562 return false;
never executed: return false;
0
563} -
564 -
565/*! -
566 Should return true if the underlying file system is case-sensitive; -
567 otherwise return false. -
568 -
569 This virtual function must be reimplemented by all subclasses. -
570 */ -
571bool QAbstractFileEngine::caseSensitive() const -
572{ -
573 return false;
never executed: return false;
0
574} -
575 -
576/*! -
577 Return true if the file referred to by this file engine has a -
578 relative path; otherwise return false. -
579 -
580 This virtual function must be reimplemented by all subclasses. -
581 -
582 \sa setFileName() -
583 */ -
584bool QAbstractFileEngine::isRelativePath() const -
585{ -
586 return false;
never executed: return false;
0
587} -
588 -
589/*! -
590 Requests that a list of all the files matching the \a filters -
591 list based on the \a filterNames in the file engine's directory -
592 are returned. -
593 -
594 Should return an empty list if the file engine refers to a file -
595 rather than a directory, or if the directory is unreadable or does -
596 not exist or if nothing matches the specifications. -
597 -
598 This virtual function must be reimplemented by all subclasses. -
599 -
600 \sa setFileName() -
601 */ -
602QStringList QAbstractFileEngine::entryList(QDir::Filters filters, const QStringList &filterNames) const -
603{ -
604 QStringList ret;
never executed (the execution status of this line is deduced): QStringList ret;
-
605 QDirIterator it(fileName(), filterNames, filters);
never executed (the execution status of this line is deduced): QDirIterator it(fileName(), filterNames, filters);
-
606 while (it.hasNext()) {
never evaluated: it.hasNext()
0
607 it.next();
never executed (the execution status of this line is deduced): it.next();
-
608 ret << it.fileName();
never executed (the execution status of this line is deduced): ret << it.fileName();
-
609 }
never executed: }
0
610 return ret;
never executed: return ret;
0
611} -
612 -
613/*! -
614 This function should return the set of OR'd flags that are true -
615 for the file engine's file, and that are in the \a type's OR'd -
616 members. -
617 -
618 In your reimplementation you can use the \a type argument as an -
619 optimization hint and only return the OR'd set of members that are -
620 true and that match those in \a type; in other words you can -
621 ignore any members not mentioned in \a type, thus avoiding some -
622 potentially expensive lookups or system calls. -
623 -
624 This virtual function must be reimplemented by all subclasses. -
625 -
626 \sa setFileName() -
627*/ -
628QAbstractFileEngine::FileFlags QAbstractFileEngine::fileFlags(FileFlags type) const -
629{ -
630 Q_UNUSED(type);
never executed (the execution status of this line is deduced): (void)type;;
-
631 return 0;
never executed: return 0;
0
632} -
633 -
634/*! -
635 Requests that the file's permissions be set to \a perms. The argument -
636 perms will be set to the OR-ed together combination of -
637 QAbstractFileEngine::FileInfo, with only the QAbstractFileEngine::PermsMask being -
638 honored. If the operations succceeds return true; otherwise return -
639 false; -
640 -
641 This virtual function must be reimplemented by all subclasses. -
642 -
643 \sa size() -
644*/ -
645bool QAbstractFileEngine::setPermissions(uint perms) -
646{ -
647 Q_UNUSED(perms);
never executed (the execution status of this line is deduced): (void)perms;;
-
648 return false;
never executed: return false;
0
649} -
650 -
651/*! -
652 Return the file engine's current file name in the format -
653 specified by \a file. -
654 -
655 If you don't handle some \c FileName possibilities, return the -
656 file name set in setFileName() when an unhandled format is -
657 requested. -
658 -
659 This virtual function must be reimplemented by all subclasses. -
660 -
661 \sa setFileName(), FileName -
662 */ -
663QString QAbstractFileEngine::fileName(FileName file) const -
664{ -
665 Q_UNUSED(file);
never executed (the execution status of this line is deduced): (void)file;;
-
666 return QString();
never executed: return QString();
0
667} -
668 -
669/*! -
670 If \a owner is \c OwnerUser return the ID of the user who owns -
671 the file. If \a owner is \c OwnerGroup return the ID of the group -
672 that own the file. If you can't determine the owner return -2. -
673 -
674 This virtual function must be reimplemented by all subclasses. -
675 -
676 \sa owner(), setFileName(), FileOwner -
677 */ -
678uint QAbstractFileEngine::ownerId(FileOwner owner) const -
679{ -
680 Q_UNUSED(owner);
never executed (the execution status of this line is deduced): (void)owner;;
-
681 return 0;
never executed: return 0;
0
682} -
683 -
684/*! -
685 If \a owner is \c OwnerUser return the name of the user who owns -
686 the file. If \a owner is \c OwnerGroup return the name of the group -
687 that own the file. If you can't determine the owner return -
688 QString(). -
689 -
690 This virtual function must be reimplemented by all subclasses. -
691 -
692 \sa ownerId(), setFileName(), FileOwner -
693 */ -
694QString QAbstractFileEngine::owner(FileOwner owner) const -
695{ -
696 Q_UNUSED(owner);
never executed (the execution status of this line is deduced): (void)owner;;
-
697 return QString();
never executed: return QString();
0
698} -
699 -
700/*! -
701 If \a time is \c CreationTime, return when the file was created. -
702 If \a time is \c ModificationTime, return when the file was most -
703 recently modified. If \a time is \c AccessTime, return when the -
704 file was most recently accessed (e.g. read or written). -
705 If the time cannot be determined return QDateTime() (an invalid -
706 date time). -
707 -
708 This virtual function must be reimplemented by all subclasses. -
709 -
710 \sa setFileName(), QDateTime, QDateTime::isValid(), FileTime -
711 */ -
712QDateTime QAbstractFileEngine::fileTime(FileTime time) const -
713{ -
714 Q_UNUSED(time);
never executed (the execution status of this line is deduced): (void)time;;
-
715 return QDateTime();
never executed: return QDateTime();
0
716} -
717 -
718/*! -
719 Sets the file engine's file name to \a file. This file name is the -
720 file that the rest of the virtual functions will operate on. -
721 -
722 This virtual function must be reimplemented by all subclasses. -
723 -
724 \sa rename() -
725 */ -
726void QAbstractFileEngine::setFileName(const QString &file) -
727{ -
728 Q_UNUSED(file);
never executed (the execution status of this line is deduced): (void)file;;
-
729}
never executed: }
0
730 -
731/*! -
732 Returns the native file handle for this file engine. This handle must be -
733 used with care; its value and type are platform specific, and using it -
734 will most likely lead to non-portable code. -
735*/ -
736int QAbstractFileEngine::handle() const -
737{ -
738 return -1;
executed: return -1;
Execution Count:6
6
739} -
740 -
741/*! -
742 \since 4.3 -
743 -
744 Returns true if the current position is at the end of the file; otherwise, -
745 returns false. -
746 -
747 This function bases its behavior on calling extension() with -
748 AtEndExtension. If the engine does not support this extension, false is -
749 returned. -
750 -
751 \sa extension(), supportsExtension(), QFile::atEnd() -
752*/ -
753bool QAbstractFileEngine::atEnd() const -
754{ -
755 return const_cast<QAbstractFileEngine *>(this)->extension(AtEndExtension);
never executed: return const_cast<QAbstractFileEngine *>(this)->extension(AtEndExtension);
0
756} -
757 -
758/*! -
759 \since 4.4 -
760 -
761 Maps \a size bytes of the file into memory starting at \a offset. -
762 Returns a pointer to the memory if successful; otherwise returns false -
763 if, for example, an error occurs. -
764 -
765 This function bases its behavior on calling extension() with -
766 MapExtensionOption. If the engine does not support this extension, 0 is -
767 returned. -
768 -
769 \a flags is currently not used, but could be used in the future. -
770 -
771 \sa unmap(), supportsExtension() -
772 */ -
773 -
774uchar *QAbstractFileEngine::map(qint64 offset, qint64 size, QFile::MemoryMapFlags flags) -
775{ -
776 MapExtensionOption option;
executed (the execution status of this line is deduced): MapExtensionOption option;
-
777 option.offset = offset;
executed (the execution status of this line is deduced): option.offset = offset;
-
778 option.size = size;
executed (the execution status of this line is deduced): option.size = size;
-
779 option.flags = flags;
executed (the execution status of this line is deduced): option.flags = flags;
-
780 MapExtensionReturn r;
executed (the execution status of this line is deduced): MapExtensionReturn r;
-
781 if (!extension(MapExtension, &option, &r))
evaluated: !extension(MapExtension, &option, &r)
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:33320
24-33320
782 return 0;
executed: return 0;
Execution Count:24
24
783 return r.address;
executed: return r.address;
Execution Count:33320
33320
784} -
785 -
786/*! -
787 \since 4.4 -
788 -
789 Unmaps the memory \a address. Returns true if the unmap succeeds; otherwise -
790 returns false. -
791 -
792 This function bases its behavior on calling extension() with -
793 UnMapExtensionOption. If the engine does not support this extension, false is -
794 returned. -
795 -
796 \sa map(), supportsExtension() -
797 */ -
798bool QAbstractFileEngine::unmap(uchar *address) -
799{ -
800 UnMapExtensionOption options;
executed (the execution status of this line is deduced): UnMapExtensionOption options;
-
801 options.address = address;
executed (the execution status of this line is deduced): options.address = address;
-
802 return extension(UnMapExtension, &options);
executed: return extension(UnMapExtension, &options);
Execution Count:33335
33335
803} -
804 -
805/*! -
806 \since 4.3 -
807 \class QAbstractFileEngineIterator -
808 \inmodule QtCore -
809 \brief The QAbstractFileEngineIterator class provides an iterator -
810 interface for custom file engines. -
811 \internal -
812 -
813 If all you want is to iterate over entries in a directory, see -
814 QDirIterator instead. This class is only for custom file engine authors. -
815 -
816 QAbstractFileEngineIterator is a unidirectional single-use virtual -
817 iterator that plugs into QDirIterator, providing transparent proxy -
818 iteration for custom file engines. -
819 -
820 You can subclass QAbstractFileEngineIterator to provide an iterator when -
821 writing your own file engine. To plug the iterator into your file system, -
822 you simply return an instance of this subclass from a reimplementation of -
823 QAbstractFileEngine::beginEntryList(). -
824 -
825 Example: -
826 -
827 \snippet code/src_corelib_io_qabstractfileengine.cpp 2 -
828 -
829 QAbstractFileEngineIterator is associated with a path, name filters, and -
830 entry filters. The path is the directory that the iterator lists entries -
831 in. The name filters and entry filters are provided for file engines that -
832 can optimize directory listing at the iterator level (e.g., network file -
833 systems that need to minimize network traffic), but they can also be -
834 ignored by the iterator subclass; QAbstractFileEngineIterator already -
835 provides the required filtering logics in the matchesFilters() function. -
836 You can call dirName() to get the directory name, nameFilters() to get a -
837 stringlist of name filters, and filters() to get the entry filters. -
838 -
839 The pure virtual function hasNext() returns true if the current directory -
840 has at least one more entry (i.e., the directory name is valid and -
841 accessible, and we have not reached the end of the entry list), and false -
842 otherwise. Reimplement next() to seek to the next entry. -
843 -
844 The pure virtual function currentFileName() returns the name of the -
845 current entry without advancing the iterator. The currentFilePath() -
846 function is provided for convenience; it returns the full path of the -
847 current entry. -
848 -
849 Here is an example of how to implement an iterator that returns each of -
850 three fixed entries in sequence. -
851 -
852 \snippet code/src_corelib_io_qabstractfileengine.cpp 3 -
853 -
854 Note: QAbstractFileEngineIterator does not deal with QDir::IteratorFlags; -
855 it simply returns entries for a single directory. -
856 -
857 \sa QDirIterator -
858*/ -
859 -
860/*! -
861 \enum QAbstractFileEngineIterator::EntryInfoType -
862 \internal -
863 -
864 This enum describes the different types of information that can be -
865 requested through the QAbstractFileEngineIterator::entryInfo() function. -
866*/ -
867 -
868/*! -
869 \typedef QAbstractFileEngine::Iterator -
870 \since 4.3 -
871 \relates QAbstractFileEngine -
872 -
873 Synonym for QAbstractFileEngineIterator. -
874*/ -
875 -
876class QAbstractFileEngineIteratorPrivate -
877{ -
878public: -
879 QString path; -
880 QDir::Filters filters; -
881 QStringList nameFilters; -
882 QFileInfo fileInfo; -
883}; -
884 -
885/*! -
886 Constructs a QAbstractFileEngineIterator, using the entry filters \a -
887 filters, and wildcard name filters \a nameFilters. -
888*/ -
889QAbstractFileEngineIterator::QAbstractFileEngineIterator(QDir::Filters filters, -
890 const QStringList &nameFilters) -
891 : d(new QAbstractFileEngineIteratorPrivate) -
892{ -
893 d->nameFilters = nameFilters;
executed (the execution status of this line is deduced): d->nameFilters = nameFilters;
-
894 d->filters = filters;
executed (the execution status of this line is deduced): d->filters = filters;
-
895}
executed: }
Execution Count:17
17
896 -
897/*! -
898 Destroys the QAbstractFileEngineIterator. -
899 -
900 \sa QDirIterator -
901*/ -
902QAbstractFileEngineIterator::~QAbstractFileEngineIterator() -
903{ -
904} -
905 -
906/*! -
907 Returns the path for this iterator. QDirIterator is responsible for -
908 assigning this path; it cannot change during the iterator's lifetime. -
909 -
910 \sa nameFilters(), filters() -
911*/ -
912QString QAbstractFileEngineIterator::path() const -
913{ -
914 return d->path;
executed: return d->path;
Execution Count:383
383
915} -
916 -
917/*! -
918 \internal -
919 -
920 Sets the iterator path to \a path. This function is called from within -
921 QDirIterator. -
922*/ -
923void QAbstractFileEngineIterator::setPath(const QString &path) -
924{ -
925 d->path = path;
executed (the execution status of this line is deduced): d->path = path;
-
926}
executed: }
Execution Count:17
17
927 -
928/*! -
929 Returns the name filters for this iterator. -
930 -
931 \sa QDir::nameFilters(), filters(), path() -
932*/ -
933QStringList QAbstractFileEngineIterator::nameFilters() const -
934{ -
935 return d->nameFilters;
never executed: return d->nameFilters;
0
936} -
937 -
938/*! -
939 Returns the entry filters for this iterator. -
940 -
941 \sa QDir::filter(), nameFilters(), path() -
942*/ -
943QDir::Filters QAbstractFileEngineIterator::filters() const -
944{ -
945 return d->filters;
never executed: return d->filters;
0
946} -
947 -
948/*! -
949 \fn QString QAbstractFileEngineIterator::currentFileName() const = 0 -
950 -
951 This pure virtual function returns the name of the current directory -
952 entry, excluding the path. -
953 -
954 \sa currentFilePath() -
955*/ -
956 -
957/*! -
958 Returns the path to the current directory entry. It's the same as -
959 prepending path() to the return value of currentFileName(). -
960 -
961 \sa currentFileName() -
962*/ -
963QString QAbstractFileEngineIterator::currentFilePath() const -
964{ -
965 QString name = currentFileName();
executed (the execution status of this line is deduced): QString name = currentFileName();
-
966 if (!name.isNull()) {
partially evaluated: !name.isNull()
TRUEFALSE
yes
Evaluation Count:366
no
Evaluation Count:0
0-366
967 QString tmp = path();
executed (the execution status of this line is deduced): QString tmp = path();
-
968 if (!tmp.isEmpty()) {
partially evaluated: !tmp.isEmpty()
TRUEFALSE
yes
Evaluation Count:366
no
Evaluation Count:0
0-366
969 if (!tmp.endsWith(QLatin1Char('/')))
evaluated: !tmp.endsWith(QLatin1Char('/'))
TRUEFALSE
yes
Evaluation Count:358
yes
Evaluation Count:8
8-358
970 tmp.append(QLatin1Char('/'));
executed: tmp.append(QLatin1Char('/'));
Execution Count:358
358
971 name.prepend(tmp);
executed (the execution status of this line is deduced): name.prepend(tmp);
-
972 }
executed: }
Execution Count:366
366
973 }
executed: }
Execution Count:366
366
974 return name;
executed: return name;
Execution Count:366
366
975} -
976 -
977/*! -
978 The virtual function returns a QFileInfo for the current directory -
979 entry. This function is provided for convenience. It can also be slightly -
980 faster than creating a QFileInfo object yourself, as the object returned -
981 by this function might contain cached information that QFileInfo otherwise -
982 would have to access through the file engine. -
983 -
984 \sa currentFileName() -
985*/ -
986QFileInfo QAbstractFileEngineIterator::currentFileInfo() const -
987{ -
988 QString path = currentFilePath();
executed (the execution status of this line is deduced): QString path = currentFilePath();
-
989 if (d->fileInfo.filePath() != path)
partially evaluated: d->fileInfo.filePath() != path
TRUEFALSE
yes
Evaluation Count:183
no
Evaluation Count:0
0-183
990 d->fileInfo.setFile(path);
executed: d->fileInfo.setFile(path);
Execution Count:183
183
991 -
992 // return a shallow copy -
993 return d->fileInfo;
executed: return d->fileInfo;
Execution Count:183
183
994} -
995 -
996/*! -
997 \internal -
998 -
999 Returns the entry info \a type for this iterator's current directory entry -
1000 as a QVariant. If \a type is undefined for this entry, a null QVariant is -
1001 returned. -
1002 -
1003 \sa QAbstractFileEngine::beginEntryList(), QDir::beginEntryList() -
1004*/ -
1005QVariant QAbstractFileEngineIterator::entryInfo(EntryInfoType type) const -
1006{ -
1007 Q_UNUSED(type)
never executed (the execution status of this line is deduced): (void)type;
-
1008 return QVariant();
never executed: return QVariant();
0
1009} -
1010 -
1011/*! -
1012 \fn virtual QString QAbstractFileEngineIterator::next() = 0 -
1013 -
1014 This pure virtual function advances the iterator to the next directory -
1015 entry, and returns the file path to the current entry. -
1016 -
1017 This function can optionally make use of nameFilters() and filters() to -
1018 optimize its performance. -
1019 -
1020 Reimplement this function in a subclass to advance the iterator. -
1021 -
1022 \sa QDirIterator::next() -
1023*/ -
1024 -
1025/*! -
1026 \fn virtual bool QAbstractFileEngineIterator::hasNext() const = 0 -
1027 -
1028 This pure virtual function returns true if there is at least one more -
1029 entry in the current directory (i.e., the iterator path is valid and -
1030 accessible, and the iterator has not reached the end of the entry list). -
1031 -
1032 \sa QDirIterator::hasNext() -
1033*/ -
1034 -
1035/*! -
1036 Returns an instance of a QAbstractFileEngineIterator using \a filters for -
1037 entry filtering and \a filterNames for name filtering. This function is -
1038 called by QDirIterator to initiate directory iteration. -
1039 -
1040 QDirIterator takes ownership of the returned instance, and deletes it when -
1041 it's done. -
1042 -
1043 \sa QDirIterator -
1044*/ -
1045QAbstractFileEngine::Iterator *QAbstractFileEngine::beginEntryList(QDir::Filters filters, const QStringList &filterNames) -
1046{ -
1047 Q_UNUSED(filters);
never executed (the execution status of this line is deduced): (void)filters;;
-
1048 Q_UNUSED(filterNames);
never executed (the execution status of this line is deduced): (void)filterNames;;
-
1049 return 0;
never executed: return 0;
0
1050} -
1051 -
1052/*! -
1053 \internal -
1054*/ -
1055QAbstractFileEngine::Iterator *QAbstractFileEngine::endEntryList() -
1056{ -
1057 return 0;
never executed: return 0;
0
1058} -
1059 -
1060/*! -
1061 Reads a number of characters from the file into \a data. At most -
1062 \a maxlen characters will be read. -
1063 -
1064 Returns -1 if a fatal error occurs, or 0 if there are no bytes to -
1065 read. -
1066*/ -
1067qint64 QAbstractFileEngine::read(char *data, qint64 maxlen) -
1068{ -
1069 Q_UNUSED(data);
never executed (the execution status of this line is deduced): (void)data;;
-
1070 Q_UNUSED(maxlen);
never executed (the execution status of this line is deduced): (void)maxlen;;
-
1071 return -1;
never executed: return -1;
0
1072} -
1073 -
1074/*! -
1075 Writes \a len bytes from \a data to the file. Returns the number -
1076 of characters written on success; otherwise returns -1. -
1077*/ -
1078qint64 QAbstractFileEngine::write(const char *data, qint64 len) -
1079{ -
1080 Q_UNUSED(data);
never executed (the execution status of this line is deduced): (void)data;;
-
1081 Q_UNUSED(len);
never executed (the execution status of this line is deduced): (void)len;;
-
1082 return -1;
never executed: return -1;
0
1083} -
1084 -
1085/*! -
1086 This function reads one line, terminated by a '\\n' character, from the -
1087 file info \a data. At most \a maxlen characters will be read. The -
1088 end-of-line character is included. -
1089*/ -
1090qint64 QAbstractFileEngine::readLine(char *data, qint64 maxlen) -
1091{ -
1092 qint64 readSoFar = 0;
executed (the execution status of this line is deduced): qint64 readSoFar = 0;
-
1093 while (readSoFar < maxlen) {
partially evaluated: readSoFar < maxlen
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
1094 char c;
executed (the execution status of this line is deduced): char c;
-
1095 qint64 readResult = read(&c, 1);
executed (the execution status of this line is deduced): qint64 readResult = read(&c, 1);
-
1096 if (readResult <= 0)
partially evaluated: readResult <= 0
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
1097 return (readSoFar > 0) ? readSoFar : -1;
executed: return (readSoFar > 0) ? readSoFar : -1;
Execution Count:8
8
1098 ++readSoFar;
never executed (the execution status of this line is deduced): ++readSoFar;
-
1099 *data++ = c;
never executed (the execution status of this line is deduced): *data++ = c;
-
1100 if (c == '\n')
never evaluated: c == '\n'
0
1101 return readSoFar;
never executed: return readSoFar;
0
1102 }
never executed: }
0
1103 return readSoFar;
never executed: return readSoFar;
0
1104} -
1105 -
1106/*! -
1107 \enum QAbstractFileEngine::Extension -
1108 \since 4.3 -
1109 -
1110 This enum describes the types of extensions that the file engine can -
1111 support. Before using these extensions, you must verify that the extension -
1112 is supported (i.e., call supportsExtension()). -
1113 -
1114 \value AtEndExtension Whether the current file position is at the end of -
1115 the file or not. This extension allows file engines that implement local -
1116 buffering to report end-of-file status without having to check the size of -
1117 the file. It is also useful for sequential files, where the size of the -
1118 file cannot be used to determine whether or not you have reached the end. -
1119 This extension returns true if the file is at the end; otherwise it returns -
1120 false. The input and output arguments to extension() are ignored. -
1121 -
1122 \value FastReadLineExtension Whether the file engine provides a -
1123 fast implementation for readLine() or not. If readLine() remains -
1124 unimplemented in the file engine, QAbstractFileEngine will provide -
1125 an implementation based on calling read() repeatedly. If -
1126 supportsExtension() returns false for this extension, however, -
1127 QIODevice can provide a faster implementation by making use of its -
1128 internal buffer. For engines that already provide a fast readLine() -
1129 implementation, returning false for this extension can avoid -
1130 unnnecessary double-buffering in QIODevice. -
1131 -
1132 \value MapExtension Whether the file engine provides the ability to map -
1133 a file to memory. -
1134 -
1135 \value UnMapExtension Whether the file engine provides the ability to -
1136 unmap memory that was previously mapped. -
1137*/ -
1138 -
1139/*! -
1140 \class QAbstractFileEngine::ExtensionOption -
1141 \inmodule QtCore -
1142 \since 4.3 -
1143 \brief provides an extended input argument to QAbstractFileEngine's -
1144 extension support. -
1145 -
1146 \sa QAbstractFileEngine::extension() -
1147*/ -
1148 -
1149/*! -
1150 \class QAbstractFileEngine::ExtensionReturn -
1151 \inmodule QtCore -
1152 \since 4.3 -
1153 \brief provides an extended output argument to QAbstractFileEngine's -
1154 extension support. -
1155 -
1156 \sa QAbstractFileEngine::extension() -
1157*/ -
1158 -
1159/*! -
1160 \since 4.3 -
1161 -
1162 This virtual function can be reimplemented in a QAbstractFileEngine -
1163 subclass to provide support for extensions. The \a option argument is -
1164 provided as input to the extension, and this function can store output -
1165 results in \a output. -
1166 -
1167 The behavior of this function is determined by \a extension; see the -
1168 Extension documentation for details. -
1169 -
1170 You can call supportsExtension() to check if an extension is supported by -
1171 the file engine. -
1172 -
1173 By default, no extensions are supported, and this function returns false. -
1174 -
1175 \sa supportsExtension(), Extension -
1176*/ -
1177bool QAbstractFileEngine::extension(Extension extension, const ExtensionOption *option, ExtensionReturn *output) -
1178{ -
1179 Q_UNUSED(extension);
never executed (the execution status of this line is deduced): (void)extension;;
-
1180 Q_UNUSED(option);
never executed (the execution status of this line is deduced): (void)option;;
-
1181 Q_UNUSED(output);
never executed (the execution status of this line is deduced): (void)output;;
-
1182 return false;
never executed: return false;
0
1183} -
1184 -
1185/*! -
1186 \since 4.3 -
1187 -
1188 This virtual function returns true if the file engine supports \a -
1189 extension; otherwise, false is returned. By default, no extensions are -
1190 supported. -
1191 -
1192 \sa extension() -
1193*/ -
1194bool QAbstractFileEngine::supportsExtension(Extension extension) const -
1195{ -
1196 Q_UNUSED(extension);
never executed (the execution status of this line is deduced): (void)extension;;
-
1197 return false;
never executed: return false;
0
1198} -
1199 -
1200/*! -
1201 Returns the QFile::FileError that resulted from the last failed -
1202 operation. If QFile::UnspecifiedError is returned, QFile will -
1203 use its own idea of the error status. -
1204 -
1205 \sa QFile::FileError, errorString() -
1206 */ -
1207QFile::FileError QAbstractFileEngine::error() const -
1208{ -
1209 Q_D(const QAbstractFileEngine);
executed (the execution status of this line is deduced): const QAbstractFileEnginePrivate * const d = d_func();
-
1210 return d->fileError;
executed: return d->fileError;
Execution Count:3334
3334
1211} -
1212 -
1213/*! -
1214 Returns the human-readable message appropriate to the current error -
1215 reported by error(). If no suitable string is available, an -
1216 empty string is returned. -
1217 -
1218 \sa error() -
1219 */ -
1220QString QAbstractFileEngine::errorString() const -
1221{ -
1222 Q_D(const QAbstractFileEngine);
executed (the execution status of this line is deduced): const QAbstractFileEnginePrivate * const d = d_func();
-
1223 return d->errorString;
executed: return d->errorString;
Execution Count:3955
3955
1224} -
1225 -
1226/*! -
1227 Sets the error type to \a error, and the error string to \a errorString. -
1228 Call this function to set the error values returned by the higher-level -
1229 classes. -
1230 -
1231 \sa QFile::error(), QIODevice::errorString(), QIODevice::setErrorString() -
1232*/ -
1233void QAbstractFileEngine::setError(QFile::FileError error, const QString &errorString) -
1234{ -
1235 Q_D(QAbstractFileEngine);
executed (the execution status of this line is deduced): QAbstractFileEnginePrivate * const d = d_func();
-
1236 d->fileError = error;
executed (the execution status of this line is deduced): d->fileError = error;
-
1237 d->errorString = errorString;
executed (the execution status of this line is deduced): d->errorString = errorString;
-
1238}
executed: }
Execution Count:5326
5326
1239 -
1240QT_END_NAMESPACE -
1241 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial