Orb/Doxygen/qtools/qfiledefs_p.h
changeset 0 42188c7ea2d9
equal deleted inserted replaced
-1:000000000000 0:42188c7ea2d9
       
     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 # define STATBUF	struct stat
       
   194 # define STATBUF4TSTAT	struct stat
       
   195 # define STAT		::stat
       
   196 # define FSTAT		::fstat
       
   197 # define STAT_REG	S_IFREG
       
   198 # define STAT_DIR	S_IFDIR
       
   199 # define STAT_MASK	S_IFMT
       
   200 # if defined(S_IFLNK)
       
   201 #  define STAT_LNK	S_IFLNK
       
   202 # endif
       
   203 # define FILENO		fileno
       
   204 # define OPEN		::open
       
   205 # define CLOSE		::close
       
   206 # define LSEEK		::lseek
       
   207 # define READ		::read
       
   208 # define WRITE		::write
       
   209 # define ACCESS		::access
       
   210 # if defined(_OS_OS2EMX_)
       
   211 #  define GETCWD	::_getcwd2
       
   212 #  define CHDIR		::_chdir2
       
   213 # else
       
   214 #  define GETCWD	::getcwd
       
   215 #  define CHDIR		::chdir
       
   216 # endif
       
   217 # define MKDIR		::mkdir
       
   218 # define RMDIR		::rmdir
       
   219 # define OPEN_RDONLY	O_RDONLY
       
   220 # define OPEN_WRONLY	O_WRONLY
       
   221 # define OPEN_RDWR	O_RDWR
       
   222 # define OPEN_CREAT	O_CREAT
       
   223 # define OPEN_TRUNC	O_TRUNC
       
   224 # define OPEN_APPEND	O_APPEND
       
   225 # if defined(O_TEXT)
       
   226 #  define OPEN_TEXT	O_TEXT
       
   227 #  define OPEN_BINARY	O_BINARY
       
   228 # endif
       
   229 #endif
       
   230 
       
   231 #if defined(_CC_MWERKS_)
       
   232 #undef mkdir
       
   233 #undef MKDIR
       
   234 #define MKDIR _mkdir
       
   235 #undef rmdir
       
   236 #undef RMDIR
       
   237 #define RMDIR _rmdir
       
   238 #endif
       
   239 
       
   240 
       
   241 #if defined(_OS_FATFS_)
       
   242 # define F_OK	0
       
   243 # define X_OK	1
       
   244 # define W_OK	2
       
   245 # define R_OK	4
       
   246 #endif
       
   247 
       
   248 #if defined(_OS_MAC_) && !defined(_OS_UNIX_)
       
   249 # define F_OK	0
       
   250 # define X_OK	1
       
   251 # define W_OK	2
       
   252 # define R_OK	4
       
   253 #endif
       
   254 
       
   255 struct QFileInfoCache
       
   256 {
       
   257     STATBUF st;
       
   258     bool isSymLink;
       
   259 };
       
   260 
       
   261 #endif