-rw-r--r-- | qmake/include/qdir.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/qmake/include/qdir.h b/qmake/include/qdir.h index 6e9f1ab..4b08b79 100644 --- a/qmake/include/qdir.h +++ b/qmake/include/qdir.h | |||
@@ -1,241 +1,242 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of QDir class | 4 | ** Definition of QDir class |
5 | ** | 5 | ** |
6 | ** Created : 950427 | 6 | ** Created : 950427 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #ifndef QDIR_H | 38 | #ifndef QDIR_H |
39 | #define QDIR_H | 39 | #define QDIR_H |
40 | 40 | ||
41 | #ifndef QT_H | 41 | #ifndef QT_H |
42 | #include "qglobal.h" | 42 | #include "qglobal.h" |
43 | #include "qstrlist.h" | 43 | #include "qstrlist.h" |
44 | #include "qfileinfo.h" | 44 | #include "qfileinfo.h" |
45 | #endif // QT_H | 45 | #endif // QT_H |
46 | 46 | ||
47 | 47 | ||
48 | #ifndef QT_NO_DIR | 48 | #ifndef QT_NO_DIR |
49 | typedef QPtrList<QFileInfo> QFileInfoList; | 49 | typedef QPtrList<QFileInfo> QFileInfoList; |
50 | typedef QPtrListIterator<QFileInfo> QFileInfoListIterator; | 50 | typedef QPtrListIterator<QFileInfo> QFileInfoListIterator; |
51 | class QStringList; | 51 | class QStringList; |
52 | 52 | ||
53 | 53 | ||
54 | class Q_EXPORT QDir | 54 | class Q_EXPORT QDir |
55 | { | 55 | { |
56 | public: | 56 | public: |
57 | enum FilterSpec { Dirs = 0x001, | 57 | enum FilterSpec { Dirs = 0x001, |
58 | Files = 0x002, | 58 | Files = 0x002, |
59 | Drives = 0x004, | 59 | Drives = 0x004, |
60 | NoSymLinks = 0x008, | 60 | NoSymLinks = 0x008, |
61 | All = 0x007, | 61 | All = 0x007, |
62 | TypeMask = 0x00F, | 62 | TypeMask = 0x00F, |
63 | 63 | ||
64 | Readable = 0x010, | 64 | Readable = 0x010, |
65 | Writable = 0x020, | 65 | Writable = 0x020, |
66 | Executable = 0x040, | 66 | Executable = 0x040, |
67 | RWEMask = 0x070, | 67 | RWEMask = 0x070, |
68 | 68 | ||
69 | Modified = 0x080, | 69 | Modified = 0x080, |
70 | Hidden = 0x100, | 70 | Hidden = 0x100, |
71 | System = 0x200, | 71 | System = 0x200, |
72 | AccessMask = 0x3F0, | 72 | AccessMask = 0x3F0, |
73 | 73 | ||
74 | DefaultFilter = -1 }; | 74 | DefaultFilter = -1 }; |
75 | 75 | ||
76 | enum SortSpec { Name = 0x00, | 76 | enum SortSpec { Name = 0x00, |
77 | Time = 0x01, | 77 | Time = 0x01, |
78 | Size = 0x02, | 78 | Size = 0x02, |
79 | Unsorted = 0x03, | 79 | Unsorted = 0x03, |
80 | SortByMask = 0x03, | 80 | SortByMask = 0x03, |
81 | 81 | ||
82 | DirsFirst = 0x04, | 82 | DirsFirst = 0x04, |
83 | Reversed = 0x08, | 83 | Reversed = 0x08, |
84 | IgnoreCase = 0x10, | 84 | IgnoreCase = 0x10, |
85 | DefaultSort = -1 }; | 85 | DefaultSort = -1 }; |
86 | 86 | ||
87 | QDir(); | 87 | QDir(); |
88 | QDir( const QString &path, const QString &nameFilter = QString::null, | 88 | QDir( const QString &path, const QString &nameFilter = QString::null, |
89 | int sortSpec = Name | IgnoreCase, int filterSpec = All ); | 89 | int sortSpec = Name | IgnoreCase, int filterSpec = All ); |
90 | QDir( const QDir & ); | 90 | QDir( const QDir & ); |
91 | 91 | ||
92 | virtual ~QDir(); | 92 | virtual ~QDir(); |
93 | 93 | ||
94 | QDir &operator=( const QDir & ); | 94 | QDir &operator=( const QDir & ); |
95 | QDir &operator=( const QString &path ); | 95 | QDir &operator=( const QString &path ); |
96 | 96 | ||
97 | virtual void setPath( const QString &path ); | 97 | virtual void setPath( const QString &path ); |
98 | virtual QString path() const; | 98 | virtual QString path() const; |
99 | virtual QString absPath()const; | 99 | virtual QString absPath()const; |
100 | virtual QString canonicalPath()const; | 100 | virtual QString canonicalPath()const; |
101 | 101 | ||
102 | virtual QString dirName() const; | 102 | virtual QString dirName() const; |
103 | virtual QString filePath( const QString &fileName, | 103 | virtual QString filePath( const QString &fileName, |
104 | bool acceptAbsPath = TRUE ) const; | 104 | bool acceptAbsPath = TRUE ) const; |
105 | virtual QString absFilePath( const QString &fileName, | 105 | virtual QString absFilePath( const QString &fileName, |
106 | bool acceptAbsPath = TRUE ) const; | 106 | bool acceptAbsPath = TRUE ) const; |
107 | 107 | ||
108 | static QString convertSeparators( const QString &pathName ); | 108 | static QString convertSeparators( const QString &pathName ); |
109 | 109 | ||
110 | virtual bool cd( const QString &dirName, bool acceptAbsPath = TRUE ); | 110 | virtual bool cd( const QString &dirName, bool acceptAbsPath = TRUE ); |
111 | virtual bool cdUp(); | 111 | virtual bool cdUp(); |
112 | 112 | ||
113 | QStringnameFilter() const; | 113 | QStringnameFilter() const; |
114 | virtual void setNameFilter( const QString &nameFilter ); | 114 | virtual void setNameFilter( const QString &nameFilter ); |
115 | FilterSpec filter() const; | 115 | FilterSpec filter() const; |
116 | virtual void setFilter( int filterSpec ); | 116 | virtual void setFilter( int filterSpec ); |
117 | SortSpec sorting() const; | 117 | SortSpec sorting() const; |
118 | virtual void setSorting( int sortSpec ); | 118 | virtual void setSorting( int sortSpec ); |
119 | 119 | ||
120 | boolmatchAllDirs() const; | 120 | boolmatchAllDirs() const; |
121 | virtual void setMatchAllDirs( bool ); | 121 | virtual void setMatchAllDirs( bool ); |
122 | 122 | ||
123 | uint count() const; | 123 | uint count() const; |
124 | QStringoperator[]( int ) const; | 124 | QStringoperator[]( int ) const; |
125 | 125 | ||
126 | virtual QStrList encodedEntryList( int filterSpec = DefaultFilter, | 126 | virtual QStrList encodedEntryList( int filterSpec = DefaultFilter, |
127 | int sortSpec = DefaultSort ) const; | 127 | int sortSpec = DefaultSort ) const; |
128 | virtual QStrList encodedEntryList( const QString &nameFilter, | 128 | virtual QStrList encodedEntryList( const QString &nameFilter, |
129 | int filterSpec = DefaultFilter, | 129 | int filterSpec = DefaultFilter, |
130 | int sortSpec = DefaultSort ) const; | 130 | int sortSpec = DefaultSort ) const; |
131 | virtual QStringList entryList( int filterSpec = DefaultFilter, | 131 | virtual QStringList entryList( int filterSpec = DefaultFilter, |
132 | int sortSpec = DefaultSort ) const; | 132 | int sortSpec = DefaultSort ) const; |
133 | virtual QStringList entryList( const QString &nameFilter, | 133 | virtual QStringList entryList( const QString &nameFilter, |
134 | int filterSpec = DefaultFilter, | 134 | int filterSpec = DefaultFilter, |
135 | int sortSpec = DefaultSort ) const; | 135 | int sortSpec = DefaultSort ) const; |
136 | 136 | ||
137 | virtual const QFileInfoList *entryInfoList( int filterSpec = DefaultFilter, | 137 | virtual const QFileInfoList *entryInfoList( int filterSpec = DefaultFilter, |
138 | int sortSpec = DefaultSort ) const; | 138 | int sortSpec = DefaultSort ) const; |
139 | virtual const QFileInfoList *entryInfoList( const QString &nameFilter, | 139 | virtual const QFileInfoList *entryInfoList( const QString &nameFilter, |
140 | int filterSpec = DefaultFilter, | 140 | int filterSpec = DefaultFilter, |
141 | int sortSpec = DefaultSort ) const; | 141 | int sortSpec = DefaultSort ) const; |
142 | 142 | ||
143 | static const QFileInfoList *drives(); | 143 | static const QFileInfoList *drives(); |
144 | 144 | ||
145 | virtual bool mkdir( const QString &dirName, | 145 | virtual bool mkdir( const QString &dirName, |
146 | bool acceptAbsPath = TRUE ) const; | 146 | bool acceptAbsPath = TRUE ) const; |
147 | virtual bool rmdir( const QString &dirName, | 147 | virtual bool rmdir( const QString &dirName, |
148 | bool acceptAbsPath = TRUE ) const; | 148 | bool acceptAbsPath = TRUE ) const; |
149 | 149 | ||
150 | virtual bool isReadable() const; | 150 | virtual bool isReadable() const; |
151 | virtual bool exists() const; | 151 | virtual bool exists() const; |
152 | virtual bool isRoot() const; | 152 | virtual bool isRoot() const; |
153 | 153 | ||
154 | virtual bool isRelative() const; | 154 | virtual bool isRelative() const; |
155 | virtual void convertToAbs(); | 155 | virtual void convertToAbs(); |
156 | 156 | ||
157 | virtual bool operator==( const QDir & ) const; | 157 | virtual bool operator==( const QDir & ) const; |
158 | virtual bool operator!=( const QDir & ) const; | 158 | virtual bool operator!=( const QDir & ) const; |
159 | 159 | ||
160 | virtual bool remove( const QString &fileName, | 160 | virtual bool remove( const QString &fileName, |
161 | bool acceptAbsPath = TRUE ); | 161 | bool acceptAbsPath = TRUE ); |
162 | virtual bool rename( const QString &name, const QString &newName, | 162 | virtual bool rename( const QString &name, const QString &newName, |
163 | bool acceptAbsPaths = TRUE ); | 163 | bool acceptAbsPaths = TRUE ); |
164 | virtual bool exists( const QString &name, | 164 | virtual bool exists( const QString &name, |
165 | bool acceptAbsPath = TRUE ); | 165 | bool acceptAbsPath = TRUE ); |
166 | 166 | ||
167 | static char separator(); | 167 | static char separator(); |
168 | 168 | ||
169 | static bool setCurrent( const QString &path ); | 169 | static bool setCurrent( const QString &path ); |
170 | static QDir current(); | 170 | static QDir current(); |
171 | static QDir home(); | 171 | static QDir home(); |
172 | static QDir root(); | 172 | static QDir root(); |
173 | static QString currentDirPath(); | 173 | static QString currentDirPath(); |
174 | static QString homeDirPath(); | 174 | static QString homeDirPath(); |
175 | static QString rootDirPath(); | 175 | static QString rootDirPath(); |
176 | 176 | ||
177 | static bool match( const QStringList &filters, const QString &fileName ); | 177 | static bool match( const QStringList &filters, const QString &fileName ); |
178 | static bool match( const QString &filter, const QString &fileName ); | 178 | static bool match( const QString &filter, const QString &fileName ); |
179 | static QString cleanDirPath( const QString &dirPath ); | 179 | static QString cleanDirPath( const QString &dirPath ); |
180 | static bool isRelativePath( const QString &path ); | 180 | static bool isRelativePath( const QString &path ); |
181 | void refresh() const; | ||
181 | 182 | ||
182 | private: | 183 | private: |
183 | #ifdef Q_OS_MAC | 184 | #ifdef Q_OS_MAC |
184 | typedef struct FSSpec FSSpec; | 185 | typedef struct FSSpec FSSpec; |
185 | static FSSpec *make_spec(const QString &); | 186 | static FSSpec *make_spec(const QString &); |
186 | #endif | 187 | #endif |
187 | void init(); | 188 | void init(); |
188 | virtual bool readDirEntries( const QString &nameFilter, | 189 | virtual bool readDirEntries( const QString &nameFilter, |
189 | int FilterSpec, int SortSpec ); | 190 | int FilterSpec, int SortSpec ); |
190 | 191 | ||
191 | static void slashify ( QString &); | 192 | static void slashify( QString & ); |
192 | 193 | ||
193 | QStringdPath; | 194 | QStringdPath; |
194 | QStringList *fList; | 195 | QStringList *fList; |
195 | QFileInfoList *fiList; | 196 | QFileInfoList *fiList; |
196 | QStringnameFilt; | 197 | QStringnameFilt; |
197 | FilterSpecfiltS; | 198 | FilterSpecfiltS; |
198 | SortSpecsortS; | 199 | SortSpecsortS; |
199 | uint dirty: 1; | 200 | uint dirty: 1; |
200 | uintallDirs : 1; | 201 | uintallDirs : 1; |
201 | }; | 202 | }; |
202 | 203 | ||
203 | 204 | ||
204 | inline QString QDir::path() const | 205 | inline QString QDir::path() const |
205 | { | 206 | { |
206 | return dPath; | 207 | return dPath; |
207 | } | 208 | } |
208 | 209 | ||
209 | inline QString QDir::nameFilter() const | 210 | inline QString QDir::nameFilter() const |
210 | { | 211 | { |
211 | return nameFilt; | 212 | return nameFilt; |
212 | } | 213 | } |
213 | 214 | ||
214 | inline QDir::FilterSpec QDir::filter() const | 215 | inline QDir::FilterSpec QDir::filter() const |
215 | { | 216 | { |
216 | return filtS; | 217 | return filtS; |
217 | } | 218 | } |
218 | 219 | ||
219 | inline QDir::SortSpec QDir::sorting() const | 220 | inline QDir::SortSpec QDir::sorting() const |
220 | { | 221 | { |
221 | return sortS; | 222 | return sortS; |
222 | } | 223 | } |
223 | 224 | ||
224 | inline bool QDir::matchAllDirs() const | 225 | inline bool QDir::matchAllDirs() const |
225 | { | 226 | { |
226 | return allDirs; | 227 | return allDirs; |
227 | } | 228 | } |
228 | 229 | ||
229 | inline bool QDir::operator!=( const QDir &d ) const | 230 | inline bool QDir::operator!=( const QDir &d ) const |
230 | { | 231 | { |
231 | return !(*this == d); | 232 | return !(*this == d); |
232 | } | 233 | } |
233 | 234 | ||
234 | 235 | ||
235 | struct QDirSortItem { | 236 | struct QDirSortItem { |
236 | QString filename_cache; | 237 | QString filename_cache; |
237 | QFileInfo* item; | 238 | QFileInfo* item; |
238 | }; | 239 | }; |
239 | 240 | ||
240 | #endif // QT_NO_DIR | 241 | #endif // QT_NO_DIR |
241 | #endif // QDIR_H | 242 | #endif // QDIR_H |