X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/df5168c427b51f1ab2b3200a5c8f7626b3d24aae..f5e0b4bc7c729ff41e66fb7894fb1387f860bdb2:/include/wx/filefn.h?ds=sidebyside diff --git a/include/wx/filefn.h b/include/wx/filefn.h index 3f00a7404f..928f608573 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -12,11 +12,12 @@ #ifndef _FILEFN_H_ #define _FILEFN_H_ -#if defined(__GNUG__) && !defined(__APPLE__) +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma interface "filefn.h" #endif #include "wx/list.h" +#include "wx/arrstr.h" #ifndef __WXWINCE__ #include @@ -39,8 +40,6 @@ #if defined(__VISUALC__) || ( defined(__MWERKS__) && defined( __INTEL__) ) typedef _off_t off_t; -#elif defined(__BORLANDC__) && defined(__WIN16__) - typedef long off_t; #elif defined(__SYMANTEC__) typedef long off_t; #elif defined(__MWERKS__) && !defined(__INTEL__) && !defined(__MACH__) @@ -74,9 +73,11 @@ enum wxSeekMode // Microsoft compiler loves underscores, feed them to it #if defined( __VISUALC__ ) \ || ( defined(__MINGW32__) && !defined(__WINE__) && wxCHECK_W32API_VERSION( 0, 5 ) ) \ - || ( defined(__MWERKS__) && defined(__WXMSW__) ) + || ( defined(__MWERKS__) && defined(__WXMSW__) ) \ + || ( defined(__DMC__) && defined(__WXMSW__) ) \ + || ( defined(__WATCOMC__) && defined(__WXMSW__) ) // functions -#ifdef __BORLANDC__ +#if defined(__BORLANDC__) || defined(__WATCOMC__) #define _tell tell #endif #define wxClose _close @@ -91,7 +92,7 @@ enum wxSeekMode #if wxUSE_UNICODE #if wxUSE_UNICODE_MSLU #define wxOpen wxMSLU__wopen - + #define wxAccess wxMSLU__waccess #define wxMkDir wxMSLU__wmkdir #define wxRmDir wxMSLU__wrmdir @@ -111,15 +112,23 @@ enum wxSeekMode #endif #define wxAccess _access #define wxMkDir _mkdir +#ifdef __WATCOMC__ + #define wxRmDir rmdir +#else #define wxRmDir _rmdir +#endif #define wxStat _stat #endif // types +#if defined(__WATCOMC__)&& wxUSE_UNICODE + #define wxStructStat struct _wstat +#else #define wxStructStat struct _stat +#endif // constants (unless already defined by the user code) - #if !defined(O_RDONLY) && !defined(__BORLANDC__) + #if !defined(O_RDONLY) && !defined(__BORLANDC__) && !defined(__WATCOMC__) #define O_RDONLY _O_RDONLY #define O_WRONLY _O_WRONLY #define O_RDWR _O_RDWR @@ -128,7 +137,7 @@ enum wxSeekMode #define O_BINARY _O_BINARY #endif - #ifndef __BORLANDC__ + #if !defined(__BORLANDC__) && !defined(__WATCOMC__) #define S_IFMT _S_IFMT #define S_IFDIR _S_IFDIR #define S_IFREG _S_IFREG @@ -148,18 +157,15 @@ enum wxSeekMode #define wxTell(fd) lseek(fd, 0, SEEK_CUR) #define wxStructStat struct stat - + #if wxUSE_UNICODE # define wxNEED_WX_UNISTD_H #if defined(__MWERKS__) && defined(macintosh) - #include + #include +#endif +#if defined(__DMC__) + typedef unsigned long mode_t; #endif -WXDLLIMPEXP_BASE int wxStat( const wxChar *file_name, wxStructStat *buf ); -WXDLLIMPEXP_BASE int wxAccess( const wxChar *pathname, int mode ); -WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode ); -#else -#if defined(__WXMAC__) && !defined(__DARWIN__) -#include WXDLLIMPEXP_BASE int wxStat( const wxChar *file_name, wxStructStat *buf ); WXDLLIMPEXP_BASE int wxAccess( const wxChar *pathname, int mode ); WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode ); @@ -168,7 +174,6 @@ WXDLLIMPEXP_BASE int wxOpen( const wxChar *pathname, int flags, mode_t mode ); #define wxStat stat #define wxAccess access #endif -#endif #endif // VC++ @@ -232,16 +237,16 @@ WXDLLIMPEXP_BASE wxString wxFindNextFile(); WXDLLIMPEXP_BASE bool wxIsWild(const wxString& pattern); // Does the pattern match the text (usually a filename)? -// If dot_special is TRUE, doesn't match * against . (eliminating +// If dot_special is true, doesn't match * against . (eliminating // `hidden' dot files) -WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = TRUE); +WXDLLIMPEXP_BASE bool wxMatchWild(const wxString& pattern, const wxString& text, bool dot_special = true); // Concatenate two files to form third WXDLLIMPEXP_BASE bool wxConcatFiles(const wxString& file1, const wxString& file2, const wxString& file3); // Copy file1 to file2 WXDLLIMPEXP_BASE bool wxCopyFile(const wxString& file1, const wxString& file2, - bool overwrite = TRUE); + bool overwrite = true); // Remove file WXDLLIMPEXP_BASE bool wxRemoveFile(const wxString& file); @@ -271,16 +276,6 @@ WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); // compatibility defines, don't use in new code #define wxDirExists wxPathExists -#if WXWIN_COMPATIBILITY_2 - #define FileExists wxFileExists - #define DirExists wxDirExists - #define IsAbsolutePath wxIsAbsolutePath - #define FileNameFromPath wxFileNameFromPath - #define PathOnly wxPathOnly - #define Dos2UnixFilename wxDos2UnixFilename - #define Unix2DosFilename wxUnix2DosFilename -#endif - // ---------------------------------------------------------------------------- // separators in file names // ---------------------------------------------------------------------------- @@ -306,15 +301,13 @@ WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); #define wxPATH_SEP_MAC wxT(";") // platform independent versions -#if defined(__UNIX__) && !defined(__CYGWIN__) +#if defined(__UNIX__) && !defined(__OS2__) + // CYGWIN also uses UNIX settings #define wxFILE_SEP_PATH wxFILE_SEP_PATH_UNIX #define wxPATH_SEP wxPATH_SEP_UNIX #elif defined(__MAC__) #define wxFILE_SEP_PATH wxFILE_SEP_PATH_MAC #define wxPATH_SEP wxPATH_SEP_MAC -#elif defined(__CYGWIN__) // Cygwin - #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS - #define wxPATH_SEP wxPATH_SEP_UNIX #else // Windows and OS/2 #define wxFILE_SEP_PATH wxFILE_SEP_PATH_DOS #define wxPATH_SEP wxPATH_SEP_DOS @@ -322,17 +315,17 @@ WXDLLIMPEXP_BASE bool wxRmdir(const wxString& dir, int flags = 0); // this is useful for wxString::IsSameAs(): to compare two file names use // filename1.IsSameAs(filename2, wxARE_FILENAMES_CASE_SENSITIVE) -#if defined(__UNIX__) && !defined(__DARWIN__) - #define wxARE_FILENAMES_CASE_SENSITIVE TRUE +#if defined(__UNIX__) && !defined(__DARWIN__) && !defined(__OS2__) + #define wxARE_FILENAMES_CASE_SENSITIVE true #else // Windows, Mac OS and OS/2 - #define wxARE_FILENAMES_CASE_SENSITIVE FALSE + #define wxARE_FILENAMES_CASE_SENSITIVE false #endif // Unix/Windows // is the char a path separator? inline bool wxIsPathSeparator(wxChar c) { // under DOS/Windows we should understand both Unix and DOS file separators -#if defined(__UNIX__) || defined(__MAC__) +#if ( defined(__UNIX__) && !defined(__OS2__) )|| defined(__MAC__) return c == wxFILE_SEP_PATH; #else return c == wxFILE_SEP_PATH_DOS || c == wxFILE_SEP_PATH_UNIX; @@ -359,6 +352,13 @@ WXDLLIMPEXP_BASE wxString wxGetOSDirectory(); // Get file modification time WXDLLIMPEXP_BASE time_t wxFileModificationTime(const wxString& filename); +// Parses the wildCard, returning the number of filters. +// Returns 0 if none or if there's a problem, +// The arrays will contain an equal number of items found before the error. +// wildCard is in the form: +// "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png" +WXDLLIMPEXP_BASE int wxParseCommonDialogsFilter(const wxString& wildCard, wxArrayString& descriptions, wxArrayString& filters); + // ---------------------------------------------------------------------------- // classes // ---------------------------------------------------------------------------- @@ -381,7 +381,7 @@ public: wxString FindAbsoluteValidPath(const wxString& filename); // Given full path and filename, add path to list void EnsureFileAccessible(const wxString& path); - // Returns TRUE if the path is in the list + // Returns true if the path is in the list bool Member(const wxString& path); private: