Permissions Class Reference

File permissions. More...

#include <Permissions.h++>

List of all members.

Public Member Functions

 Permissions (uint_t mask=0) throw ()
 Construct a new Permissions object with the given mask.
 Permissions (const Permissions &other) throw ()
 Copy constructor.
 ~Permissions () throw ()
 Destructor.
bool canUserRead () const throw ()
 Test for user read access.
void setUserRead () throw ()
 Enable user read access.
void clearUserRead () throw ()
 Disable user read access.
bool canUserWrite () const throw ()
 Test for user write access.
void setUserWrite () throw ()
 Enable user write access.
void clearUserWrite () throw ()
 Disable user write access.
bool canUserExecute () const throw ()
 Test for user execute access.
void setUserExecute () throw ()
 Enable user execute access.
void clearUserExecute () throw ()
 Disable user execute access.
bool canGroupRead () const throw ()
 Test for group read access.
void setGroupRead () throw ()
 Enable group read access.
void clearGroupRead () throw ()
 Disable group read access.
bool canGroupWrite () const throw ()
 Test for group write access.
void setGroupWrite () throw ()
 Enable group write access.
void clearGroupWrite () throw ()
 Disable group write access.
bool canGroupExecute () const throw ()
 Test for group execute access.
void setGroupExecute () throw ()
 Enable group execute access.
void clearGroupExecute () throw ()
 Disable group execute access.
bool canOthersRead () const throw ()
 Test for others read access.
void setOthersRead () throw ()
 Enable others read access.
void clearOthersRead () throw ()
 Disable others read access.
bool canOthersWrite () const throw ()
 Test for others write access.
void setOthersWrite () throw ()
 Enable others write access.
void clearOthersWrite () throw ()
 Disable others write access.
bool canOthersExecute () const throw ()
 Test for others execute access.
void setOthersExecute () throw ()
 Enable others execute access.
void clearOthersExecute () throw ()
 Disable others execute access.
void clearAll () throw ()
 Disable all access.
Permissionsoperator= (const Permissions &other) throw ()
 Assignment operator.
uint_t getMask () const throw ()
 Get the permissions mask.
 operator uint_t () throw ()
 Cast operator.
String toString () const
 Get a String representation of the permissions mask.
uint_t operator= (uint_t rhs) throw ()
uint_t operator|= (uint_t rhs) throw ()
uint_t operator&= (uint_t rhs) throw ()

Static Public Attributes

static const int USER_READ = S_IRUSR
 User read mask.
static const int USER_WRITE = S_IWUSR
 User write mask.
static const int USER_READ_WRITE = (S_IRUSR | S_IWUSR)
 User read and write mask.
static const int USER_EXECUTE = S_IXUSR
 User execute mask.
static const int USER_ALL = (S_IRUSR | S_IWUSR | S_IXUSR)
 User (all permissions) mask.
static const int GROUP_READ = S_IRGRP
 Group read mask.
static const int GROUP_WRITE = S_IWGRP
 Group write mask.
static const int GROUP_READ_WRITE = (S_IRGRP | S_IWGRP)
 Group read and write mask.
static const int GROUP_EXECUTE = S_IXGRP
 Group execute mask.
static const int GROUP_ALL = (S_IRGRP | S_IWGRP | S_IXGRP)
 Group (all permissions) mask.
static const int OTHERS_READ = S_IROTH
 Others read mask.
static const int OTHERS_WRITE = S_IWOTH
 Others write mask.
static const int OTHERS_READ_WRITE = (S_IROTH | S_IWOTH)
 Others read and write mask.
static const int OTHERS_EXECUTE = S_IXOTH
 Others execute mask.
static const int OTHERS_ALL = (S_IROTH | S_IWOTH | S_IXOTH)
 Others (all permissions) mask.
static const int ALL_READ_WRITE
 All read and write mask.
static const int ALLBITS = (USER_ALL | GROUP_ALL | OTHERS_ALL)
 Complete permissions mask.
static const Permissions defaultFilePerms
 Default permissions for files: read & write for user, read for group.
static const Permissions defaultDirPerms
 Default permissions for directories: read, write & execute for user, read & execute for group.

Detailed Description

File permissions.

Permissions consist of read, write, and execute access for each of user (owner), group, and others (everyone), and are represented efficiently as a mask.

Author:
Mark Lindner.

Constructor & Destructor Documentation

Permissions ( uint_t  mask = 0  )  throw ()

Construct a new Permissions object with the given mask.

Parameters:
mask The permissions mask.
Permissions ( const Permissions other  )  throw ()

Copy constructor.

~Permissions (  )  throw ()

Destructor.


Member Function Documentation

bool canGroupExecute (  )  const throw () [inline]

Test for group execute access.

bool canGroupRead (  )  const throw () [inline]

Test for group read access.

bool canGroupWrite (  )  const throw () [inline]

Test for group write access.

bool canOthersExecute (  )  const throw () [inline]

Test for others execute access.

bool canOthersRead (  )  const throw () [inline]

Test for others read access.

bool canOthersWrite (  )  const throw () [inline]

Test for others write access.

bool canUserExecute (  )  const throw () [inline]

Test for user execute access.

bool canUserRead (  )  const throw () [inline]

Test for user read access.

bool canUserWrite (  )  const throw () [inline]

Test for user write access.

void clearAll (  )  throw () [inline]

Disable all access.

void clearGroupExecute (  )  throw () [inline]

Disable group execute access.

void clearGroupRead (  )  throw () [inline]

Disable group read access.

void clearGroupWrite (  )  throw () [inline]

Disable group write access.

void clearOthersExecute (  )  throw () [inline]

Disable others execute access.

void clearOthersRead (  )  throw () [inline]

Disable others read access.

void clearOthersWrite (  )  throw () [inline]

Disable others write access.

void clearUserExecute (  )  throw () [inline]

Disable user execute access.

void clearUserRead (  )  throw () [inline]

Disable user read access.

void clearUserWrite (  )  throw () [inline]

Disable user write access.

uint_t getMask (  )  const throw () [inline]

Get the permissions mask.

operator uint_t (  )  throw () [inline]

Cast operator.

Returns the permissions mask.

uint_t operator&= ( uint_t  rhs  )  throw () [inline]
uint_t operator= ( uint_t  rhs  )  throw () [inline]
Permissions & operator= ( const Permissions other  )  throw ()

Assignment operator.

uint_t operator|= ( uint_t  rhs  )  throw () [inline]
void setGroupExecute (  )  throw () [inline]

Enable group execute access.

void setGroupRead (  )  throw () [inline]

Enable group read access.

void setGroupWrite (  )  throw () [inline]

Enable group write access.

void setOthersExecute (  )  throw () [inline]

Enable others execute access.

void setOthersRead (  )  throw () [inline]

Enable others read access.

void setOthersWrite (  )  throw () [inline]

Enable others write access.

void setUserExecute (  )  throw () [inline]

Enable user execute access.

void setUserRead (  )  throw () [inline]

Enable user read access.

void setUserWrite (  )  throw () [inline]

Enable user write access.

String toString (  )  const

Get a String representation of the permissions mask.


Member Data Documentation

const int ALL_READ_WRITE [static]
Initial value:
 (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP
                                 | S_IROTH | S_IWOTH)

All read and write mask.

const int ALLBITS = (USER_ALL | GROUP_ALL | OTHERS_ALL) [static]

Complete permissions mask.

const Permissions defaultDirPerms [static]

Default permissions for directories: read, write & execute for user, read & execute for group.

const Permissions defaultFilePerms [static]

Default permissions for files: read & write for user, read for group.

const int GROUP_ALL = (S_IRGRP | S_IWGRP | S_IXGRP) [static]

Group (all permissions) mask.

const int GROUP_EXECUTE = S_IXGRP [static]

Group execute mask.

const int GROUP_READ = S_IRGRP [static]

Group read mask.

const int GROUP_READ_WRITE = (S_IRGRP | S_IWGRP) [static]

Group read and write mask.

const int GROUP_WRITE = S_IWGRP [static]

Group write mask.

const int OTHERS_ALL = (S_IROTH | S_IWOTH | S_IXOTH) [static]

Others (all permissions) mask.

const int OTHERS_EXECUTE = S_IXOTH [static]

Others execute mask.

const int OTHERS_READ = S_IROTH [static]

Others read mask.

const int OTHERS_READ_WRITE = (S_IROTH | S_IWOTH) [static]

Others read and write mask.

const int OTHERS_WRITE = S_IWOTH [static]

Others write mask.

const int USER_ALL = (S_IRUSR | S_IWUSR | S_IXUSR) [static]

User (all permissions) mask.

const int USER_EXECUTE = S_IXUSR [static]

User execute mask.

const int USER_READ = S_IRUSR [static]

User read mask.

const int USER_READ_WRITE = (S_IRUSR | S_IWUSR) [static]

User read and write mask.

const int USER_WRITE = S_IWUSR [static]

User write mask.


The documentation for this class was generated from the following files:
Generated on Sat Nov 26 16:49:09 2011 for libcommonc++ by  doxygen 1.6.3