libcommonc++  0.7
Permissions Class Reference

File permissions. More...

#include <Permissions.h++>

Collaboration diagram for Permissions:

Public Member Functions

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

Static Public Attributes

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

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() [1/2]

Permissions ( uint_t  mask = 0)

Construct a new Permissions object with the given mask.

Parameters
maskThe permissions mask.

◆ Permissions() [2/2]

Permissions ( const Permissions other)

Copy constructor.

◆ ~Permissions()

Destructor.

Member Function Documentation

◆ canGroupExecute()

bool canGroupExecute ( ) const
inline

Test for group execute access.

◆ canGroupRead()

bool canGroupRead ( ) const
inline

Test for group read access.

◆ canGroupWrite()

bool canGroupWrite ( ) const
inline

Test for group write access.

◆ canOthersExecute()

bool canOthersExecute ( ) const
inline

Test for others execute access.

◆ canOthersRead()

bool canOthersRead ( ) const
inline

Test for others read access.

◆ canOthersWrite()

bool canOthersWrite ( ) const
inline

Test for others write access.

◆ canUserExecute()

bool canUserExecute ( ) const
inline

Test for user execute access.

◆ canUserRead()

bool canUserRead ( ) const
inline

Test for user read access.

◆ canUserWrite()

bool canUserWrite ( ) const
inline

Test for user write access.

◆ clearAll()

void clearAll ( )
inline

Disable all access.

◆ clearGroupExecute()

void clearGroupExecute ( )
inline

Disable group execute access.

◆ clearGroupRead()

void clearGroupRead ( )
inline

Disable group read access.

◆ clearGroupWrite()

void clearGroupWrite ( )
inline

Disable group write access.

◆ clearOthersExecute()

void clearOthersExecute ( )
inline

Disable others execute access.

◆ clearOthersRead()

void clearOthersRead ( )
inline

Disable others read access.

◆ clearOthersWrite()

void clearOthersWrite ( )
inline

Disable others write access.

◆ clearUserExecute()

void clearUserExecute ( )
inline

Disable user execute access.

◆ clearUserRead()

void clearUserRead ( )
inline

Disable user read access.

◆ clearUserWrite()

void clearUserWrite ( )
inline

Disable user write access.

◆ getMask()

uint_t getMask ( ) const
inline

Get the permissions mask.

◆ operator &=()

uint_t operator&= ( uint_t  rhs)
inline

◆ operator uint_t()

operator uint_t ( )
inline

Cast operator.

Returns the permissions mask.

◆ operator=() [1/2]

Permissions & operator= ( const Permissions other)

Assignment operator.

◆ operator=() [2/2]

uint_t operator= ( uint_t  rhs)
inline

◆ operator|=()

uint_t operator|= ( uint_t  rhs)
inline

◆ setGroupExecute()

void setGroupExecute ( )
inline

Enable group execute access.

◆ setGroupRead()

void setGroupRead ( )
inline

Enable group read access.

◆ setGroupWrite()

void setGroupWrite ( )
inline

Enable group write access.

◆ setOthersExecute()

void setOthersExecute ( )
inline

Enable others execute access.

◆ setOthersRead()

void setOthersRead ( )
inline

Enable others read access.

◆ setOthersWrite()

void setOthersWrite ( )
inline

Enable others write access.

◆ setUserExecute()

void setUserExecute ( )
inline

Enable user execute access.

◆ setUserRead()

void setUserRead ( )
inline

Enable user read access.

◆ setUserWrite()

void setUserWrite ( )
inline

Enable user write access.

◆ toString()

String toString ( ) const

Get a String representation of the permissions mask.

Member Data Documentation

◆ ALL_READ_WRITE

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.

◆ ALLBITS

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

Complete permissions mask.

◆ defaultDirPerms

const Permissions defaultDirPerms
static

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

◆ defaultFilePerms

const Permissions defaultFilePerms
static

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

◆ GROUP_ALL

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

Group (all permissions) mask.

◆ GROUP_EXECUTE

const int GROUP_EXECUTE = S_IXGRP
static

Group execute mask.

◆ GROUP_READ

const int GROUP_READ = S_IRGRP
static

Group read mask.

◆ GROUP_READ_WRITE

const int GROUP_READ_WRITE = (S_IRGRP | S_IWGRP)
static

Group read and write mask.

◆ GROUP_WRITE

const int GROUP_WRITE = S_IWGRP
static

Group write mask.

◆ OTHERS_ALL

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

Others (all permissions) mask.

◆ OTHERS_EXECUTE

const int OTHERS_EXECUTE = S_IXOTH
static

Others execute mask.

◆ OTHERS_READ

const int OTHERS_READ = S_IROTH
static

Others read mask.

◆ OTHERS_READ_WRITE

const int OTHERS_READ_WRITE = (S_IROTH | S_IWOTH)
static

Others read and write mask.

◆ OTHERS_WRITE

const int OTHERS_WRITE = S_IWOTH
static

Others write mask.

◆ USER_ALL

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

User (all permissions) mask.

◆ USER_EXECUTE

const int USER_EXECUTE = S_IXUSR
static

User execute mask.

◆ USER_READ

const int USER_READ = S_IRUSR
static

User read mask.

◆ USER_READ_WRITE

const int USER_READ_WRITE = (S_IRUSR | S_IWUSR)
static

User read and write mask.

◆ USER_WRITE

const int USER_WRITE = S_IWUSR
static

User write mask.


The documentation for this class was generated from the following files: