1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/qdir.h:1 -->
|
---|
3 | <html>
|
---|
4 | <head>
|
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
6 | <title>qdir.h Include File</title>
|
---|
7 | <style type="text/css"><!--
|
---|
8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
9 | a:link { color: #004faf; text-decoration: none }
|
---|
10 | a:visited { color: #672967; text-decoration: none }
|
---|
11 | body { background: #ffffff; color: black; }
|
---|
12 | --></style>
|
---|
13 | </head>
|
---|
14 | <body>
|
---|
15 |
|
---|
16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
17 | <tr bgcolor="#E5E5E5">
|
---|
18 | <td valign=center>
|
---|
19 | <a href="index.html">
|
---|
20 | <font color="#004faf">Home</font></a>
|
---|
21 | | <a href="classes.html">
|
---|
22 | <font color="#004faf">All Classes</font></a>
|
---|
23 | | <a href="mainclasses.html">
|
---|
24 | <font color="#004faf">Main Classes</font></a>
|
---|
25 | | <a href="annotated.html">
|
---|
26 | <font color="#004faf">Annotated</font></a>
|
---|
27 | | <a href="groups.html">
|
---|
28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
29 | | <a href="functions.html">
|
---|
30 | <font color="#004faf">Functions</font></a>
|
---|
31 | </td>
|
---|
32 | <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>qdir.h</h1>
|
---|
33 |
|
---|
34 | <p>This is the verbatim text of the qdir.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
---|
35 | <hr>
|
---|
36 | <pre>
|
---|
37 | /****************************************************************************
|
---|
38 | ** $Id: qdir-h.html 2051 2007-02-21 10:04:20Z chehrlic $
|
---|
39 | **
|
---|
40 | ** Definition of QDir class
|
---|
41 | **
|
---|
42 | ** Created : 950427
|
---|
43 | **
|
---|
44 | ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
---|
45 | **
|
---|
46 | ** This file is part of the tools module of the Qt GUI Toolkit.
|
---|
47 | **
|
---|
48 | ** This file may be distributed under the terms of the Q Public License
|
---|
49 | ** as defined by Trolltech ASA of Norway and appearing in the file
|
---|
50 | ** LICENSE.QPL included in the packaging of this file.
|
---|
51 | **
|
---|
52 | ** This file may be distributed and/or modified under the terms of the
|
---|
53 | ** GNU General Public License version 2 as published by the Free Software
|
---|
54 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
55 | ** packaging of this file.
|
---|
56 | **
|
---|
57 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
58 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
59 | ** Agreement provided with the Software.
|
---|
60 | **
|
---|
61 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
62 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
63 | **
|
---|
64 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
65 | ** information about Qt Commercial License Agreements.
|
---|
66 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
67 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
68 | **
|
---|
69 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
70 | ** not clear to you.
|
---|
71 | **
|
---|
72 | **********************************************************************/
|
---|
73 |
|
---|
74 | #ifndef QDIR_H
|
---|
75 | #define QDIR_H
|
---|
76 |
|
---|
77 | #ifndef QT_H
|
---|
78 | #include "qglobal.h"
|
---|
79 | #include "qstrlist.h"
|
---|
80 | #include "qfileinfo.h"
|
---|
81 | #endif // QT_H
|
---|
82 |
|
---|
83 |
|
---|
84 | #ifndef QT_NO_DIR
|
---|
85 | typedef QPtrList<QFileInfo> QFileInfoList;
|
---|
86 | typedef QPtrListIterator<QFileInfo> QFileInfoListIterator;
|
---|
87 | class QStringList;
|
---|
88 | template <class T> class QDeepCopy;
|
---|
89 |
|
---|
90 |
|
---|
91 | class Q_EXPORT QDir
|
---|
92 | {
|
---|
93 | public:
|
---|
94 | enum FilterSpec { Dirs = 0x001,
|
---|
95 | Files = 0x002,
|
---|
96 | Drives = 0x004,
|
---|
97 | NoSymLinks = 0x008,
|
---|
98 | All = 0x007,
|
---|
99 | TypeMask = 0x00F,
|
---|
100 |
|
---|
101 | Readable = 0x010,
|
---|
102 | Writable = 0x020,
|
---|
103 | Executable = 0x040,
|
---|
104 | RWEMask = 0x070,
|
---|
105 |
|
---|
106 | Modified = 0x080,
|
---|
107 | Hidden = 0x100,
|
---|
108 | System = 0x200,
|
---|
109 | AccessMask = 0x3F0,
|
---|
110 |
|
---|
111 | DefaultFilter = -1 };
|
---|
112 |
|
---|
113 | enum SortSpec { Name = 0x00,
|
---|
114 | Time = 0x01,
|
---|
115 | Size = 0x02,
|
---|
116 | Unsorted = 0x03,
|
---|
117 | SortByMask = 0x03,
|
---|
118 |
|
---|
119 | DirsFirst = 0x04,
|
---|
120 | Reversed = 0x08,
|
---|
121 | IgnoreCase = 0x10,
|
---|
122 | LocaleAware = 0x20,
|
---|
123 | DefaultSort = -1 };
|
---|
124 |
|
---|
125 | QDir();
|
---|
126 | QDir( const QString &path, const QString &nameFilter = QString::null,
|
---|
127 | int sortSpec = Name | IgnoreCase, int filterSpec = All );
|
---|
128 | QDir( const QDir & );
|
---|
129 |
|
---|
130 | virtual ~QDir();
|
---|
131 |
|
---|
132 | QDir &operator=( const QDir & );
|
---|
133 | QDir &operator=( const QString &path );
|
---|
134 |
|
---|
135 | virtual void setPath( const QString &path );
|
---|
136 | virtual QString path() const;
|
---|
137 | virtual QString absPath() const;
|
---|
138 | virtual QString canonicalPath() const;
|
---|
139 |
|
---|
140 | virtual QString dirName() const;
|
---|
141 | virtual QString filePath( const QString &fileName,
|
---|
142 | bool acceptAbsPath = TRUE ) const;
|
---|
143 | virtual QString absFilePath( const QString &fileName,
|
---|
144 | bool acceptAbsPath = TRUE ) const;
|
---|
145 |
|
---|
146 | static QString convertSeparators( const QString &pathName );
|
---|
147 |
|
---|
148 | virtual bool cd( const QString &dirName, bool acceptAbsPath = TRUE );
|
---|
149 | virtual bool cdUp();
|
---|
150 |
|
---|
151 | QString nameFilter() const;
|
---|
152 | virtual void setNameFilter( const QString &nameFilter );
|
---|
153 | FilterSpec filter() const;
|
---|
154 | virtual void setFilter( int filterSpec );
|
---|
155 | SortSpec sorting() const;
|
---|
156 | virtual void setSorting( int sortSpec );
|
---|
157 |
|
---|
158 | bool matchAllDirs() const;
|
---|
159 | virtual void setMatchAllDirs( bool );
|
---|
160 |
|
---|
161 | uint count() const;
|
---|
162 | QString operator[]( int ) const;
|
---|
163 |
|
---|
164 | virtual QStrList encodedEntryList( int filterSpec = DefaultFilter,
|
---|
165 | int sortSpec = DefaultSort ) const;
|
---|
166 | virtual QStrList encodedEntryList( const QString &nameFilter,
|
---|
167 | int filterSpec = DefaultFilter,
|
---|
168 | int sortSpec = DefaultSort ) const;
|
---|
169 | virtual QStringList entryList( int filterSpec = DefaultFilter,
|
---|
170 | int sortSpec = DefaultSort ) const;
|
---|
171 | virtual QStringList entryList( const QString &nameFilter,
|
---|
172 | int filterSpec = DefaultFilter,
|
---|
173 | int sortSpec = DefaultSort ) const;
|
---|
174 |
|
---|
175 | virtual const QFileInfoList *entryInfoList( int filterSpec = DefaultFilter,
|
---|
176 | int sortSpec = DefaultSort ) const;
|
---|
177 | virtual const QFileInfoList *entryInfoList( const QString &nameFilter,
|
---|
178 | int filterSpec = DefaultFilter,
|
---|
179 | int sortSpec = DefaultSort ) const;
|
---|
180 |
|
---|
181 | static const QFileInfoList *drives();
|
---|
182 |
|
---|
183 | virtual bool mkdir( const QString &dirName,
|
---|
184 | bool acceptAbsPath = TRUE ) const;
|
---|
185 | virtual bool rmdir( const QString &dirName,
|
---|
186 | bool acceptAbsPath = TRUE ) const;
|
---|
187 |
|
---|
188 | virtual bool isReadable() const;
|
---|
189 | virtual bool exists() const;
|
---|
190 | virtual bool isRoot() const;
|
---|
191 |
|
---|
192 | virtual bool isRelative() const;
|
---|
193 | virtual void convertToAbs();
|
---|
194 |
|
---|
195 | virtual bool operator==( const QDir & ) const;
|
---|
196 | virtual bool operator!=( const QDir & ) const;
|
---|
197 |
|
---|
198 | virtual bool remove( const QString &fileName,
|
---|
199 | bool acceptAbsPath = TRUE );
|
---|
200 | virtual bool rename( const QString &name, const QString &newName,
|
---|
201 | bool acceptAbsPaths = TRUE );
|
---|
202 | virtual bool exists( const QString &name,
|
---|
203 | bool acceptAbsPath = TRUE );
|
---|
204 |
|
---|
205 | static char separator();
|
---|
206 |
|
---|
207 | static bool setCurrent( const QString &path );
|
---|
208 | static QDir current();
|
---|
209 | static QDir home();
|
---|
210 | static QDir root();
|
---|
211 | static QString currentDirPath();
|
---|
212 | static QString homeDirPath();
|
---|
213 | static QString rootDirPath();
|
---|
214 |
|
---|
215 | static bool match( const QStringList &filters, const QString &fileName );
|
---|
216 | static bool match( const QString &filter, const QString &fileName );
|
---|
217 | static QString cleanDirPath( const QString &dirPath );
|
---|
218 | static bool isRelativePath( const QString &path );
|
---|
219 | void refresh() const;
|
---|
220 |
|
---|
221 | private:
|
---|
222 | #ifdef Q_OS_MAC
|
---|
223 | typedef struct FSSpec FSSpec;
|
---|
224 | static FSSpec *make_spec(const QString &);
|
---|
225 | #endif
|
---|
226 | void init();
|
---|
227 | virtual bool readDirEntries( const QString &nameFilter,
|
---|
228 | int FilterSpec, int SortSpec );
|
---|
229 |
|
---|
230 | static void slashify( QString & );
|
---|
231 |
|
---|
232 | QString dPath;
|
---|
233 | QStringList *fList;
|
---|
234 | QFileInfoList *fiList;
|
---|
235 | QString nameFilt;
|
---|
236 | FilterSpec filtS;
|
---|
237 | SortSpec sortS;
|
---|
238 | uint dirty : 1;
|
---|
239 | uint allDirs : 1;
|
---|
240 |
|
---|
241 | void detach();
|
---|
242 | friend class QDeepCopy< QDir >;
|
---|
243 | };
|
---|
244 |
|
---|
245 |
|
---|
246 | inline QString QDir::path() const
|
---|
247 | {
|
---|
248 | return dPath;
|
---|
249 | }
|
---|
250 |
|
---|
251 | inline QString QDir::nameFilter() const
|
---|
252 | {
|
---|
253 | return nameFilt;
|
---|
254 | }
|
---|
255 |
|
---|
256 | inline QDir::FilterSpec QDir::filter() const
|
---|
257 | {
|
---|
258 | return filtS;
|
---|
259 | }
|
---|
260 |
|
---|
261 | inline QDir::SortSpec QDir::sorting() const
|
---|
262 | {
|
---|
263 | return sortS;
|
---|
264 | }
|
---|
265 |
|
---|
266 | inline bool QDir::matchAllDirs() const
|
---|
267 | {
|
---|
268 | return allDirs;
|
---|
269 | }
|
---|
270 |
|
---|
271 | inline bool QDir::operator!=( const QDir &d ) const
|
---|
272 | {
|
---|
273 | return !(*this == d);
|
---|
274 | }
|
---|
275 |
|
---|
276 |
|
---|
277 | struct QDirSortItem {
|
---|
278 | QString filename_cache;
|
---|
279 | QFileInfo* item;
|
---|
280 | };
|
---|
281 |
|
---|
282 | #endif // QT_NO_DIR
|
---|
283 | #endif // QDIR_H
|
---|
284 | </pre>
|
---|
285 | <!-- eof -->
|
---|
286 | <p><address><hr><div align=center>
|
---|
287 | <table width=100% cellspacing=0 border=0><tr>
|
---|
288 | <td>Copyright © 2007
|
---|
289 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
290 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
291 | </table></div></address></body>
|
---|
292 | </html>
|
---|