1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the core module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
32
#include "QtCore/qfile.h"
33
#include "QtCore/qlist.h"
37
class QFileInfoPrivate;
39
class Q_CORE_EXPORT QFileInfo
43
QFileInfo(const QString &file);
44
QFileInfo(const QFile &file);
46
QFileInfo(const QDir &dir, const QString &file);
48
QFileInfo(const QFileInfo &fileinfo);
51
QFileInfo &operator=(const QFileInfo &fileinfo);
52
bool operator==(const QFileInfo &fileinfo);
53
inline bool operator!=(const QFileInfo &fileinfo) { return !(operator==(fileinfo)); }
55
void setFile(const QString &file);
56
void setFile(const QFile &file);
58
void setFile(const QDir &dir, const QString &file);
63
QString filePath() const;
64
QString absoluteFilePath() const;
65
QString canonicalFilePath() const;
66
QString fileName() const;
67
QString baseName() const;
68
QString completeBaseName() const;
69
QString suffix() const;
70
QString completeSuffix() const;
73
QString absolutePath() const;
74
QString canonicalPath() const;
77
QDir absoluteDir() const;
80
bool isReadable() const;
81
bool isWritable() const;
82
bool isExecutable() const;
83
bool isHidden() const;
85
bool isRelative() const;
86
inline bool isAbsolute() const { return !isRelative(); }
91
bool isSymLink() const;
94
QString readLink() const;
96
QString owner() const;
98
QString group() const;
101
bool permission(QFile::Permissions permissions) const;
102
QFile::Permissions permissions() const;
106
QDateTime created() const;
107
QDateTime lastModified() const;
108
QDateTime lastRead() const;
112
bool caching() const;
113
void setCaching(bool on);
117
ReadOwner = QFile::ReadOwner, WriteOwner = QFile::WriteOwner, ExeOwner = QFile::ExeOwner,
118
ReadUser = QFile::ReadUser, WriteUser = QFile::WriteUser, ExeUser = QFile::ExeUser,
119
ReadGroup = QFile::ReadGroup, WriteGroup = QFile::WriteGroup, ExeGroup = QFile::ExeGroup,
120
ReadOther = QFile::ReadOther, WriteOther = QFile::WriteOther, ExeOther = QFile::ExeOther
122
Q_DECLARE_FLAGS(PermissionSpec, Permission)
124
inline QT3_SUPPORT QString baseName(bool complete) {
126
return completeBaseName();
129
inline QT3_SUPPORT QString extension(bool complete = true) const {
131
return completeSuffix();
134
inline QT3_SUPPORT QString absFilePath() const { return absoluteFilePath(); }
136
inline QT3_SUPPORT QString dirPath(bool absPath = false) const {
138
return absolutePath();
141
QT3_SUPPORT QDir dir(bool absPath) const;
142
inline QT3_SUPPORT bool convertToAbs() { return makeAbsolute(); }
143
#if !defined(Q_NO_TYPESAFE_FLAGS)
144
inline QT3_SUPPORT bool permission(PermissionSpec permissions) const
145
{ return permission(QFile::Permissions((int)permissions)); }
150
QFileInfoPrivate *d_ptr;
152
Q_DECLARE_PRIVATE(QFileInfo)
154
Q_DECLARE_TYPEINFO(QFileInfo, Q_MOVABLE_TYPE);
157
Q_DECLARE_OPERATORS_FOR_FLAGS(QFileInfo::PermissionSpec)
160
typedef QList<QFileInfo> QFileInfoList;
162
typedef QList<QFileInfo>::Iterator QFileInfoListIterator;
165
#endif // QFILEINFO_H