add wxPosixPermissions enumeration; it provides more readable synonims for wxS_I* flags and makes it easier to document which flags can be used in wxFile functions and wxFileName::Mkdir (and in future wxFileName::Chmod); part of commmit 55908

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-09-27 10:28:43 +00:00
parent f41d6c8cd7
commit a18d02ecd2
2 changed files with 42 additions and 16 deletions

View File

@@ -27,23 +27,48 @@
// 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
#define wxS_IWUSR 00200
#define wxS_IXUSR 00100
enum wxPosixPermissions
{
// standard Posix names for these permission flags:
wxS_IRUSR = 00400,
wxS_IWUSR = 00200,
wxS_IXUSR = 00100,
#define wxS_IRGRP 00040
#define wxS_IWGRP 00020
#define wxS_IXGRP 00010
wxS_IRGRP = 00040,
wxS_IWGRP = 00020,
wxS_IXGRP = 00010,
#define wxS_IROTH 00004
#define wxS_IWOTH 00002
#define wxS_IXOTH 00001
wxS_IROTH = 00004,
wxS_IWOTH = 00002,
wxS_IXOTH = 00001,
// default mode for the new files: allow reading/writing them to everybody but
// the effective file mode will be set after anding this value with umask and
// so won't include wxS_IW{GRP,OTH} for the default 022 umask value
#define wxS_DEFAULT \
(wxS_IRUSR | wxS_IWUSR | wxS_IRGRP | wxS_IWGRP | wxS_IROTH | wxS_IWOTH)
// longer but more readable synonims for the constants above:
wxPOSIX_USER_READ = wxS_IRUSR,
wxPOSIX_USER_WRITE = wxS_IWUSR,
wxPOSIX_USER_EXECUTE = wxS_IXUSR,
wxPOSIX_GROUP_READ = wxS_IRGRP,
wxPOSIX_GROUP_WRITE = wxS_IWGRP,
wxPOSIX_GROUP_EXECUTE = wxS_IXGRP,
wxPOSIX_OTHERS_READ = wxS_IROTH,
wxPOSIX_OTHERS_WRITE = wxS_IWOTH,
wxPOSIX_OTHERS_EXECUTE = wxS_IXOTH,
// default mode for the new files: allow reading/writing them to everybody but
// the effective file mode will be set after anding this value with umask and
// so won't include wxS_IW{GRP,OTH} for the default 022 umask value
wxS_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | \
wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | \
wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE),
// default mode for the new directories (see wxFileName::Mkdir): allow
// reading/writing/executing them to everybody, but just like wxS_DEFAULT
// the effective directory mode will be set after anding this value with umask
wxS_DIR_DEFAULT = (wxPOSIX_USER_READ | wxPOSIX_USER_WRITE | wxPOSIX_USER_EXECUTE | \
wxPOSIX_GROUP_READ | wxPOSIX_GROUP_WRITE | wxPOSIX_GROUP_EXECUTE | \
wxPOSIX_OTHERS_READ | wxPOSIX_OTHERS_WRITE | wxPOSIX_OTHERS_EXECUTE)
};
// ----------------------------------------------------------------------------
// class wxFile: raw file IO

View File

@@ -28,6 +28,7 @@
#include "wx/datetime.h"
#include "wx/intl.h"
#include "wx/longlong.h"
#include "wx/file.h"
#if wxUSE_FILE
class WXDLLIMPEXP_FWD_BASE wxFile;
@@ -308,8 +309,8 @@ public:
#endif // wxUSE_FFILE
// directory creation and removal.
bool Mkdir( int perm = 0777, int flags = 0);
static bool Mkdir( const wxString &dir, int perm = 0777, int flags = 0 );
bool Mkdir( int perm = wxS_DIR_DEFAULT, int flags = 0);
static bool Mkdir( const wxString &dir, int perm = wxS_DIR_DEFAULT, int flags = 0 );
bool Rmdir();
static bool Rmdir( const wxString &dir );