42 #include "qplatformdefs.h" 138 QAbstractFileEngine::FileFlags req = 0;
441 return const_cast<const QFileInfo *
>(
this)->
operator==(fileinfo);
537 if (
d->isDefaultConstructed)
554 if (
d->isDefaultConstructed)
581 if (
d->isDefaultConstructed) {
583 }
else if (
d->fileEntry.isEmpty()) {
584 qWarning(
"QFileInfo::absolutePath: Constructed with empty filename");
601 if (
d->isDefaultConstructed)
618 if (
d->isDefaultConstructed)
620 return d->fileEntry.path();
645 if (
d->isDefaultConstructed)
647 if (
d->fileEngine == 0)
648 return d->fileEntry.isRelative();
649 return d->fileEngine->isRelativePath();
678 if (
d->isDefaultConstructed)
680 if (
d->fileEngine == 0) {
683 return d->metaData.exists();
710 if (
d->isDefaultConstructed)
712 return d->fileEntry.filePath();
729 if (
d->isDefaultConstructed)
731 return d->fileEntry.fileName();
752 if (
d->isDefaultConstructed)
776 if (
d->isDefaultConstructed)
778 return d->fileEntry.baseName();
795 if (
d->isDefaultConstructed)
797 return d->fileEntry.completeBaseName();
814 if (
d->isDefaultConstructed)
816 return d->fileEntry.completeSuffix();
837 if (
d->isDefaultConstructed)
839 return d->fileEntry.suffix();
865 return QDir(
d->fileEntry.path());
899 if (
d->isDefaultConstructed)
901 if (
d->fileEngine == 0) {
917 if (
d->isDefaultConstructed)
919 if (
d->fileEngine == 0) {
935 if (
d->isDefaultConstructed)
937 if (
d->fileEngine == 0) {
954 if (
d->isDefaultConstructed)
956 if (
d->fileEngine == 0) {
959 return d->metaData.isHidden();
974 if (
d->isDefaultConstructed)
976 if (
d->fileEngine == 0) {
979 return d->metaData.isFile();
993 if (
d->isDefaultConstructed)
995 if (
d->fileEngine == 0) {
998 return d->metaData.isDirectory();
1017 if (
d->isDefaultConstructed)
1019 if (
d->fileEngine == 0) {
1022 return d->metaData.isBundle();
1047 if (
d->isDefaultConstructed)
1049 if (
d->fileEngine == 0) {
1052 return d->metaData.isLegacyLink();
1065 if (
d->isDefaultConstructed)
1067 if (
d->fileEngine == 0) {
1068 if (
d->fileEntry.isRoot()) {
1069 #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) 1074 return d->metaData.exists();
1113 if (
d->isDefaultConstructed)
1131 if (
d->isDefaultConstructed)
1147 if (
d->isDefaultConstructed)
1149 if (
d->fileEngine == 0) {
1152 return d->metaData.userId();
1170 if (
d->isDefaultConstructed)
1186 if (
d->isDefaultConstructed)
1188 if (
d->fileEngine == 0) {
1191 return d->metaData.groupId();
1212 if (
d->isDefaultConstructed)
1214 if (
d->fileEngine == 0) {
1217 if (!
d->cache_enabled || !
d->metaData.hasFlags(permissionFlags))
1219 return (
d->metaData.permissions() &
permissions) == permissions;
1221 return d->getFileFlags(QAbstractFileEngine::FileFlags((
int)permissions)) == (
uint)permissions;
1231 if (
d->isDefaultConstructed)
1233 if (
d->fileEngine == 0) {
1236 return d->metaData.permissions();
1251 if (
d->isDefaultConstructed)
1253 if (
d->fileEngine == 0) {
1256 return d->metaData.size();
1260 d->fileSize =
d->fileEngine->size();
1281 if (
d->isDefaultConstructed)
1283 if (
d->fileEngine == 0) {
1286 return d->metaData.creationTime();
1299 if (
d->isDefaultConstructed)
1301 if (
d->fileEngine == 0) {
1304 return d->metaData.modificationTime();
1320 if (
d->isDefaultConstructed)
1322 if (
d->fileEngine == 0) {
1325 return d->metaData.accessTime();
1349 return d->cache_enabled;
1367 d->cache_enabled = enable;
The QDir class provides access to directory structures and their contents.
static bool fillMetaData(const QFileSystemEntry &entry, QFileSystemMetaData &data, QFileSystemMetaData::MetaDataFlags what)
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const
This function should return the set of OR'd flags that are true for the file engine's file...
QString fileName() const
Returns the name set by setFileName() or to the QFile constructors.
QScopedPointer< QAbstractFileEngine > const fileEngine
QDateTime lastRead() const
Returns the date and time when the file was last read (accessed).
QFileSystemEntry fileEntry
bool isHidden() const
Returns true if this is a `hidden' file; otherwise returns false.
#define QT_END_NAMESPACE
This macro expands to.
QDir dir() const
Returns the path of the object's parent directory as a QDir object.
virtual QString fileName(FileName file=DefaultName) const
Return the file engine's current file name in the format specified by file.
void refresh()
Refreshes the information about the file, i.e.
QFileInfo & operator=(const QFileInfo &fileinfo)
Makes a copy of the given fileinfo and assigns it to this QFileInfo.
bool getCachedFlag(uint c) const
QDateTime created() const
Returns the date and time when the file was created.
void detach()
If the shared data object's reference count is greater than 1, this function creates a deep copy of t...
static QString resolveGroupName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
QDir absoluteDir() const
Returns the file's absolute path as a QDir object.
virtual QString owner(FileOwner) const
If owner is OwnerUser return the name of the user who owns the file.
QString fileName() const
Returns the name of the file, excluding the path.
QString completeSuffix() const
Returns the complete suffix of the file.
QFileSystemMetaData metaData
FileName
These values are used to request a file name in a particular format.
QString absoluteFilePath() const
Returns an absolute path including the file name.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
bool exists() const
Returns true if the file exists; otherwise returns false.
void setCaching(bool on)
If enable is true, enables caching of file information.
QSharedDataPointer< QFileInfoPrivate > d_ptr
The QString class provides a Unicode character string.
uint getFileFlags(QAbstractFileEngine::FileFlags) const
QString group() const
Returns the group of the file.
QFile::Permissions permissions() const
Returns the complete OR-ed together combination of QFile::Permissions for the file.
static bool isCaseSensitive()
uint ownerId() const
Returns the id of the owner of the file.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString completeBaseName() const
Returns the complete base name of the file without the path.
static QFileSystemEntry absoluteName(const QFileSystemEntry &entry)
QString getFileOwner(QAbstractFileEngine::FileOwner own) const
static QString resolveUserName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
bool caching() const
Returns true if caching is enabled; otherwise returns false.
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory; otherwise ret...
virtual bool caseSensitive() const
Should return true if the underlying file system is case-sensitive; otherwise return false...
bool makeAbsolute()
Converts the file's path to an absolute path if it is not already in that form.
void setFile(const QString &file)
Sets the file that the QFileInfo provides information about to file.
QString canonicalFilePath() const
Returns the canonical path including the file name, i.e.
Q_CORE_EXPORT void qWarning(const char *,...)
The QAbstractFileEngine class provides an abstraction for accessing the filesystem.
const T * constData() const
Returns a const pointer to the shared data object.
bool isExecutable() const
Returns true if the file is executable; otherwise returns false.
QString owner() const
Returns the owner of the file.
void detach()
Detaches all internal data.
bool operator==(const QFileInfo &fileinfo)
Returns true if this QFileInfo object refers to a file in the same location as fileinfo; otherwise re...
static QFileSystemEntry getLinkTarget(const QFileSystemEntry &link, QFileSystemMetaData &data)
void setCachedFlag(uint c) const
FileTime
These are used by the fileTime() function.
QString canonicalPath() const
Returns the file's path canonical path (excluding the file name), i.e.
QFileInfo()
Constructs an empty QFileInfo object.
static QString bundleName(const QFileSystemEntry &entry)
QString baseName() const
Returns the base name of the file without the path.
int compare(const QString &s) const
qint64 size() const
Returns the file size in bytes.
The QDateTime class provides date and time functions.
The QFile class provides an interface for reading from and writing to files.
QString getFileName(QAbstractFileEngine::FileName) const
bool isRoot() const
Returns true if the object points to a directory or to a symbolic link to a directory, and that directory is the root directory; otherwise returns false.
QString bundleName() const
Returns the name of the bundle.
QString fileNames[QAbstractFileEngine::NFileNames]
bool permission(QFile::Permissions permissions) const
Tests for file permissions.
QString suffix() const
Returns the suffix of the file.
bool isRelative() const
Returns true if the file path name is relative, otherwise returns false if the path is absolute (e...
QDateTime & getFileTime(QAbstractFileEngine::FileTime) const
bool isFile() const
Returns true if this object points to a file or to a symbolic link to a file.
uint groupId() const
Returns the id of the group the file belongs to.
bool isBundle() const
Returns true if this object points to a bundle or to a symbolic link to a bundle on Mac OS X; otherwi...
virtual QDateTime fileTime(FileTime time) const
If time is CreationTime, return when the file was created.
QString readLink() const
Use symLinkTarget() instead.
bool const isDefaultConstructed
QString filePath(const QString &fileName) const
Returns the path name of a file in the directory.
bool isReadable() const
Returns true if the user can read the file; otherwise returns false.
QString path() const
Returns the file's path.
bool isSymLink() const
Returns true if this object points to a symbolic link (or to a shortcut on Windows); otherwise return...
The QFileInfo class provides system-independent file information.
QString filePath() const
Returns the file name, including the path (which may be absolute or relative).
bool isWritable() const
Returns true if the user can write to the file; otherwise returns false.
QString absolutePath() const
Returns a file's path absolute path.
~QFileInfo()
Destroys the QFileInfo and frees its resources.
static bool isNull(const QVariant::Private *d)
static QFileSystemEntry canonicalName(const QFileSystemEntry &entry, QFileSystemMetaData &data)
QDateTime lastModified() const
Returns the date and time when the file was last modified.