Define QT_OPEN_LARGEFILE on Symbian + WinCE
[qt-netbsd.git] / src / corelib / io / qfileinfo.h
blob367c2507a223de5239103db94f2bbbb0e6a371e1
1 /****************************************************************************
2 **
3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QtCore module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
40 ****************************************************************************/
42 #ifndef QFILEINFO_H
43 #define QFILEINFO_H
45 #include <QtCore/qfile.h>
46 #include <QtCore/qlist.h>
47 #include <QtCore/qscopedpointer.h>
49 QT_BEGIN_HEADER
51 QT_BEGIN_NAMESPACE
53 QT_MODULE(Core)
55 class QDir;
56 class QDateTime;
57 class QFileInfoPrivate;
59 class Q_CORE_EXPORT QFileInfo
61 public:
62 QFileInfo();
63 QFileInfo(const QString &file);
64 QFileInfo(const QFile &file);
65 QFileInfo(const QDir &dir, const QString &file);
66 QFileInfo(const QFileInfo &fileinfo);
67 ~QFileInfo();
69 QFileInfo &operator=(const QFileInfo &fileinfo);
70 bool operator==(const QFileInfo &fileinfo); // 5.0 - remove me
71 bool operator==(const QFileInfo &fileinfo) const;
72 inline bool operator!=(const QFileInfo &fileinfo) { return !(operator==(fileinfo)); } // 5.0 - remove me
73 inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); }
75 void setFile(const QString &file);
76 void setFile(const QFile &file);
77 void setFile(const QDir &dir, const QString &file);
78 bool exists() const;
79 void refresh();
81 QString filePath() const;
82 QString absoluteFilePath() const;
83 QString canonicalFilePath() const;
84 QString fileName() const;
85 QString baseName() const;
86 QString completeBaseName() const;
87 QString suffix() const;
88 QString bundleName() const;
89 QString completeSuffix() const;
91 QString path() const;
92 QString absolutePath() const;
93 QString canonicalPath() const;
94 QDir dir() const;
95 QDir absoluteDir() const;
97 bool isReadable() const;
98 bool isWritable() const;
99 bool isExecutable() const;
100 bool isHidden() const;
102 bool isRelative() const;
103 inline bool isAbsolute() const { return !isRelative(); }
104 bool makeAbsolute();
106 bool isFile() const;
107 bool isDir() const;
108 bool isSymLink() const;
109 bool isRoot() const;
110 bool isBundle() const;
112 QString readLink() const;
113 inline QString symLinkTarget() const { return readLink(); }
115 QString owner() const;
116 uint ownerId() const;
117 QString group() const;
118 uint groupId() const;
120 bool permission(QFile::Permissions permissions) const;
121 QFile::Permissions permissions() const;
123 qint64 size() const;
125 QDateTime created() const;
126 QDateTime lastModified() const;
127 QDateTime lastRead() const;
129 void detach();
131 bool caching() const;
132 void setCaching(bool on);
134 #ifdef QT3_SUPPORT
135 enum Permission {
136 ReadOwner = QFile::ReadOwner, WriteOwner = QFile::WriteOwner, ExeOwner = QFile::ExeOwner,
137 ReadUser = QFile::ReadUser, WriteUser = QFile::WriteUser, ExeUser = QFile::ExeUser,
138 ReadGroup = QFile::ReadGroup, WriteGroup = QFile::WriteGroup, ExeGroup = QFile::ExeGroup,
139 ReadOther = QFile::ReadOther, WriteOther = QFile::WriteOther, ExeOther = QFile::ExeOther
141 Q_DECLARE_FLAGS(PermissionSpec, Permission)
143 inline QT3_SUPPORT QString baseName(bool complete) {
144 if(complete)
145 return completeBaseName();
146 return baseName();
148 inline QT3_SUPPORT QString extension(bool complete = true) const {
149 if(complete)
150 return completeSuffix();
151 return suffix();
153 inline QT3_SUPPORT QString absFilePath() const { return absoluteFilePath(); }
155 inline QT3_SUPPORT QString dirPath(bool absPath = false) const {
156 if(absPath)
157 return absolutePath();
158 return path();
160 QT3_SUPPORT QDir dir(bool absPath) const;
161 inline QT3_SUPPORT bool convertToAbs() { return makeAbsolute(); }
162 #if !defined(Q_NO_TYPESAFE_FLAGS)
163 inline QT3_SUPPORT bool permission(PermissionSpec permissions) const
164 { return permission(QFile::Permissions(static_cast<int>(permissions))); }
165 #endif
166 #endif
168 protected:
169 QScopedPointer<QFileInfoPrivate> d_ptr;
170 private:
171 Q_DECLARE_PRIVATE(QFileInfo)
173 Q_DECLARE_TYPEINFO(QFileInfo, Q_MOVABLE_TYPE);
175 #ifdef QT3_SUPPORT
176 Q_DECLARE_OPERATORS_FOR_FLAGS(QFileInfo::PermissionSpec)
177 #endif
179 typedef QList<QFileInfo> QFileInfoList;
180 #ifdef QT3_SUPPORT
181 typedef QList<QFileInfo>::Iterator QFileInfoListIterator;
182 #endif
184 QT_END_NAMESPACE
186 QT_END_HEADER
188 #endif // QFILEINFO_H