#include <stpermission.h>
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 |
This class is useful for storing file settings like owner, group which file belongs and permissions.
StPermission::StPermission | ( | ) | [inline] |
StPermission::StPermission | ( | int | owner, | |
int | group, | |||
int | other | |||
) | [inline] |
StPermission::StPermission | ( | int | uid, | |
int | gid | |||
) | [inline] |
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.
gid | - Group Identifier number |
void StPermission::setGroup | ( | bool | read, | |
bool | write, | |||
bool | execute | |||
) | [inline] |
Set file permissions for group
read | - can read | |
write | - can write | |
execute | - can execute |
void StPermission::setOther | ( | bool | read, | |
bool | write, | |||
bool | execute | |||
) | [inline] |
Set file permissions for others
read | - can read | |
write | - can write | |
execute | - can execute |
void StPermission::setOwner | ( | int | uid | ) | [inline] |
Set file owner.
uid | - User Identifier number |
void StPermission::setOwner | ( | bool | read, | |
bool | write, | |||
bool | execute | |||
) | [inline] |
Set file permissions for owner
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)
owner | - permissions for owner | |
group | - permissions for group | |
other | - permissions for others |
void StPermission::setUid | ( | int | uid | ) | [inline] |
Set User Identifier number
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] |