qfiledefs_p.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 **
4 ** Common macros and system include files for QFile, QFileInfo and QDir.
5 **
6 ** Created : 930812
7 **
8 ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9 **
10 ** This file is part of the tools module of the Qt GUI Toolkit.
11 **
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
14 ** LICENSE.QPL included in the packaging of this file.
15 **
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
18 ** Foundation and appearing in the file LICENSE.GPL included in the
19 ** packaging of this file.
20 **
21 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22 ** licenses may use this file in accordance with the Qt Commercial License
23 ** Agreement provided with the Software.
24 **
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.
27 **
28 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29 ** information about Qt Commercial License Agreements.
30 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
31 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
32 **
33 ** Contact info@trolltech.com if any conditions of this licensing are
34 ** not clear to you.
35 **
36 **********************************************************************/
37 
38 #ifndef QFILEDEFS_P_H
39 #define QFILEDEFS_P_H
40 
41 
42 //
43 // W A R N I N G
44 // -------------
45 //
46 // This file is not part of the Qt API. It exists for the convenience
47 // of qfile.cpp, qfileinfo.cpp and qdir.cpp.
48 // This header file may change from version to version without notice,
49 // or even be removed.
50 //
51 //
52 #if defined(_CC_MWERKS_)
53 # include <stdlib.h>
54 # include <stat.h>
55 #elif !defined(_OS_MAC_)
56 # include <sys/types.h>
57 # include <sys/stat.h>
58 #elif defined(_OS_MAC_)
59 # include <sys/types.h>
60 # include <sys/stat.h>
61 # define _OS_UNIX_
62 #endif
63 #include <fcntl.h>
64 #include <errno.h>
65 #if defined(_OS_UNIX_)
66 # include <dirent.h>
67 # include <unistd.h>
68 #endif
69 #if defined(_OS_MSDOS_) || defined(_OS_WIN32_) || defined(_OS_OS2_)
70 # define _OS_FATFS_
71 # if defined(__CYGWIN32__)
72 # include <dirent.h>
73 # include <unistd.h>
74 # if !defined(_OS_UNIX_)
75 # define _OS_UNIX_
76 # endif
77 # else
78 # include <io.h>
79 # if !defined(_CC_MWERKS_)
80 # include <dos.h>
81 # endif
82 # include <direct.h>
83 # endif
84 #endif
85 #include <limits.h>
86 
87 
88 #if !defined(PATH_MAX)
89 #if defined( MAXPATHLEN )
90 #define PATH_MAX MAXPATHLEN
91 #else
92 #define PATH_MAX 1024
93 #endif
94 #endif
95 
96 
97 #undef STATBUF
98 #undef STAT
99 #undef STAT_REG
100 #undef STAT_DIR
101 #undef STAT_LNK
102 #undef STAT_MASK
103 #undef FILENO
104 #undef OPEN
105 #undef CLOSE
106 #undef LSEEK
107 #undef READ
108 #undef WRITE
109 #undef ACCESS
110 #undef GETCWD
111 #undef CHDIR
112 #undef MKDIR
113 #undef RMDIR
114 #undef OPEN_RDONLY
115 #undef OPEN_WRONLY
116 #undef OPEN_CREAT
117 #undef OPEN_TRUNC
118 #undef OPEN_APPEND
119 #undef OPEN_TEXT
120 #undef OPEN_BINARY
121 
122 
123 #if defined(_CC_MSVC_) || defined(_CC_SYM_)
124 
125 # define STATBUF struct _stat // non-ANSI defs
126 # define STATBUF4TSTAT struct _stat // non-ANSI defs
127 # define STAT ::_stat
128 # define FSTAT ::_fstat
129 # define STAT_REG _S_IFREG
130 # define STAT_DIR _S_IFDIR
131 # define STAT_MASK _S_IFMT
132 # if defined(_S_IFLNK)
133 # define STAT_LNK _S_IFLNK
134 # endif
135 # define FILENO _fileno
136 # define OPEN ::_open
137 # define CLOSE ::_close
138 # define LSEEK ::_lseek
139 # define READ ::_read
140 # define WRITE ::_write
141 # define ACCESS ::_access
142 # define GETCWD ::_getcwd
143 # define CHDIR ::_chdir
144 # define MKDIR ::_mkdir
145 # define RMDIR ::_rmdir
146 # define OPEN_RDONLY _O_RDONLY
147 # define OPEN_WRONLY _O_WRONLY
148 # define OPEN_RDWR _O_RDWR
149 # define OPEN_CREAT _O_CREAT
150 # define OPEN_TRUNC _O_TRUNC
151 # define OPEN_APPEND _O_APPEND
152 # if defined(O_TEXT)
153 # define OPEN_TEXT _O_TEXT
154 # define OPEN_BINARY _O_BINARY
155 # endif
156 
157 #elif defined(_CC_BOR_) && __BORLANDC__ >= 0x550
158 
159 # define STATBUF struct stat // non-ANSI defs
160 # define STATBUF4TSTAT struct _stat // non-ANSI defs
161 # define STAT ::stat
162 # define FSTAT ::fstat
163 # define STAT_REG _S_IFREG
164 # define STAT_DIR _S_IFDIR
165 # define STAT_MASK _S_IFMT
166 # if defined(_S_IFLNK)
167 # define STAT_LNK _S_IFLNK
168 # endif
169 # define FILENO _fileno
170 # define OPEN ::open
171 # define CLOSE ::_close
172 # define LSEEK ::_lseek
173 # define READ ::_read
174 # define WRITE ::_write
175 # define ACCESS ::_access
176 # define GETCWD ::_getcwd
177 # define CHDIR ::chdir
178 # define MKDIR ::_mkdir
179 # define RMDIR ::_rmdir
180 # define OPEN_RDONLY _O_RDONLY
181 # define OPEN_WRONLY _O_WRONLY
182 # define OPEN_RDWR _O_RDWR
183 # define OPEN_CREAT _O_CREAT
184 # define OPEN_TRUNC _O_TRUNC
185 # define OPEN_APPEND _O_APPEND
186 # if defined(O_TEXT)
187 # define OPEN_TEXT _O_TEXT
188 # define OPEN_BINARY _O_BINARY
189 # endif
190 
191 #else // all other systems
192 
193 #ifdef __MINGW32__
194 # define STATBUF struct _stat
195 # define STATBUF4TSTAT struct _stat
196 # define STAT _stat
197 # define FSTAT _fstat
198 #else
199 # define STATBUF struct stat
200 # define STATBUF4TSTAT struct stat
201 # define STAT ::stat
202 # define FSTAT ::fstat
203 #endif
204 # define STAT_REG S_IFREG
205 # define STAT_DIR S_IFDIR
206 # define STAT_MASK S_IFMT
207 # if defined(S_IFLNK)
208 # define STAT_LNK S_IFLNK
209 # endif
210 # define FILENO fileno
211 # define OPEN ::open
212 # define CLOSE ::close
213 # define LSEEK ::lseek
214 # define READ ::read
215 # define WRITE ::write
216 # define ACCESS ::access
217 # if defined(_OS_OS2EMX_)
218 # define GETCWD ::_getcwd2
219 # define CHDIR ::_chdir2
220 # else
221 # define GETCWD ::getcwd
222 # define CHDIR ::chdir
223 # endif
224 # define MKDIR ::mkdir
225 # define RMDIR ::rmdir
226 # define OPEN_RDONLY O_RDONLY
227 # define OPEN_WRONLY O_WRONLY
228 # define OPEN_RDWR O_RDWR
229 # define OPEN_CREAT O_CREAT
230 # define OPEN_TRUNC O_TRUNC
231 # define OPEN_APPEND O_APPEND
232 # if defined(O_TEXT)
233 # define OPEN_TEXT O_TEXT
234 # define OPEN_BINARY O_BINARY
235 # endif
236 #endif
237 
238 #if defined(_CC_MWERKS_)
239 #undef mkdir
240 #undef MKDIR
241 #define MKDIR _mkdir
242 #undef rmdir
243 #undef RMDIR
244 #define RMDIR _rmdir
245 #endif
246 
247 
248 #if defined(_OS_FATFS_)
249 # define F_OK 0
250 # define X_OK 1
251 # define W_OK 2
252 # define R_OK 4
253 #endif
254 
255 #if defined(_OS_MAC_) && !defined(_OS_UNIX_)
256 # define F_OK 0
257 # define X_OK 1
258 # define W_OK 2
259 # define R_OK 4
260 #endif
261 
263 {
265  bool isSymLink;
266 };
267 
268 #endif
#define STATBUF
Definition: qfiledefs_p.h:199