Permissions Class Reference
[File System]

#include <Permissions.h>

List of all members.

Public Member Functions

 Permissions (uint32 mask=0) throw ()
 Permissions (const Permissions &other) throw ()
 ~Permissions () throw ()
bool CanUserRead () const throw ()
void SetUserRead () throw ()
void ClearUserRead () throw ()
bool CanUserWrite () const throw ()
void SetUserWrite () throw ()
void ClearUserWrite () throw ()
bool CanUserExecute () const throw ()
void SetUserExecute () throw ()
void ClearUserExecute () throw ()
bool CanGroupRead () const throw ()
void SetGroupRead () throw ()
void ClearGroupRead () throw ()
bool CanGroupWrite () const throw ()
void SetGroupWrite () throw ()
void ClearGroupWrite () throw ()
bool CanGroupExecute () const throw ()
void SetGroupExecute () throw ()
void ClearGroupExecute () throw ()
bool CanOthersRead () const throw ()
void SetOthersRead () throw ()
void ClearOthersRead () throw ()
bool CanOthersWrite () const throw ()
void SetOthersWrite () throw ()
void ClearOthersWrite () throw ()
bool CanOthersExecute () const throw ()
void SetOthersExecute () throw ()
void ClearOthersExecute () throw ()
void ClearAll () throw ()
Permissionsoperator= (const Permissions &other) throw ()
uint32 GetMask () const throw ()
 operator uint32 () throw ()
StringPtr ToString () const
uint32 operator= (uint32 rhs) throw ()
uint32 operator|= (uint32 rhs) throw ()
uint32 operator&= (uint32 rhs) throw ()

Static Public Attributes

static const int USER_READ = S_IRUSR
static const int USER_WRITE = S_IWUSR
static const int USER_READ_WRITE = (S_IRUSR | S_IWUSR)
static const int USER_EXECUTE = S_IXUSR
static const int USER_ALL = (S_IRUSR | S_IWUSR | S_IXUSR)
static const int GROUP_READ = S_IRGRP
static const int GROUP_WRITE = S_IWGRP
static const int GROUP_READ_WRITE = (S_IRGRP | S_IWGRP)
static const int GROUP_EXECUTE = S_IXGRP
static const int GROUP_ALL = (S_IRGRP | S_IWGRP | S_IXGRP)
static const int OTHERS_READ = S_IROTH
static const int OTHERS_WRITE = S_IWOTH
static const int OTHERS_READ_WRITE = (S_IROTH | S_IWOTH)
static const int OTHERS_EXECUTE = S_IXOTH
static const int OTHERS_ALL = (S_IROTH | S_IWOTH | S_IXOTH)
static const int ALL_READ_WRITE
static const int ALLBITS = (USER_ALL | GROUP_ALL | OTHERS_ALL)
static const Permissions DefaultFilePerms
static const Permissions DefaultDirPerms

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.

Definition at line 52 of file Permissions.h.


Constructor & Destructor Documentation

Permissions::Permissions ( uint32  mask = 0  )  throw ()

Construct a new Permissions object with the given mask.

Parameters:
mask The permissions mask.

Definition at line 87 of file Permissions.cpp.

Permissions::Permissions ( const Permissions other  )  throw ()

Copy constructor.

Definition at line 95 of file Permissions.cpp.

Permissions::~Permissions (  )  throw ()

Destructor.

Definition at line 103 of file Permissions.cpp.


Member Function Documentation

bool Permissions::CanGroupExecute (  )  const throw () [inline]

Test for group execute access.

Definition at line 190 of file Permissions.h.

References GROUP_EXECUTE.

bool Permissions::CanGroupRead (  )  const throw () [inline]

Test for group read access.

Definition at line 166 of file Permissions.h.

References GROUP_READ.

bool Permissions::CanGroupWrite (  )  const throw () [inline]

Test for group write access.

Definition at line 178 of file Permissions.h.

References GROUP_WRITE.

bool Permissions::CanOthersExecute (  )  const throw () [inline]

Test for others execute access.

Definition at line 228 of file Permissions.h.

References OTHERS_EXECUTE.

bool Permissions::CanOthersRead (  )  const throw () [inline]

Test for others read access.

Definition at line 204 of file Permissions.h.

References OTHERS_READ.

bool Permissions::CanOthersWrite (  )  const throw () [inline]

Test for others write access.

Definition at line 216 of file Permissions.h.

References OTHERS_WRITE.

bool Permissions::CanUserExecute (  )  const throw () [inline]

Test for user execute access.

Definition at line 152 of file Permissions.h.

References USER_EXECUTE.

bool Permissions::CanUserRead (  )  const throw () [inline]

Test for user read access.

Definition at line 128 of file Permissions.h.

References USER_READ.

bool Permissions::CanUserWrite (  )  const throw () [inline]

Test for user write access.

Definition at line 140 of file Permissions.h.

References USER_WRITE.

void Permissions::ClearAll (  )  throw () [inline]

Disable all access.

Definition at line 240 of file Permissions.h.

void Permissions::ClearGroupExecute (  )  throw () [inline]

Disable group execute access.

Definition at line 198 of file Permissions.h.

References GROUP_EXECUTE.

void Permissions::ClearGroupRead (  )  throw () [inline]

Disable group read access.

Definition at line 174 of file Permissions.h.

References GROUP_READ.

void Permissions::ClearGroupWrite (  )  throw () [inline]

Disable group write access.

Definition at line 186 of file Permissions.h.

References GROUP_WRITE.

void Permissions::ClearOthersExecute (  )  throw () [inline]

Disable others execute access.

Definition at line 236 of file Permissions.h.

References OTHERS_EXECUTE.

void Permissions::ClearOthersRead (  )  throw () [inline]

Disable others read access.

Definition at line 212 of file Permissions.h.

References OTHERS_READ.

void Permissions::ClearOthersWrite (  )  throw () [inline]

Disable others write access.

Definition at line 224 of file Permissions.h.

References OTHERS_WRITE.

void Permissions::ClearUserExecute (  )  throw () [inline]

Disable user execute access.

Definition at line 160 of file Permissions.h.

References USER_EXECUTE.

void Permissions::ClearUserRead (  )  throw () [inline]

Disable user read access.

Definition at line 136 of file Permissions.h.

References USER_READ.

void Permissions::ClearUserWrite (  )  throw () [inline]

Disable user write access.

Definition at line 148 of file Permissions.h.

References USER_WRITE.

uint32 Permissions::GetMask (  )  const throw () [inline]

Get the permissions mask.

Definition at line 249 of file Permissions.h.

Permissions::operator uint32 (  )  throw () [inline]

Cast operator. Returns the permissions mask.

Definition at line 254 of file Permissions.h.

void Permissions::SetGroupExecute (  )  throw () [inline]

Enable group execute access.

Definition at line 194 of file Permissions.h.

References GROUP_EXECUTE.

void Permissions::SetGroupRead (  )  throw () [inline]

Enable group read access.

Definition at line 170 of file Permissions.h.

References GROUP_READ.

void Permissions::SetGroupWrite (  )  throw () [inline]

Enable group write access.

Definition at line 182 of file Permissions.h.

References GROUP_WRITE.

void Permissions::SetOthersExecute (  )  throw () [inline]

Enable others execute access.

Definition at line 232 of file Permissions.h.

References OTHERS_EXECUTE.

void Permissions::SetOthersRead (  )  throw () [inline]

Enable others read access.

Definition at line 208 of file Permissions.h.

References OTHERS_READ.

void Permissions::SetOthersWrite (  )  throw () [inline]

Enable others write access.

Definition at line 220 of file Permissions.h.

References OTHERS_WRITE.

void Permissions::SetUserExecute (  )  throw () [inline]

Enable user execute access.

Definition at line 156 of file Permissions.h.

References USER_EXECUTE.

void Permissions::SetUserRead (  )  throw () [inline]

Enable user read access.

Definition at line 132 of file Permissions.h.

References USER_READ.

void Permissions::SetUserWrite (  )  throw () [inline]

Enable user write access.

Definition at line 144 of file Permissions.h.

References USER_WRITE.

StringPtr Permissions::ToString (  )  const

Get a String representation of the permissions mask.

Definition at line 119 of file Permissions.cpp.


Member Data Documentation

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

All read and write mask.

Definition at line 120 of file Permissions.h.

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

Complete permissions mask.

Definition at line 123 of file Permissions.h.

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

Definition at line 281 of file Permissions.h.

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

Definition at line 275 of file Permissions.h.

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

Group (all permissions) mask.

Definition at line 102 of file Permissions.h.

const int Permissions::GROUP_EXECUTE = S_IXGRP [static]

Group execute mask.

Definition at line 99 of file Permissions.h.

Referenced by CanGroupExecute(), ClearGroupExecute(), and SetGroupExecute().

const int Permissions::GROUP_READ = S_IRGRP [static]

Group read mask.

Definition at line 90 of file Permissions.h.

Referenced by CanGroupRead(), ClearGroupRead(), and SetGroupRead().

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

Group read and write mask.

Definition at line 96 of file Permissions.h.

const int Permissions::GROUP_WRITE = S_IWGRP [static]

Group write mask.

Definition at line 93 of file Permissions.h.

Referenced by CanGroupWrite(), ClearGroupWrite(), and SetGroupWrite().

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

Others (all permissions) mask.

Definition at line 117 of file Permissions.h.

const int Permissions::OTHERS_EXECUTE = S_IXOTH [static]

Others execute mask.

Definition at line 114 of file Permissions.h.

Referenced by CanOthersExecute(), ClearOthersExecute(), and SetOthersExecute().

const int Permissions::OTHERS_READ = S_IROTH [static]

Others read mask.

Definition at line 105 of file Permissions.h.

Referenced by CanOthersRead(), ClearOthersRead(), and SetOthersRead().

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

Others read and write mask.

Definition at line 111 of file Permissions.h.

const int Permissions::OTHERS_WRITE = S_IWOTH [static]

Others write mask.

Definition at line 108 of file Permissions.h.

Referenced by CanOthersWrite(), ClearOthersWrite(), and SetOthersWrite().

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

User (all permissions) mask.

Definition at line 87 of file Permissions.h.

const int Permissions::USER_EXECUTE = S_IXUSR [static]

User execute mask.

Definition at line 84 of file Permissions.h.

Referenced by CanUserExecute(), ClearUserExecute(), and SetUserExecute().

const int Permissions::USER_READ = S_IRUSR [static]

User read mask.

Definition at line 75 of file Permissions.h.

Referenced by CanUserRead(), ClearUserRead(), and SetUserRead().

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

User read and write mask.

Definition at line 81 of file Permissions.h.

const int Permissions::USER_WRITE = S_IWUSR [static]

User write mask.

Definition at line 78 of file Permissions.h.

Referenced by CanUserWrite(), ClearUserWrite(), and SetUserWrite().


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