X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1678ad780265f08fc8b84d180c04ae3a9900b1bb..0acb94947f39951a1688bbaa57d3a4bf5be40dbb:/include/wx/file.h diff --git a/include/wx/file.h b/include/wx/file.h index 72451f8608..656ae52585 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -17,18 +17,15 @@ #pragma interface "file.h" #endif -#include "wx/string.h" -#include "wx/filefn.h" +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/filefn.h" +#endif // ---------------------------------------------------------------------------- -<<<<<<< file.h -======= // constants // ---------------------------------------------------------------------------- -// error return value for Seek() functions -const off_t ofsInvalid = (off_t)-1; - // we redefine these constants here because S_IREAD &c are _not_ standard // however, we do assume that the values correspond to the Unix umask bits #define wxS_IRUSR 00400 @@ -44,10 +41,10 @@ const off_t ofsInvalid = (off_t)-1; #define wxS_IXOTH 00001 // default mode for the new files: corresponds to umask 022 -#define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IROTH) +#define wxS_DEFAULT (wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IWGRP |\ + wxS_IROTH | wxS_IWOTH) // ---------------------------------------------------------------------------- ->>>>>>> 1.7 // class wxFile: raw file IO // // NB: for space efficiency this class has no virtual functions, including @@ -58,7 +55,6 @@ class WXDLLEXPORT wxFile public: // more file constants // ------------------- - // opening mode enum OpenMode { read, write, read_write, write_append }; // standard values for file descriptor @@ -66,7 +62,11 @@ public: // static functions // ---------------- - static bool Exists(const char *sz); // also checks it's a regular file + // check whether a regular file by this name exists + static bool Exists(const char *name); + // check whetther we can access the given file in given mode + // (only read and write make sense here) + static bool Access(const char *name, OpenMode mode); // ctors // ----- @@ -78,11 +78,6 @@ public: wxFile(int fd) { m_fd = fd; } // open/close -<<<<<<< file.h - bool Create(const char *szFileName, bool bOverwrite = FALSE); - bool Open(const char *szFileName, OpenMode mode = read); - inline bool Close(); // Close is a NOP if not opened -======= // create a new file (with the default value of bOverwrite, it will fail if // the file already exists, otherwise it will overwrite it and succeed) bool Create(const char *szFileName, bool bOverwrite = FALSE, @@ -90,7 +85,6 @@ public: bool Open(const char *szFileName, OpenMode mode = read, int access = wxS_DEFAULT); bool Close(); // Close is a NOP if not opened ->>>>>>> 1.7 // assign an existing file descriptor and get it back from wxFile object void Attach(int fd) { Close(); m_fd = fd; } @@ -126,7 +120,7 @@ public: bool Error() const { return m_error; } // dtor closes the file if opened - ~wxFile(); + virtual ~wxFile(); // Temporally virtual because of wxFileStream: I'll change back in a near future. private: // copy ctor and assignment operator are private because