StPermission Class Reference

StPermission allows the programmer to change and set file permissions and owners. More...

#include <stpermission.h>

List of all members.

Public Member Functions

 StPermission ()
 StPermission (int owner, int group, int other)
 StPermission (int uid, int gid)
void setOwner (bool read, bool write, bool execute)
void setGroup (bool read, bool write, bool execute)
void setOther (bool read, bool write, bool execute)
void setPermission (int owner, int group, int other)
void setOwner (int uid)
void setGroup (int gid)
bool ownerCanRead () const
bool ownerCanWrite () const
bool ownerCanExecute () const
bool groupCanRead () const
bool groupCanWrite () const
bool groupCanExecute () const
bool otherCanRead () const
bool otherCanWrite () const
bool otherCanExecute () const
bool canIRead () const
bool canIWrite () const
bool canIExecute () const
void setUid (int uid)
void setGid (int gid)
int getUid () const
int getGid () const

Private Member Functions

void init ()

Private Attributes

bool ownerRead
bool ownerWrite
bool ownerExecute
bool groupRead
bool groupWrite
bool groupExecute
bool otherRead
bool otherWrite
bool otherExecute
int uid
int gid


Detailed Description

StPermission allows the programmer to change and set file permissions and owners.

This class is useful for storing file settings like owner, group which file belongs and permissions.


Constructor & Destructor Documentation

StPermission::StPermission (  )  [inline]

StPermission::StPermission ( int  owner,
int  group,
int  other 
) [inline]

StPermission::StPermission ( int  uid,
int  gid 
) [inline]


Member Function Documentation

bool StPermission::canIExecute (  )  const

Check if current user can execute a file

bool StPermission::canIRead (  )  const

Check if current user can read a file

bool StPermission::canIWrite (  )  const

Check if current user can write to a file

int StPermission::getGid (  )  const [inline]

Get Group Identifier number

int StPermission::getUid (  )  const [inline]

Get User Identifier number

bool StPermission::groupCanExecute (  )  const [inline]

Check if group can execute a file

bool StPermission::groupCanRead (  )  const [inline]

Check if group can read a file

bool StPermission::groupCanWrite (  )  const [inline]

Check if group can write to a file

void StPermission::init (  )  [inline, private]

bool StPermission::otherCanExecute (  )  const [inline]

Check if others can execute a file

bool StPermission::otherCanRead (  )  const [inline]

Check if others can read a file

bool StPermission::otherCanWrite (  )  const [inline]

Check if others can write to a file

bool StPermission::ownerCanExecute (  )  const [inline]

Check if owner can execute a file

bool StPermission::ownerCanRead (  )  const [inline]

Check if owner can read a file

bool StPermission::ownerCanWrite (  )  const [inline]

Check if owner can write to a file

void StPermission::setGid ( int  gid  )  [inline]

Set Group Identifier number

void StPermission::setGroup ( int  gid  )  [inline]

Set group which file belong to.

Parameters:
gid - Group Identifier number

void StPermission::setGroup ( bool  read,
bool  write,
bool  execute 
) [inline]

Set file permissions for group

Parameters:
read - can read
write - can write
execute - can execute

void StPermission::setOther ( bool  read,
bool  write,
bool  execute 
) [inline]

Set file permissions for others

Parameters:
read - can read
write - can write
execute - can execute

void StPermission::setOwner ( int  uid  )  [inline]

Set file owner.

Parameters:
uid - User Identifier number

void StPermission::setOwner ( bool  read,
bool  write,
bool  execute 
) [inline]

Set file permissions for owner

Parameters:
read - can read
write - can write
execute - can execute

void StPermission::setPermission ( int  owner,
int  group,
int  other 
)

Set file permissions. This function is same as chmod with permissions in number format e.g. chmod 522 is the same as setPermission(5, 2, 2)

Parameters:
owner - permissions for owner
group - permissions for group
other - permissions for others

void StPermission::setUid ( int  uid  )  [inline]

Set User Identifier number


Member Data Documentation

int StPermission::gid [private]

bool StPermission::groupExecute [private]

bool StPermission::groupRead [private]

bool StPermission::groupWrite [private]

bool StPermission::otherExecute [private]

bool StPermission::otherRead [private]

bool StPermission::otherWrite [private]

bool StPermission::ownerExecute [private]

bool StPermission::ownerRead [private]

bool StPermission::ownerWrite [private]

int StPermission::uid [private]


The documentation for this class was generated from the following files:
Generated on Tue Nov 14 21:15:09 2006 for Smart Tools Library by  doxygen 1.4.7