| Line | Source Code | Coverage |
|---|
| 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 "qplatformdefs.h" | - |
| 43 | #include "qfileinfo.h" | - |
| 44 | #include "qglobal.h" | - |
| 45 | #include "qdir.h" | - |
| 46 | #include "qfileinfo_p.h" | - |
| 47 | | - |
| 48 | QT_BEGIN_NAMESPACE | - |
| 49 | | - |
| 50 | QString QFileInfoPrivate::getFileName(QAbstractFileEngine::FileName name) const | - |
| 51 | { | - |
| 52 | if (cache_enabled && !fileNames[(int)name].isNull()) partially evaluated: cache_enabled| yes Evaluation Count:11805 | no Evaluation Count:0 |
evaluated: !fileNames[(int)name].isNull()| yes Evaluation Count:612 | yes Evaluation Count:11193 |
| 0-11805 |
| 53 | return fileNames[(int)name]; executed: return fileNames[(int)name];Execution Count:612 | 612 |
| 54 | | - |
| 55 | QString ret; executed (the execution status of this line is deduced): QString ret; | - |
| 56 | if (fileEngine == 0) { // local file; use the QFileSystemEngine directly evaluated: fileEngine == 0| yes Evaluation Count:9539 | yes Evaluation Count:1654 |
| 1654-9539 |
| 57 | switch (name) { | - |
| 58 | case QAbstractFileEngine::CanonicalName: | - |
| 59 | case QAbstractFileEngine::CanonicalPathName: { | - |
| 60 | QFileSystemEntry entry = QFileSystemEngine::canonicalName(fileEntry, metaData); executed (the execution status of this line is deduced): QFileSystemEntry entry = QFileSystemEngine::canonicalName(fileEntry, metaData); | - |
| 61 | if (cache_enabled) { // be smart and store both partially evaluated: cache_enabled| yes Evaluation Count:1635 | no Evaluation Count:0 |
| 0-1635 |
| 62 | fileNames[QAbstractFileEngine::CanonicalName] = entry.filePath(); executed (the execution status of this line is deduced): fileNames[QAbstractFileEngine::CanonicalName] = entry.filePath(); | - |
| 63 | fileNames[QAbstractFileEngine::CanonicalPathName] = entry.path(); executed (the execution status of this line is deduced): fileNames[QAbstractFileEngine::CanonicalPathName] = entry.path(); | - |
| 64 | } executed: }Execution Count:1635 | 1635 |
| 65 | if (name == QAbstractFileEngine::CanonicalName) partially evaluated: name == QAbstractFileEngine::CanonicalName| yes Evaluation Count:1635 | no Evaluation Count:0 |
| 0-1635 |
| 66 | ret = entry.filePath(); executed: ret = entry.filePath();Execution Count:1635 | 1635 |
| 67 | else | - |
| 68 | ret = entry.path(); never executed: ret = entry.path(); | 0 |
| 69 | break; executed: break;Execution Count:1635 | 1635 |
| 70 | } | - |
| 71 | case QAbstractFileEngine::LinkName: | - |
| 72 | ret = QFileSystemEngine::getLinkTarget(fileEntry, metaData).filePath(); executed (the execution status of this line is deduced): ret = QFileSystemEngine::getLinkTarget(fileEntry, metaData).filePath(); | - |
| 73 | break; executed: break;Execution Count:8 | 8 |
| 74 | case QAbstractFileEngine::BundleName: | - |
| 75 | ret = QFileSystemEngine::bundleName(fileEntry); never executed (the execution status of this line is deduced): ret = QFileSystemEngine::bundleName(fileEntry); | - |
| 76 | break; | 0 |
| 77 | case QAbstractFileEngine::AbsoluteName: | - |
| 78 | case QAbstractFileEngine::AbsolutePathName: { | - |
| 79 | QFileSystemEntry entry = QFileSystemEngine::absoluteName(fileEntry); executed (the execution status of this line is deduced): QFileSystemEntry entry = QFileSystemEngine::absoluteName(fileEntry); | - |
| 80 | if (cache_enabled) { // be smart and store both partially evaluated: cache_enabled| yes Evaluation Count:7896 | no Evaluation Count:0 |
| 0-7896 |
| 81 | fileNames[QAbstractFileEngine::AbsoluteName] = entry.filePath(); executed (the execution status of this line is deduced): fileNames[QAbstractFileEngine::AbsoluteName] = entry.filePath(); | - |
| 82 | fileNames[QAbstractFileEngine::AbsolutePathName] = entry.path(); executed (the execution status of this line is deduced): fileNames[QAbstractFileEngine::AbsolutePathName] = entry.path(); | - |
| 83 | } executed: }Execution Count:7896 | 7896 |
| 84 | if (name == QAbstractFileEngine::AbsoluteName) evaluated: name == QAbstractFileEngine::AbsoluteName| yes Evaluation Count:7447 | yes Evaluation Count:449 |
| 449-7447 |
| 85 | ret = entry.filePath(); executed: ret = entry.filePath();Execution Count:7447 | 7447 |
| 86 | else | - |
| 87 | ret = entry.path(); executed: ret = entry.path();Execution Count:449 | 449 |
| 88 | break; executed: break;Execution Count:7896 | 7896 |
| 89 | } | - |
| 90 | default: break; | 0 |
| 91 | } | - |
| 92 | } else { executed: }Execution Count:9539 | 9539 |
| 93 | ret = fileEngine->fileName(name); executed (the execution status of this line is deduced): ret = fileEngine->fileName(name); | - |
| 94 | } executed: }Execution Count:1654 | 1654 |
| 95 | if (ret.isNull()) evaluated: ret.isNull()| yes Evaluation Count:10 | yes Evaluation Count:11183 |
| 10-11183 |
| 96 | ret = QLatin1String(""); executed: ret = QLatin1String("");Execution Count:10 | 10 |
| 97 | if (cache_enabled) partially evaluated: cache_enabled| yes Evaluation Count:11193 | no Evaluation Count:0 |
| 0-11193 |
| 98 | fileNames[(int)name] = ret; executed: fileNames[(int)name] = ret;Execution Count:11193 | 11193 |
| 99 | return ret; executed: return ret;Execution Count:11193 | 11193 |
| 100 | } | - |
| 101 | | - |
| 102 | QString QFileInfoPrivate::getFileOwner(QAbstractFileEngine::FileOwner own) const | - |
| 103 | { | - |
| 104 | if (cache_enabled && !fileOwners[(int)own].isNull()) never evaluated: cache_enabled never evaluated: !fileOwners[(int)own].isNull() | 0 |
| 105 | return fileOwners[(int)own]; never executed: return fileOwners[(int)own]; | 0 |
| 106 | QString ret; never executed (the execution status of this line is deduced): QString ret; | - |
| 107 | if (fileEngine == 0) { never evaluated: fileEngine == 0 | 0 |
| 108 | switch (own) { | - |
| 109 | case QAbstractFileEngine::OwnerUser: | - |
| 110 | ret = QFileSystemEngine::resolveUserName(fileEntry, metaData); never executed (the execution status of this line is deduced): ret = QFileSystemEngine::resolveUserName(fileEntry, metaData); | - |
| 111 | break; | 0 |
| 112 | case QAbstractFileEngine::OwnerGroup: | - |
| 113 | ret = QFileSystemEngine::resolveGroupName(fileEntry, metaData); never executed (the execution status of this line is deduced): ret = QFileSystemEngine::resolveGroupName(fileEntry, metaData); | - |
| 114 | break; | 0 |
| 115 | } | - |
| 116 | } else { | 0 |
| 117 | ret = fileEngine->owner(own); never executed (the execution status of this line is deduced): ret = fileEngine->owner(own); | - |
| 118 | } | 0 |
| 119 | if (ret.isNull()) never evaluated: ret.isNull() | 0 |
| 120 | ret = QLatin1String(""); never executed: ret = QLatin1String(""); | 0 |
| 121 | if (cache_enabled) never evaluated: cache_enabled | 0 |
| 122 | fileOwners[(int)own] = ret; never executed: fileOwners[(int)own] = ret; | 0 |
| 123 | return ret; never executed: return ret; | 0 |
| 124 | } | - |
| 125 | | - |
| 126 | uint QFileInfoPrivate::getFileFlags(QAbstractFileEngine::FileFlags request) const | - |
| 127 | { | - |
| 128 | Q_ASSERT(fileEngine); // should never be called when using the native FS executed (the execution status of this line is deduced): qt_noop(); | - |
| 129 | // We split the testing into tests for for LinkType, BundleType, PermsMask | - |
| 130 | // and the rest. | - |
| 131 | // Tests for file permissions on Windows can be slow, expecially on network | - |
| 132 | // paths and NTFS drives. | - |
| 133 | // In order to determine if a file is a symlink or not, we have to lstat(). | - |
| 134 | // If we're not interested in that information, we might as well avoid one | - |
| 135 | // extra syscall. Bundle detecton on Mac can be slow, expecially on network | - |
| 136 | // paths, so we separate out that as well. | - |
| 137 | | - |
| 138 | QAbstractFileEngine::FileFlags req = 0; executed (the execution status of this line is deduced): QAbstractFileEngine::FileFlags req = 0; | - |
| 139 | uint cachedFlags = 0; executed (the execution status of this line is deduced): uint cachedFlags = 0; | - |
| 140 | | - |
| 141 | if (request & (QAbstractFileEngine::FlagsMask | QAbstractFileEngine::TypesMask)) { evaluated: request & (QAbstractFileEngine::FlagsMask | QAbstractFileEngine::TypesMask)| yes Evaluation Count:3156 | yes Evaluation Count:4 |
| 4-3156 |
| 142 | if (!getCachedFlag(CachedFileFlags)) { evaluated: !getCachedFlag(CachedFileFlags)| yes Evaluation Count:2771 | yes Evaluation Count:385 |
| 385-2771 |
| 143 | req |= QAbstractFileEngine::FlagsMask; executed (the execution status of this line is deduced): req |= QAbstractFileEngine::FlagsMask; | - |
| 144 | req |= QAbstractFileEngine::TypesMask; executed (the execution status of this line is deduced): req |= QAbstractFileEngine::TypesMask; | - |
| 145 | req &= (~QAbstractFileEngine::LinkType); executed (the execution status of this line is deduced): req &= (~QAbstractFileEngine::LinkType); | - |
| 146 | req &= (~QAbstractFileEngine::BundleType); executed (the execution status of this line is deduced): req &= (~QAbstractFileEngine::BundleType); | - |
| 147 | | - |
| 148 | cachedFlags |= CachedFileFlags; executed (the execution status of this line is deduced): cachedFlags |= CachedFileFlags; | - |
| 149 | } executed: }Execution Count:2771 | 2771 |
| 150 | | - |
| 151 | if (request & QAbstractFileEngine::LinkType) { evaluated: request & QAbstractFileEngine::LinkType| yes Evaluation Count:4 | yes Evaluation Count:3152 |
| 4-3152 |
| 152 | if (!getCachedFlag(CachedLinkTypeFlag)) { partially evaluated: !getCachedFlag(CachedLinkTypeFlag)| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 153 | req |= QAbstractFileEngine::LinkType; executed (the execution status of this line is deduced): req |= QAbstractFileEngine::LinkType; | - |
| 154 | cachedFlags |= CachedLinkTypeFlag; executed (the execution status of this line is deduced): cachedFlags |= CachedLinkTypeFlag; | - |
| 155 | } executed: }Execution Count:4 | 4 |
| 156 | } executed: }Execution Count:4 | 4 |
| 157 | | - |
| 158 | if (request & QAbstractFileEngine::BundleType) { partially evaluated: request & QAbstractFileEngine::BundleType| no Evaluation Count:0 | yes Evaluation Count:3156 |
| 0-3156 |
| 159 | if (!getCachedFlag(CachedBundleTypeFlag)) { never evaluated: !getCachedFlag(CachedBundleTypeFlag) | 0 |
| 160 | req |= QAbstractFileEngine::BundleType; never executed (the execution status of this line is deduced): req |= QAbstractFileEngine::BundleType; | - |
| 161 | cachedFlags |= CachedBundleTypeFlag; never executed (the execution status of this line is deduced): cachedFlags |= CachedBundleTypeFlag; | - |
| 162 | } | 0 |
| 163 | } | 0 |
| 164 | } executed: }Execution Count:3156 | 3156 |
| 165 | | - |
| 166 | if (request & QAbstractFileEngine::PermsMask) { evaluated: request & QAbstractFileEngine::PermsMask| yes Evaluation Count:4 | yes Evaluation Count:3156 |
| 4-3156 |
| 167 | if (!getCachedFlag(CachedPerms)) { partially evaluated: !getCachedFlag(CachedPerms)| yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
| 168 | req |= QAbstractFileEngine::PermsMask; executed (the execution status of this line is deduced): req |= QAbstractFileEngine::PermsMask; | - |
| 169 | cachedFlags |= CachedPerms; executed (the execution status of this line is deduced): cachedFlags |= CachedPerms; | - |
| 170 | } executed: }Execution Count:4 | 4 |
| 171 | } executed: }Execution Count:4 | 4 |
| 172 | | - |
| 173 | if (req) { evaluated: req| yes Evaluation Count:2779 | yes Evaluation Count:381 |
| 381-2779 |
| 174 | if (cache_enabled) partially evaluated: cache_enabled| yes Evaluation Count:2779 | no Evaluation Count:0 |
| 0-2779 |
| 175 | req &= (~QAbstractFileEngine::Refresh); executed: req &= (~QAbstractFileEngine::Refresh);Execution Count:2779 | 2779 |
| 176 | else | - |
| 177 | req |= QAbstractFileEngine::Refresh; never executed: req |= QAbstractFileEngine::Refresh; | 0 |
| 178 | | - |
| 179 | QAbstractFileEngine::FileFlags flags = fileEngine->fileFlags(req); executed (the execution status of this line is deduced): QAbstractFileEngine::FileFlags flags = fileEngine->fileFlags(req); | - |
| 180 | fileFlags |= uint(flags); executed (the execution status of this line is deduced): fileFlags |= uint(flags); | - |
| 181 | setCachedFlag(cachedFlags); executed (the execution status of this line is deduced): setCachedFlag(cachedFlags); | - |
| 182 | } executed: }Execution Count:2779 | 2779 |
| 183 | | - |
| 184 | return fileFlags & request; executed: return fileFlags & request;Execution Count:3160 | 3160 |
| 185 | } | - |
| 186 | | - |
| 187 | QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request) const | - |
| 188 | { | - |
| 189 | Q_ASSERT(fileEngine); // should never be called when using the native FS executed (the execution status of this line is deduced): qt_noop(); | - |
| 190 | if (!cache_enabled) partially evaluated: !cache_enabled| no Evaluation Count:0 | yes Evaluation Count:1658 |
| 0-1658 |
| 191 | clearFlags(); never executed: clearFlags(); | 0 |
| 192 | uint cf; executed (the execution status of this line is deduced): uint cf; | - |
| 193 | if (request == QAbstractFileEngine::CreationTime) partially evaluated: request == QAbstractFileEngine::CreationTime| no Evaluation Count:0 | yes Evaluation Count:1658 |
| 0-1658 |
| 194 | cf = CachedCTime; never executed: cf = CachedCTime; | 0 |
| 195 | else if (request == QAbstractFileEngine::ModificationTime) partially evaluated: request == QAbstractFileEngine::ModificationTime| yes Evaluation Count:1658 | no Evaluation Count:0 |
| 0-1658 |
| 196 | cf = CachedMTime; executed: cf = CachedMTime;Execution Count:1658 | 1658 |
| 197 | else | - |
| 198 | cf = CachedATime; never executed: cf = CachedATime; | 0 |
| 199 | if (!getCachedFlag(cf)) { partially evaluated: !getCachedFlag(cf)| yes Evaluation Count:1658 | no Evaluation Count:0 |
| 0-1658 |
| 200 | fileTimes[request] = fileEngine->fileTime(request); executed (the execution status of this line is deduced): fileTimes[request] = fileEngine->fileTime(request); | - |
| 201 | setCachedFlag(cf); executed (the execution status of this line is deduced): setCachedFlag(cf); | - |
| 202 | } executed: }Execution Count:1658 | 1658 |
| 203 | return fileTimes[request]; executed: return fileTimes[request];Execution Count:1658 | 1658 |
| 204 | } | - |
| 205 | | - |
| 206 | //************* QFileInfo | - |
| 207 | | - |
| 208 | /*! | - |
| 209 | \class QFileInfo | - |
| 210 | \inmodule QtCore | - |
| 211 | \reentrant | - |
| 212 | \brief The QFileInfo class provides system-independent file information. | - |
| 213 | | - |
| 214 | \ingroup io | - |
| 215 | \ingroup shared | - |
| 216 | | - |
| 217 | QFileInfo provides information about a file's name and position | - |
| 218 | (path) in the file system, its access rights and whether it is a | - |
| 219 | directory or symbolic link, etc. The file's size and last | - |
| 220 | modified/read times are also available. QFileInfo can also be | - |
| 221 | used to obtain information about a Qt \l{resource | - |
| 222 | system}{resource}. | - |
| 223 | | - |
| 224 | A QFileInfo can point to a file with either a relative or an | - |
| 225 | absolute file path. Absolute file paths begin with the directory | - |
| 226 | separator "/" (or with a drive specification on Windows). Relative | - |
| 227 | file names begin with a directory name or a file name and specify | - |
| 228 | a path relative to the current working directory. An example of an | - |
| 229 | absolute path is the string "/tmp/quartz". A relative path might | - |
| 230 | look like "src/fatlib". You can use the function isRelative() to | - |
| 231 | check whether a QFileInfo is using a relative or an absolute file | - |
| 232 | path. You can call the function makeAbsolute() to convert a | - |
| 233 | relative QFileInfo's path to an absolute path. | - |
| 234 | | - |
| 235 | The file that the QFileInfo works on is set in the constructor or | - |
| 236 | later with setFile(). Use exists() to see if the file exists and | - |
| 237 | size() to get its size. | - |
| 238 | | - |
| 239 | The file's type is obtained with isFile(), isDir() and | - |
| 240 | isSymLink(). The symLinkTarget() function provides the name of the file | - |
| 241 | the symlink points to. | - |
| 242 | | - |
| 243 | On Unix (including Mac OS X), the symlink has the same size() has | - |
| 244 | the file it points to, because Unix handles symlinks | - |
| 245 | transparently; similarly, opening a symlink using QFile | - |
| 246 | effectively opens the link's target. For example: | - |
| 247 | | - |
| 248 | \snippet code/src_corelib_io_qfileinfo.cpp 0 | - |
| 249 | | - |
| 250 | On Windows, symlinks (shortcuts) are \c .lnk files. The reported | - |
| 251 | size() is that of the symlink (not the link's target), and | - |
| 252 | opening a symlink using QFile opens the \c .lnk file. For | - |
| 253 | example: | - |
| 254 | | - |
| 255 | \snippet code/src_corelib_io_qfileinfo.cpp 1 | - |
| 256 | | - |
| 257 | Elements of the file's name can be extracted with path() and | - |
| 258 | fileName(). The fileName()'s parts can be extracted with | - |
| 259 | baseName(), suffix() or completeSuffix(). QFileInfo objects to | - |
| 260 | directories created by Qt classes will not have a trailing file | - |
| 261 | separator. If you wish to use trailing separators in your own file | - |
| 262 | info objects, just append one to the file name given to the constructors | - |
| 263 | or setFile(). | - |
| 264 | | - |
| 265 | The file's dates are returned by created(), lastModified() and | - |
| 266 | lastRead(). Information about the file's access permissions is | - |
| 267 | obtained with isReadable(), isWritable() and isExecutable(). The | - |
| 268 | file's ownership is available from owner(), ownerId(), group() and | - |
| 269 | groupId(). You can examine a file's permissions and ownership in a | - |
| 270 | single statement using the permission() function. | - |
| 271 | | - |
| 272 | \section1 Performance Issues | - |
| 273 | | - |
| 274 | Some of QFileInfo's functions query the file system, but for | - |
| 275 | performance reasons, some functions only operate on the | - |
| 276 | file name itself. For example: To return the absolute path of | - |
| 277 | a relative file name, absolutePath() has to query the file system. | - |
| 278 | The path() function, however, can work on the file name directly, | - |
| 279 | and so it is faster. | - |
| 280 | | - |
| 281 | \note To speed up performance, QFileInfo caches information about | - |
| 282 | the file. | - |
| 283 | | - |
| 284 | To speed up performance, QFileInfo caches information about the | - |
| 285 | file. Because files can be changed by other users or programs, or | - |
| 286 | even by other parts of the same program, there is a function that | - |
| 287 | refreshes the file information: refresh(). If you want to switch | - |
| 288 | off a QFileInfo's caching and force it to access the file system | - |
| 289 | every time you request information from it call setCaching(false). | - |
| 290 | | - |
| 291 | \sa QDir, QFile | - |
| 292 | */ | - |
| 293 | | - |
| 294 | /*! | - |
| 295 | \internal | - |
| 296 | */ | - |
| 297 | QFileInfo::QFileInfo(QFileInfoPrivate *p) : d_ptr(p) | - |
| 298 | { | - |
| 299 | } executed: }Execution Count:90608 | 90608 |
| 300 | | - |
| 301 | /*! | - |
| 302 | Constructs an empty QFileInfo object. | - |
| 303 | | - |
| 304 | Note that an empty QFileInfo object contain no file reference. | - |
| 305 | | - |
| 306 | \sa setFile() | - |
| 307 | */ | - |
| 308 | QFileInfo::QFileInfo() : d_ptr(new QFileInfoPrivate()) | - |
| 309 | { | - |
| 310 | } executed: }Execution Count:37406 | 37406 |
| 311 | | - |
| 312 | /*! | - |
| 313 | Constructs a new QFileInfo that gives information about the given | - |
| 314 | file. The \a file can also include an absolute or relative path. | - |
| 315 | | - |
| 316 | \sa setFile(), isRelative(), QDir::setCurrent(), QDir::isRelativePath() | - |
| 317 | */ | - |
| 318 | QFileInfo::QFileInfo(const QString &file) : d_ptr(new QFileInfoPrivate(file)) | - |
| 319 | { | - |
| 320 | } executed: }Execution Count:31703 | 31703 |
| 321 | | - |
| 322 | /*! | - |
| 323 | Constructs a new QFileInfo that gives information about file \a | - |
| 324 | file. | - |
| 325 | | - |
| 326 | If the \a file has a relative path, the QFileInfo will also have a | - |
| 327 | relative path. | - |
| 328 | | - |
| 329 | \sa isRelative() | - |
| 330 | */ | - |
| 331 | QFileInfo::QFileInfo(const QFile &file) : d_ptr(new QFileInfoPrivate(file.fileName())) | - |
| 332 | { | - |
| 333 | } executed: }Execution Count:155 | 155 |
| 334 | | - |
| 335 | /*! | - |
| 336 | Constructs a new QFileInfo that gives information about the given | - |
| 337 | \a file in the directory \a dir. | - |
| 338 | | - |
| 339 | If \a dir has a relative path, the QFileInfo will also have a | - |
| 340 | relative path. | - |
| 341 | | - |
| 342 | If \a file is an absolute path, then the directory specified | - |
| 343 | by \a dir will be disregarded. | - |
| 344 | | - |
| 345 | \sa isRelative() | - |
| 346 | */ | - |
| 347 | QFileInfo::QFileInfo(const QDir &dir, const QString &file) | - |
| 348 | : d_ptr(new QFileInfoPrivate(dir.filePath(file))) | - |
| 349 | { | - |
| 350 | } executed: }Execution Count:223 | 223 |
| 351 | | - |
| 352 | /*! | - |
| 353 | Constructs a new QFileInfo that is a copy of the given \a fileinfo. | - |
| 354 | */ | - |
| 355 | QFileInfo::QFileInfo(const QFileInfo &fileinfo) | - |
| 356 | : d_ptr(fileinfo.d_ptr) | - |
| 357 | { | - |
| 358 | | - |
| 359 | } executed: }Execution Count:354145 | 354145 |
| 360 | | - |
| 361 | /*! | - |
| 362 | Destroys the QFileInfo and frees its resources. | - |
| 363 | */ | - |
| 364 | | - |
| 365 | QFileInfo::~QFileInfo() | - |
| 366 | { | - |
| 367 | } | - |
| 368 | | - |
| 369 | /*! | - |
| 370 | \fn bool QFileInfo::operator!=(const QFileInfo &fileinfo) const | - |
| 371 | | - |
| 372 | Returns true if this QFileInfo object refers to a different file | - |
| 373 | than the one specified by \a fileinfo; otherwise returns false. | - |
| 374 | | - |
| 375 | \sa operator==() | - |
| 376 | */ | - |
| 377 | | - |
| 378 | /*! | - |
| 379 | Returns true if this QFileInfo object refers to a file in the same | - |
| 380 | location as \a fileinfo; otherwise returns false. | - |
| 381 | | - |
| 382 | Note that the result of comparing two empty QFileInfo objects, | - |
| 383 | containing no file references (file paths that do not exist or | - |
| 384 | are empty), is undefined. | - |
| 385 | | - |
| 386 | \warning This will not compare two different symbolic links | - |
| 387 | pointing to the same file. | - |
| 388 | | - |
| 389 | \warning Long and short file names that refer to the same file on Windows | - |
| 390 | are treated as if they referred to different files. | - |
| 391 | | - |
| 392 | \sa operator!=() | - |
| 393 | */ | - |
| 394 | bool QFileInfo::operator==(const QFileInfo &fileinfo) const | - |
| 395 | { | - |
| 396 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 397 | // ### Qt 5: understand long and short file names on Windows | - |
| 398 | // ### (GetFullPathName()). | - |
| 399 | if (fileinfo.d_ptr == d_ptr) evaluated: fileinfo.d_ptr == d_ptr| yes Evaluation Count:21930 | yes Evaluation Count:4078 |
| 4078-21930 |
| 400 | return true; executed: return true;Execution Count:21930 | 21930 |
| 401 | if (d->isDefaultConstructed || fileinfo.d_ptr->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:4078 |
partially evaluated: fileinfo.d_ptr->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:4078 |
| 0-4078 |
| 402 | return false; never executed: return false; | 0 |
| 403 | | - |
| 404 | // Assume files are the same if path is the same | - |
| 405 | if (d->fileEntry.filePath() == fileinfo.d_ptr->fileEntry.filePath()) evaluated: d->fileEntry.filePath() == fileinfo.d_ptr->fileEntry.filePath()| yes Evaluation Count:4044 | yes Evaluation Count:34 |
| 34-4044 |
| 406 | return true; executed: return true;Execution Count:4044 | 4044 |
| 407 | | - |
| 408 | Qt::CaseSensitivity sensitive; executed (the execution status of this line is deduced): Qt::CaseSensitivity sensitive; | - |
| 409 | if (d->fileEngine == 0 || fileinfo.d_ptr->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:34 | no Evaluation Count:0 |
never evaluated: fileinfo.d_ptr->fileEngine == 0 | 0-34 |
| 410 | if (d->fileEngine != fileinfo.d_ptr->fileEngine) // one is native, the other is a custom file-engine partially evaluated: d->fileEngine != fileinfo.d_ptr->fileEngine| no Evaluation Count:0 | yes Evaluation Count:34 |
| 0-34 |
| 411 | return false; never executed: return false; | 0 |
| 412 | | - |
| 413 | sensitive = QFileSystemEngine::isCaseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive; partially evaluated: QFileSystemEngine::isCaseSensitive()| yes Evaluation Count:34 | no Evaluation Count:0 |
| 0-34 |
| 414 | } else { executed: }Execution Count:34 | 34 |
| 415 | if (d->fileEngine->caseSensitive() != fileinfo.d_ptr->fileEngine->caseSensitive()) never evaluated: d->fileEngine->caseSensitive() != fileinfo.d_ptr->fileEngine->caseSensitive() | 0 |
| 416 | return false; never executed: return false; | 0 |
| 417 | sensitive = d->fileEngine->caseSensitive() ? Qt::CaseSensitive : Qt::CaseInsensitive; never evaluated: d->fileEngine->caseSensitive() | 0 |
| 418 | } | 0 |
| 419 | | - |
| 420 | // Fallback to expensive canonical path computation | - |
| 421 | return canonicalFilePath().compare(fileinfo.canonicalFilePath(), sensitive) == 0; executed: return canonicalFilePath().compare(fileinfo.canonicalFilePath(), sensitive) == 0;Execution Count:34 | 34 |
| 422 | } | - |
| 423 | | - |
| 424 | /*! | - |
| 425 | Makes a copy of the given \a fileinfo and assigns it to this QFileInfo. | - |
| 426 | */ | - |
| 427 | QFileInfo &QFileInfo::operator=(const QFileInfo &fileinfo) | - |
| 428 | { | - |
| 429 | d_ptr = fileinfo.d_ptr; executed (the execution status of this line is deduced): d_ptr = fileinfo.d_ptr; | - |
| 430 | return *this; executed: return *this;Execution Count:284679 | 284679 |
| 431 | } | - |
| 432 | | - |
| 433 | /*! | - |
| 434 | \fn void QFileInfo::swap(QFileInfo &other) | - |
| 435 | \since 5.0 | - |
| 436 | | - |
| 437 | Swaps this file info with \a other. This function is very fast and | - |
| 438 | never fails. | - |
| 439 | */ | - |
| 440 | | - |
| 441 | /*! | - |
| 442 | Sets the file that the QFileInfo provides information about to \a | - |
| 443 | file. | - |
| 444 | | - |
| 445 | The \a file can also include an absolute or relative file path. | - |
| 446 | Absolute paths begin with the directory separator (e.g. "/" under | - |
| 447 | Unix) or a drive specification (under Windows). Relative file | - |
| 448 | names begin with a directory name or a file name and specify a | - |
| 449 | path relative to the current directory. | - |
| 450 | | - |
| 451 | Example: | - |
| 452 | \snippet code/src_corelib_io_qfileinfo.cpp 2 | - |
| 453 | | - |
| 454 | \sa isRelative(), QDir::setCurrent(), QDir::isRelativePath() | - |
| 455 | */ | - |
| 456 | void QFileInfo::setFile(const QString &file) | - |
| 457 | { | - |
| 458 | bool caching = d_ptr.constData()->cache_enabled; executed (the execution status of this line is deduced): bool caching = d_ptr.constData()->cache_enabled; | - |
| 459 | *this = QFileInfo(file); executed (the execution status of this line is deduced): *this = QFileInfo(file); | - |
| 460 | d_ptr->cache_enabled = caching; executed (the execution status of this line is deduced): d_ptr->cache_enabled = caching; | - |
| 461 | } executed: }Execution Count:321 | 321 |
| 462 | | - |
| 463 | /*! | - |
| 464 | \overload | - |
| 465 | | - |
| 466 | Sets the file that the QFileInfo provides information about to \a | - |
| 467 | file. | - |
| 468 | | - |
| 469 | If \a file includes a relative path, the QFileInfo will also have | - |
| 470 | a relative path. | - |
| 471 | | - |
| 472 | \sa isRelative() | - |
| 473 | */ | - |
| 474 | void QFileInfo::setFile(const QFile &file) | - |
| 475 | { | - |
| 476 | setFile(file.fileName()); never executed (the execution status of this line is deduced): setFile(file.fileName()); | - |
| 477 | } | 0 |
| 478 | | - |
| 479 | /*! | - |
| 480 | \overload | - |
| 481 | | - |
| 482 | Sets the file that the QFileInfo provides information about to \a | - |
| 483 | file in directory \a dir. | - |
| 484 | | - |
| 485 | If \a file includes a relative path, the QFileInfo will also | - |
| 486 | have a relative path. | - |
| 487 | | - |
| 488 | \sa isRelative() | - |
| 489 | */ | - |
| 490 | void QFileInfo::setFile(const QDir &dir, const QString &file) | - |
| 491 | { | - |
| 492 | setFile(dir.filePath(file)); never executed (the execution status of this line is deduced): setFile(dir.filePath(file)); | - |
| 493 | } | 0 |
| 494 | | - |
| 495 | /*! | - |
| 496 | Returns an absolute path including the file name. | - |
| 497 | | - |
| 498 | The absolute path name consists of the full path and the file | - |
| 499 | name. On Unix this will always begin with the root, '/', | - |
| 500 | directory. On Windows this will always begin 'D:/' where D is a | - |
| 501 | drive letter, except for network shares that are not mapped to a | - |
| 502 | drive letter, in which case the path will begin '//sharename/'. | - |
| 503 | QFileInfo will uppercase drive letters. Note that QDir does not do | - |
| 504 | this. The code snippet below shows this. | - |
| 505 | | - |
| 506 | \snippet code/src_corelib_io_qfileinfo.cpp newstuff | - |
| 507 | | - |
| 508 | This function returns the same as filePath(), unless isRelative() | - |
| 509 | is true. In contrast to canonicalFilePath(), symbolic links or | - |
| 510 | redundant "." or ".." elements are not necessarily removed. | - |
| 511 | | - |
| 512 | If the QFileInfo is empty it returns QDir::currentPath(). | - |
| 513 | | - |
| 514 | \sa filePath(), canonicalFilePath(), isRelative() | - |
| 515 | */ | - |
| 516 | QString QFileInfo::absoluteFilePath() const | - |
| 517 | { | - |
| 518 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 519 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:9581 |
| 0-9581 |
| 520 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 521 | return d->getFileName(QAbstractFileEngine::AbsoluteName); executed: return d->getFileName(QAbstractFileEngine::AbsoluteName);Execution Count:9581 | 9581 |
| 522 | } | - |
| 523 | | - |
| 524 | /*! | - |
| 525 | Returns the canonical path including the file name, i.e. an absolute | - |
| 526 | path without symbolic links or redundant "." or ".." elements. | - |
| 527 | | - |
| 528 | If the file does not exist, canonicalFilePath() returns an empty | - |
| 529 | string. | - |
| 530 | | - |
| 531 | \sa filePath(), absoluteFilePath(), dir() | - |
| 532 | */ | - |
| 533 | QString QFileInfo::canonicalFilePath() const | - |
| 534 | { | - |
| 535 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 536 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:1764 |
| 0-1764 |
| 537 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 538 | return d->getFileName(QAbstractFileEngine::CanonicalName); executed: return d->getFileName(QAbstractFileEngine::CanonicalName);Execution Count:1764 | 1764 |
| 539 | } | - |
| 540 | | - |
| 541 | | - |
| 542 | /*! | - |
| 543 | Returns a file's path absolute path. This doesn't include the | - |
| 544 | file name. | - |
| 545 | | - |
| 546 | On Unix the absolute path will always begin with the root, '/', | - |
| 547 | directory. On Windows this will always begin 'D:/' where D is a | - |
| 548 | drive letter, except for network shares that are not mapped to a | - |
| 549 | drive letter, in which case the path will begin '//sharename/'. | - |
| 550 | | - |
| 551 | In contrast to canonicalPath() symbolic links or redundant "." or | - |
| 552 | ".." elements are not necessarily removed. | - |
| 553 | | - |
| 554 | \warning If the QFileInfo object was created with an empty QString, | - |
| 555 | the behavior of this function is undefined. | - |
| 556 | | - |
| 557 | \sa absoluteFilePath(), path(), canonicalPath(), fileName(), isRelative() | - |
| 558 | */ | - |
| 559 | QString QFileInfo::absolutePath() const | - |
| 560 | { | - |
| 561 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 562 | | - |
| 563 | if (d->isDefaultConstructed) { partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:452 |
| 0-452 |
| 564 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 565 | } else if (d->fileEntry.isEmpty()) { partially evaluated: d->fileEntry.isEmpty()| no Evaluation Count:0 | yes Evaluation Count:452 |
| 0-452 |
| 566 | qWarning("QFileInfo::absolutePath: Constructed with empty filename"); never executed (the execution status of this line is deduced): QMessageLogger("io/qfileinfo.cpp", 566, __PRETTY_FUNCTION__).warning("QFileInfo::absolutePath: Constructed with empty filename"); | - |
| 567 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 568 | } | - |
| 569 | return d->getFileName(QAbstractFileEngine::AbsolutePathName); executed: return d->getFileName(QAbstractFileEngine::AbsolutePathName);Execution Count:452 | 452 |
| 570 | } | - |
| 571 | | - |
| 572 | /*! | - |
| 573 | Returns the file's path canonical path (excluding the file name), | - |
| 574 | i.e. an absolute path without symbolic links or redundant "." or ".." elements. | - |
| 575 | | - |
| 576 | If the file does not exist, canonicalPath() returns an empty string. | - |
| 577 | | - |
| 578 | \sa path(), absolutePath() | - |
| 579 | */ | - |
| 580 | QString QFileInfo::canonicalPath() const | - |
| 581 | { | - |
| 582 | Q_D(const QFileInfo); never executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 583 | if (d->isDefaultConstructed) never evaluated: d->isDefaultConstructed | 0 |
| 584 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 585 | return d->getFileName(QAbstractFileEngine::CanonicalPathName); never executed: return d->getFileName(QAbstractFileEngine::CanonicalPathName); | 0 |
| 586 | } | - |
| 587 | | - |
| 588 | /*! | - |
| 589 | Returns the file's path. This doesn't include the file name. | - |
| 590 | | - |
| 591 | Note that, if this QFileInfo object is given a path ending in a | - |
| 592 | slash, the name of the file is considered empty and this function | - |
| 593 | will return the entire path. | - |
| 594 | | - |
| 595 | \sa filePath(), absolutePath(), canonicalPath(), dir(), fileName(), isRelative() | - |
| 596 | */ | - |
| 597 | QString QFileInfo::path() const | - |
| 598 | { | - |
| 599 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 600 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:246 |
| 0-246 |
| 601 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 602 | return d->fileEntry.path(); executed: return d->fileEntry.path();Execution Count:246 | 246 |
| 603 | } | - |
| 604 | | - |
| 605 | /*! | - |
| 606 | \fn bool QFileInfo::isAbsolute() const | - |
| 607 | | - |
| 608 | Returns true if the file path name is absolute, otherwise returns | - |
| 609 | false if the path is relative. | - |
| 610 | | - |
| 611 | \sa isRelative() | - |
| 612 | */ | - |
| 613 | | - |
| 614 | /*! | - |
| 615 | Returns true if the file path name is relative, otherwise returns | - |
| 616 | false if the path is absolute (e.g. under Unix a path is absolute | - |
| 617 | if it begins with a "/"). | - |
| 618 | | - |
| 619 | \sa isAbsolute() | - |
| 620 | */ | - |
| 621 | bool QFileInfo::isRelative() const | - |
| 622 | { | - |
| 623 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 624 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:8198 |
| 0-8198 |
| 625 | return true; never executed: return true; | 0 |
| 626 | if (d->fileEngine == 0) evaluated: d->fileEngine == 0| yes Evaluation Count:8186 | yes Evaluation Count:12 |
| 12-8186 |
| 627 | return d->fileEntry.isRelative(); executed: return d->fileEntry.isRelative();Execution Count:8186 | 8186 |
| 628 | return d->fileEngine->isRelativePath(); executed: return d->fileEngine->isRelativePath();Execution Count:12 | 12 |
| 629 | } | - |
| 630 | | - |
| 631 | /*! | - |
| 632 | Converts the file's path to an absolute path if it is not already in that form. | - |
| 633 | Returns true to indicate that the path was converted; otherwise returns false | - |
| 634 | to indicate that the path was already absolute. | - |
| 635 | | - |
| 636 | \sa filePath(), isRelative() | - |
| 637 | */ | - |
| 638 | bool QFileInfo::makeAbsolute() | - |
| 639 | { | - |
| 640 | if (d_ptr.constData()->isDefaultConstructed never evaluated: d_ptr.constData()->isDefaultConstructed | 0 |
| 641 | || !d_ptr.constData()->fileEntry.isRelative()) never evaluated: !d_ptr.constData()->fileEntry.isRelative() | 0 |
| 642 | return false; never executed: return false; | 0 |
| 643 | | - |
| 644 | setFile(absoluteFilePath()); never executed (the execution status of this line is deduced): setFile(absoluteFilePath()); | - |
| 645 | return true; never executed: return true; | 0 |
| 646 | } | - |
| 647 | | - |
| 648 | /*! | - |
| 649 | Returns true if the file exists; otherwise returns false. | - |
| 650 | | - |
| 651 | \note If the file is a symlink that points to a non existing | - |
| 652 | file, false is returned. | - |
| 653 | */ | - |
| 654 | bool QFileInfo::exists() const | - |
| 655 | { | - |
| 656 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 657 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:149183 |
| 0-149183 |
| 658 | return false; never executed: return false; | 0 |
| 659 | if (d->fileEngine == 0) { evaluated: d->fileEngine == 0| yes Evaluation Count:146419 | yes Evaluation Count:2764 |
| 2764-146419 |
| 660 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::ExistsAttribute)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:146419 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::ExistsAttribute)| yes Evaluation Count:6321 | yes Evaluation Count:140098 |
| 0-146419 |
| 661 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::ExistsAttribute); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::ExistsAttribute);Execution Count:6321 | 6321 |
| 662 | return d->metaData.exists(); executed: return d->metaData.exists();Execution Count:146419 | 146419 |
| 663 | } | - |
| 664 | return d->getFileFlags(QAbstractFileEngine::ExistsFlag); executed: return d->getFileFlags(QAbstractFileEngine::ExistsFlag);Execution Count:2764 | 2764 |
| 665 | } | - |
| 666 | | - |
| 667 | /*! | - |
| 668 | Refreshes the information about the file, i.e. reads in information | - |
| 669 | from the file system the next time a cached property is fetched. | - |
| 670 | | - |
| 671 | \note On Windows CE, there might be a delay for the file system driver | - |
| 672 | to detect changes on the file. | - |
| 673 | */ | - |
| 674 | void QFileInfo::refresh() | - |
| 675 | { | - |
| 676 | Q_D(QFileInfo); executed (the execution status of this line is deduced): QFileInfoPrivate * const d = d_func(); | - |
| 677 | d->clear(); executed (the execution status of this line is deduced): d->clear(); | - |
| 678 | } executed: }Execution Count:4 | 4 |
| 679 | | - |
| 680 | /*! | - |
| 681 | Returns the file name, including the path (which may be absolute | - |
| 682 | or relative). | - |
| 683 | | - |
| 684 | \sa absoluteFilePath(), canonicalFilePath(), isRelative() | - |
| 685 | */ | - |
| 686 | QString QFileInfo::filePath() const | - |
| 687 | { | - |
| 688 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 689 | if (d->isDefaultConstructed) evaluated: d->isDefaultConstructed| yes Evaluation Count:16 | yes Evaluation Count:82109 |
| 16-82109 |
| 690 | return QLatin1String(""); executed: return QLatin1String("");Execution Count:16 | 16 |
| 691 | return d->fileEntry.filePath(); executed: return d->fileEntry.filePath();Execution Count:82109 | 82109 |
| 692 | } | - |
| 693 | | - |
| 694 | /*! | - |
| 695 | Returns the name of the file, excluding the path. | - |
| 696 | | - |
| 697 | Example: | - |
| 698 | \snippet code/src_corelib_io_qfileinfo.cpp 3 | - |
| 699 | | - |
| 700 | Note that, if this QFileInfo object is given a path ending in a | - |
| 701 | slash, the name of the file is considered empty. | - |
| 702 | | - |
| 703 | \sa isRelative(), filePath(), baseName(), suffix() | - |
| 704 | */ | - |
| 705 | QString QFileInfo::fileName() const | - |
| 706 | { | - |
| 707 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 708 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:134901 |
| 0-134901 |
| 709 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 710 | return d->fileEntry.fileName(); executed: return d->fileEntry.fileName();Execution Count:134900 | 134900 |
| 711 | } | - |
| 712 | | - |
| 713 | /*! | - |
| 714 | \since 4.3 | - |
| 715 | Returns the name of the bundle. | - |
| 716 | | - |
| 717 | On Mac OS X this returns the proper localized name for a bundle if the | - |
| 718 | path isBundle(). On all other platforms an empty QString is returned. | - |
| 719 | | - |
| 720 | Example: | - |
| 721 | \snippet code/src_corelib_io_qfileinfo.cpp 4 | - |
| 722 | | - |
| 723 | \sa isBundle(), filePath(), baseName(), suffix() | - |
| 724 | */ | - |
| 725 | QString QFileInfo::bundleName() const | - |
| 726 | { | - |
| 727 | Q_D(const QFileInfo); never executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 728 | if (d->isDefaultConstructed) never evaluated: d->isDefaultConstructed | 0 |
| 729 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 730 | return d->getFileName(QAbstractFileEngine::BundleName); never executed: return d->getFileName(QAbstractFileEngine::BundleName); | 0 |
| 731 | } | - |
| 732 | | - |
| 733 | /*! | - |
| 734 | Returns the base name of the file without the path. | - |
| 735 | | - |
| 736 | The base name consists of all characters in the file up to (but | - |
| 737 | not including) the \e first '.' character. | - |
| 738 | | - |
| 739 | Example: | - |
| 740 | \snippet code/src_corelib_io_qfileinfo.cpp 5 | - |
| 741 | | - |
| 742 | | - |
| 743 | The base name of a file is computed equally on all platforms, independent | - |
| 744 | of file naming conventions (e.g., ".bashrc" on Unix has an empty base | - |
| 745 | name, and the suffix is "bashrc"). | - |
| 746 | | - |
| 747 | \sa fileName(), suffix(), completeSuffix(), completeBaseName() | - |
| 748 | */ | - |
| 749 | QString QFileInfo::baseName() const | - |
| 750 | { | - |
| 751 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 752 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:1956 |
| 0-1956 |
| 753 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 754 | return d->fileEntry.baseName(); executed: return d->fileEntry.baseName();Execution Count:1956 | 1956 |
| 755 | } | - |
| 756 | | - |
| 757 | /*! | - |
| 758 | Returns the complete base name of the file without the path. | - |
| 759 | | - |
| 760 | The complete base name consists of all characters in the file up | - |
| 761 | to (but not including) the \e last '.' character. | - |
| 762 | | - |
| 763 | Example: | - |
| 764 | \snippet code/src_corelib_io_qfileinfo.cpp 6 | - |
| 765 | | - |
| 766 | \sa fileName(), suffix(), completeSuffix(), baseName() | - |
| 767 | */ | - |
| 768 | QString QFileInfo::completeBaseName() const | - |
| 769 | { | - |
| 770 | Q_D(const QFileInfo); never executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 771 | if (d->isDefaultConstructed) never evaluated: d->isDefaultConstructed | 0 |
| 772 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 773 | return d->fileEntry.completeBaseName(); never executed: return d->fileEntry.completeBaseName(); | 0 |
| 774 | } | - |
| 775 | | - |
| 776 | /*! | - |
| 777 | Returns the complete suffix of the file. | - |
| 778 | | - |
| 779 | The complete suffix consists of all characters in the file after | - |
| 780 | (but not including) the first '.'. | - |
| 781 | | - |
| 782 | Example: | - |
| 783 | \snippet code/src_corelib_io_qfileinfo.cpp 7 | - |
| 784 | | - |
| 785 | \sa fileName(), suffix(), baseName(), completeBaseName() | - |
| 786 | */ | - |
| 787 | QString QFileInfo::completeSuffix() const | - |
| 788 | { | - |
| 789 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 790 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:1727 |
| 0-1727 |
| 791 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 792 | return d->fileEntry.completeSuffix(); executed: return d->fileEntry.completeSuffix();Execution Count:1727 | 1727 |
| 793 | } | - |
| 794 | | - |
| 795 | /*! | - |
| 796 | Returns the suffix of the file. | - |
| 797 | | - |
| 798 | The suffix consists of all characters in the file after (but not | - |
| 799 | including) the last '.'. | - |
| 800 | | - |
| 801 | Example: | - |
| 802 | \snippet code/src_corelib_io_qfileinfo.cpp 8 | - |
| 803 | | - |
| 804 | The suffix of a file is computed equally on all platforms, independent of | - |
| 805 | file naming conventions (e.g., ".bashrc" on Unix has an empty base name, | - |
| 806 | and the suffix is "bashrc"). | - |
| 807 | | - |
| 808 | \sa fileName(), completeSuffix(), baseName(), completeBaseName() | - |
| 809 | */ | - |
| 810 | QString QFileInfo::suffix() const | - |
| 811 | { | - |
| 812 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 813 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:42829 |
| 0-42829 |
| 814 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 815 | return d->fileEntry.suffix(); executed: return d->fileEntry.suffix();Execution Count:42829 | 42829 |
| 816 | } | - |
| 817 | | - |
| 818 | | - |
| 819 | /*! | - |
| 820 | Returns the path of the object's parent directory as a QDir object. | - |
| 821 | | - |
| 822 | \b{Note:} The QDir returned always corresponds to the object's | - |
| 823 | parent directory, even if the QFileInfo represents a directory. | - |
| 824 | | - |
| 825 | For each of the following, dir() returns a QDir for | - |
| 826 | \c{"~/examples/191697"}. | - |
| 827 | | - |
| 828 | \snippet fileinfo/main.cpp 0 | - |
| 829 | | - |
| 830 | For each of the following, dir() returns a QDir for | - |
| 831 | \c{"."}. | - |
| 832 | | - |
| 833 | \snippet fileinfo/main.cpp 1 | - |
| 834 | | - |
| 835 | \sa absolutePath(), filePath(), fileName(), isRelative(), absoluteDir() | - |
| 836 | */ | - |
| 837 | QDir QFileInfo::dir() const | - |
| 838 | { | - |
| 839 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 840 | // ### Qt 6: Maybe rename this to parentDirectory(), considering what it actually does? | - |
| 841 | return QDir(d->fileEntry.path()); executed: return QDir(d->fileEntry.path());Execution Count:10 | 10 |
| 842 | } | - |
| 843 | | - |
| 844 | /*! | - |
| 845 | Returns the file's absolute path as a QDir object. | - |
| 846 | | - |
| 847 | \sa dir(), filePath(), fileName(), isRelative() | - |
| 848 | */ | - |
| 849 | QDir QFileInfo::absoluteDir() const | - |
| 850 | { | - |
| 851 | return QDir(absolutePath()); executed: return QDir(absolutePath());Execution Count:37 | 37 |
| 852 | } | - |
| 853 | | - |
| 854 | /*! | - |
| 855 | Returns true if the user can read the file; otherwise returns false. | - |
| 856 | | - |
| 857 | \sa isWritable(), isExecutable(), permission() | - |
| 858 | */ | - |
| 859 | bool QFileInfo::isReadable() const | - |
| 860 | { | - |
| 861 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 862 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:107 |
| 0-107 |
| 863 | return false; never executed: return false; | 0 |
| 864 | if (d->fileEngine == 0) { evaluated: d->fileEngine == 0| yes Evaluation Count:103 | yes Evaluation Count:4 |
| 4-103 |
| 865 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:103 |
partially evaluated: !d->metaData.hasFlags(QFileSystemMetaData::UserReadPermission)| yes Evaluation Count:103 | no Evaluation Count:0 |
| 0-103 |
| 866 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::UserReadPermission); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::UserReadPermission);Execution Count:103 | 103 |
| 867 | return (d->metaData.permissions() & QFile::ReadUser) != 0; executed: return (d->metaData.permissions() & QFile::ReadUser) != 0;Execution Count:103 | 103 |
| 868 | } | - |
| 869 | return d->getFileFlags(QAbstractFileEngine::ReadUserPerm); executed: return d->getFileFlags(QAbstractFileEngine::ReadUserPerm);Execution Count:4 | 4 |
| 870 | } | - |
| 871 | | - |
| 872 | /*! | - |
| 873 | Returns true if the user can write to the file; otherwise returns false. | - |
| 874 | | - |
| 875 | \sa isReadable(), isExecutable(), permission() | - |
| 876 | */ | - |
| 877 | bool QFileInfo::isWritable() const | - |
| 878 | { | - |
| 879 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 880 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 881 | return false; never executed: return false; | 0 |
| 882 | if (d->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 883 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::UserWritePermission)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:7 |
partially evaluated: !d->metaData.hasFlags(QFileSystemMetaData::UserWritePermission)| yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
| 884 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::UserWritePermission); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::UserWritePermission);Execution Count:7 | 7 |
| 885 | return (d->metaData.permissions() & QFile::WriteUser) != 0; executed: return (d->metaData.permissions() & QFile::WriteUser) != 0;Execution Count:7 | 7 |
| 886 | } | - |
| 887 | return d->getFileFlags(QAbstractFileEngine::WriteUserPerm); never executed: return d->getFileFlags(QAbstractFileEngine::WriteUserPerm); | 0 |
| 888 | } | - |
| 889 | | - |
| 890 | /*! | - |
| 891 | Returns true if the file is executable; otherwise returns false. | - |
| 892 | | - |
| 893 | \sa isReadable(), isWritable(), permission() | - |
| 894 | */ | - |
| 895 | bool QFileInfo::isExecutable() const | - |
| 896 | { | - |
| 897 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 898 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
| 899 | return false; never executed: return false; | 0 |
| 900 | if (d->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
| 901 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::UserExecutePermission)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:12 |
partially evaluated: !d->metaData.hasFlags(QFileSystemMetaData::UserExecutePermission)| yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
| 902 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::UserExecutePermission); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::UserExecutePermission);Execution Count:12 | 12 |
| 903 | return (d->metaData.permissions() & QFile::ExeUser) != 0; executed: return (d->metaData.permissions() & QFile::ExeUser) != 0;Execution Count:12 | 12 |
| 904 | } | - |
| 905 | return d->getFileFlags(QAbstractFileEngine::ExeUserPerm); never executed: return d->getFileFlags(QAbstractFileEngine::ExeUserPerm); | 0 |
| 906 | } | - |
| 907 | | - |
| 908 | /*! | - |
| 909 | Returns true if this is a `hidden' file; otherwise returns false. | - |
| 910 | | - |
| 911 | \b{Note:} This function returns true for the special entries | - |
| 912 | "." and ".." on Unix, even though QDir::entryList threats them as shown. | - |
| 913 | */ | - |
| 914 | bool QFileInfo::isHidden() const | - |
| 915 | { | - |
| 916 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 917 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:55441 |
| 0-55441 |
| 918 | return false; never executed: return false; | 0 |
| 919 | if (d->fileEngine == 0) { evaluated: d->fileEngine == 0| yes Evaluation Count:55257 | yes Evaluation Count:184 |
| 184-55257 |
| 920 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::HiddenAttribute)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:55257 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::HiddenAttribute)| yes Evaluation Count:38354 | yes Evaluation Count:16903 |
| 0-55257 |
| 921 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::HiddenAttribute); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::HiddenAttribute);Execution Count:38354 | 38354 |
| 922 | return d->metaData.isHidden(); executed: return d->metaData.isHidden();Execution Count:55257 | 55257 |
| 923 | } | - |
| 924 | return d->getFileFlags(QAbstractFileEngine::HiddenFlag); executed: return d->getFileFlags(QAbstractFileEngine::HiddenFlag);Execution Count:184 | 184 |
| 925 | } | - |
| 926 | | - |
| 927 | /*! | - |
| 928 | \since 5.0 | - |
| 929 | Returns true if the file path can be used directly with native APIs. | - |
| 930 | Returns false if the file is otherwise supported by a virtual file system | - |
| 931 | inside Qt, such as \l{the Qt Resource System}. | - |
| 932 | | - |
| 933 | \b{Note:} Native paths may still require conversion of path separators | - |
| 934 | and character encoding, depending on platform and input requirements of the | - |
| 935 | native API. | - |
| 936 | | - |
| 937 | \sa QDir::toNativeSeparators(), QFile::encodeName(), filePath(), | - |
| 938 | absoluteFilePath(), canonicalFilePath() | - |
| 939 | */ | - |
| 940 | bool QFileInfo::isNativePath() const | - |
| 941 | { | - |
| 942 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 943 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:658 |
| 0-658 |
| 944 | return false; never executed: return false; | 0 |
| 945 | if (d->fileEngine == 0) evaluated: d->fileEngine == 0| yes Evaluation Count:656 | yes Evaluation Count:2 |
| 2-656 |
| 946 | return true; executed: return true;Execution Count:656 | 656 |
| 947 | return d->getFileFlags(QAbstractFileEngine::LocalDiskFlag); executed: return d->getFileFlags(QAbstractFileEngine::LocalDiskFlag);Execution Count:2 | 2 |
| 948 | } | - |
| 949 | | - |
| 950 | /*! | - |
| 951 | Returns true if this object points to a file or to a symbolic | - |
| 952 | link to a file. Returns false if the | - |
| 953 | object points to something which isn't a file, such as a directory. | - |
| 954 | | - |
| 955 | \sa isDir(), isSymLink(), isBundle() | - |
| 956 | */ | - |
| 957 | bool QFileInfo::isFile() const | - |
| 958 | { | - |
| 959 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 960 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:947531 |
| 0-947531 |
| 961 | return false; never executed: return false; | 0 |
| 962 | if (d->fileEngine == 0) { evaluated: d->fileEngine == 0| yes Evaluation Count:947348 | yes Evaluation Count:183 |
| 183-947348 |
| 963 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::FileType)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:947348 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::FileType)| yes Evaluation Count:2030 | yes Evaluation Count:945318 |
| 0-947348 |
| 964 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::FileType); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::FileType);Execution Count:2030 | 2030 |
| 965 | return d->metaData.isFile(); executed: return d->metaData.isFile();Execution Count:947348 | 947348 |
| 966 | } | - |
| 967 | return d->getFileFlags(QAbstractFileEngine::FileType); executed: return d->getFileFlags(QAbstractFileEngine::FileType);Execution Count:183 | 183 |
| 968 | } | - |
| 969 | | - |
| 970 | /*! | - |
| 971 | Returns true if this object points to a directory or to a symbolic | - |
| 972 | link to a directory; otherwise returns false. | - |
| 973 | | - |
| 974 | \sa isFile(), isSymLink(), isBundle() | - |
| 975 | */ | - |
| 976 | bool QFileInfo::isDir() const | - |
| 977 | { | - |
| 978 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 979 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:974545 |
| 0-974545 |
| 980 | return false; never executed: return false; | 0 |
| 981 | if (d->fileEngine == 0) { evaluated: d->fileEngine == 0| yes Evaluation Count:974526 | yes Evaluation Count:19 |
| 19-974526 |
| 982 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::DirectoryType)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:974526 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::DirectoryType)| yes Evaluation Count:1198 | yes Evaluation Count:973328 |
| 0-974526 |
| 983 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::DirectoryType); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::DirectoryType);Execution Count:1198 | 1198 |
| 984 | return d->metaData.isDirectory(); executed: return d->metaData.isDirectory();Execution Count:974526 | 974526 |
| 985 | } | - |
| 986 | return d->getFileFlags(QAbstractFileEngine::DirectoryType); executed: return d->getFileFlags(QAbstractFileEngine::DirectoryType);Execution Count:19 | 19 |
| 987 | } | - |
| 988 | | - |
| 989 | | - |
| 990 | /*! | - |
| 991 | \since 4.3 | - |
| 992 | Returns true if this object points to a bundle or to a symbolic | - |
| 993 | link to a bundle on Mac OS X; otherwise returns false. | - |
| 994 | | - |
| 995 | \sa isDir(), isSymLink(), isFile() | - |
| 996 | */ | - |
| 997 | bool QFileInfo::isBundle() const | - |
| 998 | { | - |
| 999 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1000 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:122 |
| 0-122 |
| 1001 | return false; never executed: return false; | 0 |
| 1002 | if (d->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:122 | no Evaluation Count:0 |
| 0-122 |
| 1003 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::BundleType)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:122 |
partially evaluated: !d->metaData.hasFlags(QFileSystemMetaData::BundleType)| no Evaluation Count:0 | yes Evaluation Count:122 |
| 0-122 |
| 1004 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::BundleType); never executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::BundleType); | 0 |
| 1005 | return d->metaData.isBundle(); executed: return d->metaData.isBundle();Execution Count:122 | 122 |
| 1006 | } | - |
| 1007 | return d->getFileFlags(QAbstractFileEngine::BundleType); never executed: return d->getFileFlags(QAbstractFileEngine::BundleType); | 0 |
| 1008 | } | - |
| 1009 | | - |
| 1010 | /*! | - |
| 1011 | Returns true if this object points to a symbolic link (or to a | - |
| 1012 | shortcut on Windows); otherwise returns false. | - |
| 1013 | | - |
| 1014 | On Unix (including Mac OS X), opening a symlink effectively opens | - |
| 1015 | the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c | - |
| 1016 | .lnk file itself. | - |
| 1017 | | - |
| 1018 | Example: | - |
| 1019 | | - |
| 1020 | \snippet code/src_corelib_io_qfileinfo.cpp 9 | - |
| 1021 | | - |
| 1022 | \note If the symlink points to a non existing file, exists() returns | - |
| 1023 | false. | - |
| 1024 | | - |
| 1025 | \sa isFile(), isDir(), symLinkTarget() | - |
| 1026 | */ | - |
| 1027 | bool QFileInfo::isSymLink() const | - |
| 1028 | { | - |
| 1029 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1030 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:76750 |
| 0-76750 |
| 1031 | return false; never executed: return false; | 0 |
| 1032 | if (d->fileEngine == 0) { evaluated: d->fileEngine == 0| yes Evaluation Count:76746 | yes Evaluation Count:4 |
| 4-76746 |
| 1033 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::LegacyLinkType)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:76746 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::LegacyLinkType)| yes Evaluation Count:2590 | yes Evaluation Count:74156 |
| 0-76746 |
| 1034 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::LegacyLinkType); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::LegacyLinkType);Execution Count:2590 | 2590 |
| 1035 | return d->metaData.isLegacyLink(); executed: return d->metaData.isLegacyLink();Execution Count:76746 | 76746 |
| 1036 | } | - |
| 1037 | return d->getFileFlags(QAbstractFileEngine::LinkType); executed: return d->getFileFlags(QAbstractFileEngine::LinkType);Execution Count:4 | 4 |
| 1038 | } | - |
| 1039 | | - |
| 1040 | /*! | - |
| 1041 | Returns true if the object points to a directory or to a symbolic | - |
| 1042 | link to a directory, and that directory is the root directory; otherwise | - |
| 1043 | returns false. | - |
| 1044 | */ | - |
| 1045 | bool QFileInfo::isRoot() const | - |
| 1046 | { | - |
| 1047 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1048 | if (d->isDefaultConstructed) evaluated: d->isDefaultConstructed| yes Evaluation Count:2 | yes Evaluation Count:58244 |
| 2-58244 |
| 1049 | return true; executed: return true;Execution Count:2 | 2 |
| 1050 | if (d->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:58244 | no Evaluation Count:0 |
| 0-58244 |
| 1051 | if (d->fileEntry.isRoot()) { evaluated: d->fileEntry.isRoot()| yes Evaluation Count:77 | yes Evaluation Count:58167 |
| 77-58167 |
| 1052 | #if defined(Q_OS_WIN) | - |
| 1053 | //the path is a drive root, but the drive may not exist | - |
| 1054 | //for backward compatibility, return true only if the drive exists | - |
| 1055 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::ExistsAttribute)) | - |
| 1056 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::ExistsAttribute); | - |
| 1057 | return d->metaData.exists(); | - |
| 1058 | #else | - |
| 1059 | return true; executed: return true;Execution Count:77 | 77 |
| 1060 | #endif | - |
| 1061 | } | - |
| 1062 | return false; executed: return false;Execution Count:58167 | 58167 |
| 1063 | } | - |
| 1064 | return d->getFileFlags(QAbstractFileEngine::RootFlag); never executed: return d->getFileFlags(QAbstractFileEngine::RootFlag); | 0 |
| 1065 | } | - |
| 1066 | | - |
| 1067 | /*! | - |
| 1068 | \fn QString QFileInfo::symLinkTarget() const | - |
| 1069 | \since 4.2 | - |
| 1070 | | - |
| 1071 | Returns the absolute path to the file or directory a symlink (or shortcut | - |
| 1072 | on Windows) points to, or a an empty string if the object isn't a symbolic | - |
| 1073 | link. | - |
| 1074 | | - |
| 1075 | This name may not represent an existing file; it is only a string. | - |
| 1076 | QFileInfo::exists() returns true if the symlink points to an | - |
| 1077 | existing file. | - |
| 1078 | | - |
| 1079 | \sa exists(), isSymLink(), isDir(), isFile() | - |
| 1080 | */ | - |
| 1081 | | - |
| 1082 | /*! | - |
| 1083 | \obsolete | - |
| 1084 | | - |
| 1085 | Use symLinkTarget() instead. | - |
| 1086 | */ | - |
| 1087 | QString QFileInfo::readLink() const | - |
| 1088 | { | - |
| 1089 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1090 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
| 1091 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 1092 | return d->getFileName(QAbstractFileEngine::LinkName); executed: return d->getFileName(QAbstractFileEngine::LinkName);Execution Count:8 | 8 |
| 1093 | } | - |
| 1094 | | - |
| 1095 | /*! | - |
| 1096 | Returns the owner of the file. On systems where files | - |
| 1097 | do not have owners, or if an error occurs, an empty string is | - |
| 1098 | returned. | - |
| 1099 | | - |
| 1100 | This function can be time consuming under Unix (in the order of | - |
| 1101 | milliseconds). | - |
| 1102 | | - |
| 1103 | \sa ownerId(), group(), groupId() | - |
| 1104 | */ | - |
| 1105 | QString QFileInfo::owner() const | - |
| 1106 | { | - |
| 1107 | Q_D(const QFileInfo); never executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1108 | if (d->isDefaultConstructed) never evaluated: d->isDefaultConstructed | 0 |
| 1109 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 1110 | return d->getFileOwner(QAbstractFileEngine::OwnerUser); never executed: return d->getFileOwner(QAbstractFileEngine::OwnerUser); | 0 |
| 1111 | } | - |
| 1112 | | - |
| 1113 | /*! | - |
| 1114 | Returns the id of the owner of the file. | - |
| 1115 | | - |
| 1116 | On Windows and on systems where files do not have owners this | - |
| 1117 | function returns ((uint) -2). | - |
| 1118 | | - |
| 1119 | \sa owner(), group(), groupId() | - |
| 1120 | */ | - |
| 1121 | uint QFileInfo::ownerId() const | - |
| 1122 | { | - |
| 1123 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1124 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:45 |
| 0-45 |
| 1125 | return 0; never executed: return 0; | 0 |
| 1126 | if (d->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:45 | no Evaluation Count:0 |
| 0-45 |
| 1127 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::UserId)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:45 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::UserId)| yes Evaluation Count:7 | yes Evaluation Count:38 |
| 0-45 |
| 1128 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::UserId); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::UserId);Execution Count:7 | 7 |
| 1129 | return d->metaData.userId(); executed: return d->metaData.userId();Execution Count:45 | 45 |
| 1130 | } | - |
| 1131 | return d->fileEngine->ownerId(QAbstractFileEngine::OwnerUser); never executed: return d->fileEngine->ownerId(QAbstractFileEngine::OwnerUser); | 0 |
| 1132 | } | - |
| 1133 | | - |
| 1134 | /*! | - |
| 1135 | Returns the group of the file. On Windows, on systems where files | - |
| 1136 | do not have groups, or if an error occurs, an empty string is | - |
| 1137 | returned. | - |
| 1138 | | - |
| 1139 | This function can be time consuming under Unix (in the order of | - |
| 1140 | milliseconds). | - |
| 1141 | | - |
| 1142 | \sa groupId(), owner(), ownerId() | - |
| 1143 | */ | - |
| 1144 | QString QFileInfo::group() const | - |
| 1145 | { | - |
| 1146 | Q_D(const QFileInfo); never executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1147 | if (d->isDefaultConstructed) never evaluated: d->isDefaultConstructed | 0 |
| 1148 | return QLatin1String(""); never executed: return QLatin1String(""); | 0 |
| 1149 | return d->getFileOwner(QAbstractFileEngine::OwnerGroup); never executed: return d->getFileOwner(QAbstractFileEngine::OwnerGroup); | 0 |
| 1150 | } | - |
| 1151 | | - |
| 1152 | /*! | - |
| 1153 | Returns the id of the group the file belongs to. | - |
| 1154 | | - |
| 1155 | On Windows and on systems where files do not have groups this | - |
| 1156 | function always returns (uint) -2. | - |
| 1157 | | - |
| 1158 | \sa group(), owner(), ownerId() | - |
| 1159 | */ | - |
| 1160 | uint QFileInfo::groupId() const | - |
| 1161 | { | - |
| 1162 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1163 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:41 |
| 0-41 |
| 1164 | return 0; never executed: return 0; | 0 |
| 1165 | if (d->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:41 | no Evaluation Count:0 |
| 0-41 |
| 1166 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::GroupId)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:41 |
partially evaluated: !d->metaData.hasFlags(QFileSystemMetaData::GroupId)| no Evaluation Count:0 | yes Evaluation Count:41 |
| 0-41 |
| 1167 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::GroupId); never executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::GroupId); | 0 |
| 1168 | return d->metaData.groupId(); executed: return d->metaData.groupId();Execution Count:41 | 41 |
| 1169 | } | - |
| 1170 | return d->fileEngine->ownerId(QAbstractFileEngine::OwnerGroup); never executed: return d->fileEngine->ownerId(QAbstractFileEngine::OwnerGroup); | 0 |
| 1171 | } | - |
| 1172 | | - |
| 1173 | /*! | - |
| 1174 | Tests for file permissions. The \a permissions argument can be | - |
| 1175 | several flags of type QFile::Permissions OR-ed together to check | - |
| 1176 | for permission combinations. | - |
| 1177 | | - |
| 1178 | On systems where files do not have permissions this function | - |
| 1179 | always returns true. | - |
| 1180 | | - |
| 1181 | Example: | - |
| 1182 | \snippet code/src_corelib_io_qfileinfo.cpp 10 | - |
| 1183 | | - |
| 1184 | \sa isReadable(), isWritable(), isExecutable() | - |
| 1185 | */ | - |
| 1186 | bool QFileInfo::permission(QFile::Permissions permissions) const | - |
| 1187 | { | - |
| 1188 | Q_D(const QFileInfo); never executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1189 | if (d->isDefaultConstructed) never evaluated: d->isDefaultConstructed | 0 |
| 1190 | return false; never executed: return false; | 0 |
| 1191 | if (d->fileEngine == 0) { never evaluated: d->fileEngine == 0 | 0 |
| 1192 | // the QFileSystemMetaData::MetaDataFlag and QFile::Permissions overlap, so just static cast. | - |
| 1193 | QFileSystemMetaData::MetaDataFlag permissionFlags = static_cast<QFileSystemMetaData::MetaDataFlag>((int)permissions); never executed (the execution status of this line is deduced): QFileSystemMetaData::MetaDataFlag permissionFlags = static_cast<QFileSystemMetaData::MetaDataFlag>((int)permissions); | - |
| 1194 | if (!d->cache_enabled || !d->metaData.hasFlags(permissionFlags)) never evaluated: !d->cache_enabled never evaluated: !d->metaData.hasFlags(permissionFlags) | 0 |
| 1195 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, permissionFlags); never executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, permissionFlags); | 0 |
| 1196 | return (d->metaData.permissions() & permissions) == permissions; never executed: return (d->metaData.permissions() & permissions) == permissions; | 0 |
| 1197 | } | - |
| 1198 | return d->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions; never executed: return d->getFileFlags(QAbstractFileEngine::FileFlags((int)permissions)) == (uint)permissions; | 0 |
| 1199 | } | - |
| 1200 | | - |
| 1201 | /*! | - |
| 1202 | Returns the complete OR-ed together combination of | - |
| 1203 | QFile::Permissions for the file. | - |
| 1204 | */ | - |
| 1205 | QFile::Permissions QFileInfo::permissions() const | - |
| 1206 | { | - |
| 1207 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1208 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:13321 |
| 0-13321 |
| 1209 | return 0; never executed: return 0; | 0 |
| 1210 | if (d->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:13321 | no Evaluation Count:0 |
| 0-13321 |
| 1211 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::Permissions)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:13321 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::Permissions)| yes Evaluation Count:9832 | yes Evaluation Count:3489 |
| 0-13321 |
| 1212 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::Permissions); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::Permissions);Execution Count:9832 | 9832 |
| 1213 | return d->metaData.permissions(); executed: return d->metaData.permissions();Execution Count:13321 | 13321 |
| 1214 | } | - |
| 1215 | return QFile::Permissions(d->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask); never executed: return QFile::Permissions(d->getFileFlags(QAbstractFileEngine::PermsMask) & QAbstractFileEngine::PermsMask); | 0 |
| 1216 | } | - |
| 1217 | | - |
| 1218 | | - |
| 1219 | /*! | - |
| 1220 | Returns the file size in bytes. If the file does not exist or cannot be | - |
| 1221 | fetched, 0 is returned. | - |
| 1222 | | - |
| 1223 | \sa exists() | - |
| 1224 | */ | - |
| 1225 | qint64 QFileInfo::size() const | - |
| 1226 | { | - |
| 1227 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1228 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:126309 |
| 0-126309 |
| 1229 | return 0; never executed: return 0; | 0 |
| 1230 | if (d->fileEngine == 0) { evaluated: d->fileEngine == 0| yes Evaluation Count:124648 | yes Evaluation Count:1661 |
| 1661-124648 |
| 1231 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::SizeAttribute)) evaluated: !d->cache_enabled| yes Evaluation Count:2 | yes Evaluation Count:124646 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::SizeAttribute)| yes Evaluation Count:28685 | yes Evaluation Count:95961 |
| 2-124646 |
| 1232 | QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::SizeAttribute); executed: QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::SizeAttribute);Execution Count:28687 | 28687 |
| 1233 | return d->metaData.size(); executed: return d->metaData.size();Execution Count:124648 | 124648 |
| 1234 | } | - |
| 1235 | if (!d->getCachedFlag(QFileInfoPrivate::CachedSize)) { evaluated: !d->getCachedFlag(QFileInfoPrivate::CachedSize)| yes Evaluation Count:1658 | yes Evaluation Count:3 |
| 3-1658 |
| 1236 | d->setCachedFlag(QFileInfoPrivate::CachedSize); executed (the execution status of this line is deduced): d->setCachedFlag(QFileInfoPrivate::CachedSize); | - |
| 1237 | d->fileSize = d->fileEngine->size(); executed (the execution status of this line is deduced): d->fileSize = d->fileEngine->size(); | - |
| 1238 | } executed: }Execution Count:1658 | 1658 |
| 1239 | return d->fileSize; executed: return d->fileSize;Execution Count:1661 | 1661 |
| 1240 | } | - |
| 1241 | | - |
| 1242 | /*! | - |
| 1243 | Returns the date and time when the file was created. | - |
| 1244 | | - |
| 1245 | On most Unix systems, this function returns the time of the last | - |
| 1246 | status change. A status change occurs when the file is created, | - |
| 1247 | but it also occurs whenever the user writes or sets inode | - |
| 1248 | information (for example, changing the file permissions). | - |
| 1249 | | - |
| 1250 | If neither creation time nor "last status change" time are not | - |
| 1251 | available, returns the same as lastModified(). | - |
| 1252 | | - |
| 1253 | \sa lastModified(), lastRead() | - |
| 1254 | */ | - |
| 1255 | QDateTime QFileInfo::created() const | - |
| 1256 | { | - |
| 1257 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1258 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:93 |
| 0-93 |
| 1259 | return QDateTime(); never executed: return QDateTime(); | 0 |
| 1260 | if (d->fileEngine == 0) { partially evaluated: d->fileEngine == 0| yes Evaluation Count:93 | no Evaluation Count:0 |
| 0-93 |
| 1261 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::CreationTime)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:93 |
partially evaluated: !d->metaData.hasFlags(QFileSystemMetaData::CreationTime)| yes Evaluation Count:93 | no Evaluation Count:0 |
| 0-93 |
| 1262 | if (!QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::CreationTime)) partially evaluated: !QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::CreationTime)| no Evaluation Count:0 | yes Evaluation Count:93 |
| 0-93 |
| 1263 | return QDateTime(); never executed: return QDateTime(); | 0 |
| 1264 | return d->metaData.creationTime(); executed: return d->metaData.creationTime();Execution Count:93 | 93 |
| 1265 | } | - |
| 1266 | return d->getFileTime(QAbstractFileEngine::CreationTime); never executed: return d->getFileTime(QAbstractFileEngine::CreationTime); | 0 |
| 1267 | } | - |
| 1268 | | - |
| 1269 | /*! | - |
| 1270 | Returns the date and time when the file was last modified. | - |
| 1271 | | - |
| 1272 | \sa created(), lastRead() | - |
| 1273 | */ | - |
| 1274 | QDateTime QFileInfo::lastModified() const | - |
| 1275 | { | - |
| 1276 | Q_D(const QFileInfo); executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1277 | if (d->isDefaultConstructed) partially evaluated: d->isDefaultConstructed| no Evaluation Count:0 | yes Evaluation Count:8320 |
| 0-8320 |
| 1278 | return QDateTime(); never executed: return QDateTime(); | 0 |
| 1279 | if (d->fileEngine == 0) { evaluated: d->fileEngine == 0| yes Evaluation Count:6662 | yes Evaluation Count:1658 |
| 1658-6662 |
| 1280 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::ModificationTime)) partially evaluated: !d->cache_enabled| no Evaluation Count:0 | yes Evaluation Count:6662 |
evaluated: !d->metaData.hasFlags(QFileSystemMetaData::ModificationTime)| yes Evaluation Count:2235 | yes Evaluation Count:4427 |
| 0-6662 |
| 1281 | if (!QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::ModificationTime)) evaluated: !QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::ModificationTime)| yes Evaluation Count:1777 | yes Evaluation Count:458 |
| 458-1777 |
| 1282 | return QDateTime(); executed: return QDateTime();Execution Count:1777 | 1777 |
| 1283 | return d->metaData.modificationTime(); executed: return d->metaData.modificationTime();Execution Count:4885 | 4885 |
| 1284 | } | - |
| 1285 | return d->getFileTime(QAbstractFileEngine::ModificationTime); executed: return d->getFileTime(QAbstractFileEngine::ModificationTime);Execution Count:1658 | 1658 |
| 1286 | } | - |
| 1287 | | - |
| 1288 | /*! | - |
| 1289 | Returns the date and time when the file was last read (accessed). | - |
| 1290 | | - |
| 1291 | On platforms where this information is not available, returns the | - |
| 1292 | same as lastModified(). | - |
| 1293 | | - |
| 1294 | \sa created(), lastModified() | - |
| 1295 | */ | - |
| 1296 | QDateTime QFileInfo::lastRead() const | - |
| 1297 | { | - |
| 1298 | Q_D(const QFileInfo); never executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1299 | if (d->isDefaultConstructed) never evaluated: d->isDefaultConstructed | 0 |
| 1300 | return QDateTime(); never executed: return QDateTime(); | 0 |
| 1301 | if (d->fileEngine == 0) { never evaluated: d->fileEngine == 0 | 0 |
| 1302 | if (!d->cache_enabled || !d->metaData.hasFlags(QFileSystemMetaData::AccessTime)) never evaluated: !d->cache_enabled never evaluated: !d->metaData.hasFlags(QFileSystemMetaData::AccessTime) | 0 |
| 1303 | if (!QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::AccessTime)) never evaluated: !QFileSystemEngine::fillMetaData(d->fileEntry, d->metaData, QFileSystemMetaData::AccessTime) | 0 |
| 1304 | return QDateTime(); never executed: return QDateTime(); | 0 |
| 1305 | return d->metaData.accessTime(); never executed: return d->metaData.accessTime(); | 0 |
| 1306 | } | - |
| 1307 | return d->getFileTime(QAbstractFileEngine::AccessTime); never executed: return d->getFileTime(QAbstractFileEngine::AccessTime); | 0 |
| 1308 | } | - |
| 1309 | | - |
| 1310 | /*! | - |
| 1311 | \internal | - |
| 1312 | */ | - |
| 1313 | QFileInfoPrivate* QFileInfo::d_func() | - |
| 1314 | { | - |
| 1315 | return d_ptr.data(); executed: return d_ptr.data();Execution Count:17 | 17 |
| 1316 | } | - |
| 1317 | | - |
| 1318 | /*! | - |
| 1319 | Returns true if caching is enabled; otherwise returns false. | - |
| 1320 | | - |
| 1321 | \sa setCaching(), refresh() | - |
| 1322 | */ | - |
| 1323 | bool QFileInfo::caching() const | - |
| 1324 | { | - |
| 1325 | Q_D(const QFileInfo); never executed (the execution status of this line is deduced): const QFileInfoPrivate * const d = d_func(); | - |
| 1326 | return d->cache_enabled; never executed: return d->cache_enabled; | 0 |
| 1327 | } | - |
| 1328 | | - |
| 1329 | /*! | - |
| 1330 | If \a enable is true, enables caching of file information. If \a | - |
| 1331 | enable is false caching is disabled. | - |
| 1332 | | - |
| 1333 | When caching is enabled, QFileInfo reads the file information from | - |
| 1334 | the file system the first time it's needed, but generally not | - |
| 1335 | later. | - |
| 1336 | | - |
| 1337 | Caching is enabled by default. | - |
| 1338 | | - |
| 1339 | \sa refresh(), caching() | - |
| 1340 | */ | - |
| 1341 | void QFileInfo::setCaching(bool enable) | - |
| 1342 | { | - |
| 1343 | Q_D(QFileInfo); executed (the execution status of this line is deduced): QFileInfoPrivate * const d = d_func(); | - |
| 1344 | d->cache_enabled = enable; executed (the execution status of this line is deduced): d->cache_enabled = enable; | - |
| 1345 | } executed: }Execution Count:13 | 13 |
| 1346 | | - |
| 1347 | /*! | - |
| 1348 | \typedef QFileInfoList | - |
| 1349 | \relates QFileInfo | - |
| 1350 | | - |
| 1351 | Synonym for QList<QFileInfo>. | - |
| 1352 | */ | - |
| 1353 | | - |
| 1354 | QT_END_NAMESPACE | - |
| 1355 | | - |
| | |