#include <PathInfo.h>
Public Types | |
enum | Mode { STAT, LSTAT } |
stat() or lstat() More... | |
Public Member Functions | |
~PathInfo () | |
Dtor. | |
const Pathname & | path () const |
Return current Pathname. | |
const std::string & | asString () const |
Return current Pathname as String. | |
const char * | c_str () const |
Return current Pathname as C-string. | |
Mode | mode () const |
Return current stat Mode. | |
int | error () const |
Return error returned from last stat/lstat call. | |
void | setPath (const Pathname &path) |
Set a new Pathname. | |
void | setMode (Mode mode) |
Set a new Mode . | |
bool | stat (const Pathname &path) |
STAT path. | |
bool | lstat (const Pathname &path) |
LSTAT path. | |
bool | operator() (const Pathname &path) |
Restat path using current mode. | |
bool | stat () |
STAT current path. | |
bool | lstat () |
LSTAT current path. | |
bool | operator() () |
Restat current path using current mode. | |
bool | isExist () const |
Return whether valid stat info exists. | |
StatMode | asStatMode () const |
Return st_mode() as filesystem::StatMode. | |
nlink_t | nlink () const |
Construct from Pathname. | |
Default mode is STAT . | |
PathInfo () | |
PathInfo (const Pathname &path, Mode initial=STAT) | |
PathInfo (const std::string &path, Mode initial=STAT) | |
PathInfo (const char *path, Mode initial=STAT) | |
Query StatMode attibutes. | |
FileType | fileType () const |
bool | isFile () const |
bool | isDir () const |
bool | isLink () const |
bool | isChr () const |
bool | isBlk () const |
bool | isFifo () const |
bool | isSock () const |
bool | isRUsr () const |
bool | isWUsr () const |
bool | isXUsr () const |
bool | isR () const |
bool | isW () const |
bool | isX () const |
bool | isRGrp () const |
bool | isWGrp () const |
bool | isXGrp () const |
bool | isROth () const |
bool | isWOth () const |
bool | isXOth () const |
bool | isUid () const |
bool | isGid () const |
bool | isVtx () const |
bool | isPerm (mode_t m) const |
bool | hasPerm (mode_t m) const |
mode_t | uperm () const |
mode_t | gperm () const |
mode_t | operm () const |
mode_t | perm () const |
mode_t | st_mode () const |
Owner and group | |
uid_t | owner () const |
gid_t | group () const |
Permission according to current uid/gid. | |
mode_t | userMay () const |
Returns current users permission ([0-7] ). | |
bool | userMayR () const |
bool | userMayW () const |
bool | userMayX () const |
bool | userMayRW () const |
bool | userMayRX () const |
bool | userMayWX () const |
bool | userMayRWX () const |
Device and inode info. | |
ino_t | ino () const |
dev_t | dev () const |
dev_t | rdev () const |
unsigned int | major () const |
unsigned int | minor () const |
Size info. | |
off_t | size () const |
unsigned long | blksize () const |
unsigned long | blocks () const |
Time stamps. | |
time_t | atime () const |
time_t | mtime () const |
time_t | ctime () const |
Private Attributes | |
Pathname | path_t |
struct stat | statbuf_C |
Mode | mode_e |
int | error_i |
Friends | |
std::ostream & | operator<< (std::ostream &str, const PathInfo &obj) |
false
or 0
, if stat was not successful.For convenience PathInfo is available as zypp::PathInfo too.
Definition at line 218 of file PathInfo.h.
zypp::filesystem::PathInfo::PathInfo | ( | ) |
Definition at line 128 of file PathInfo.cc.
zypp::filesystem::PathInfo::PathInfo | ( | const std::string & | path, | |
Mode | initial = STAT | |||
) | [explicit] |
zypp::filesystem::PathInfo::PathInfo | ( | const char * | path, | |
Mode | initial = STAT | |||
) | [explicit] |
zypp::filesystem::PathInfo::~PathInfo | ( | ) |
const Pathname& zypp::filesystem::PathInfo::path | ( | ) | const [inline] |
const std::string& zypp::filesystem::PathInfo::asString | ( | ) | const [inline] |
Return current Pathname as String.
Definition at line 246 of file PathInfo.h.
References zypp::filesystem::Pathname::asString(), and path_t.
Referenced by zypp::filesystem::operator<<().
const char* zypp::filesystem::PathInfo::c_str | ( | ) | const [inline] |
Return current Pathname as C-string.
Definition at line 248 of file PathInfo.h.
References zypp::filesystem::Pathname::asString(), and path_t.
Mode zypp::filesystem::PathInfo::mode | ( | ) | const [inline] |
int zypp::filesystem::PathInfo::error | ( | ) | const [inline] |
Return error returned from last stat/lstat call.
Definition at line 252 of file PathInfo.h.
References error_i.
void zypp::filesystem::PathInfo::setPath | ( | const Pathname & | path | ) | [inline] |
Set a new Pathname.
Definition at line 255 of file PathInfo.h.
References error_i, and path_t.
Referenced by lstat(), operator()(), and stat().
void zypp::filesystem::PathInfo::setMode | ( | Mode | mode | ) | [inline] |
bool zypp::filesystem::PathInfo::stat | ( | const Pathname & | path | ) | [inline] |
STAT path.
Definition at line 260 of file PathInfo.h.
References operator()(), setMode(), setPath(), and STAT.
bool zypp::filesystem::PathInfo::lstat | ( | const Pathname & | path | ) | [inline] |
LSTAT path.
Definition at line 262 of file PathInfo.h.
References LSTAT, operator()(), setMode(), and setPath().
bool zypp::filesystem::PathInfo::operator() | ( | const Pathname & | path | ) | [inline] |
Restat path using current mode.
Definition at line 264 of file PathInfo.h.
References operator()(), and setPath().
Referenced by operator()().
bool zypp::filesystem::PathInfo::stat | ( | ) | [inline] |
STAT current path.
Definition at line 267 of file PathInfo.h.
References operator()(), setMode(), and STAT.
Referenced by operator()().
bool zypp::filesystem::PathInfo::lstat | ( | ) | [inline] |
LSTAT current path.
Definition at line 269 of file PathInfo.h.
References LSTAT, operator()(), and setMode().
Referenced by operator()().
bool zypp::filesystem::PathInfo::operator() | ( | ) |
Restat current path using current mode.
Definition at line 186 of file PathInfo.cc.
References zypp::filesystem::Pathname::asString(), zypp::filesystem::Pathname::empty(), error_i, lstat(), LSTAT, mode_e, path_t, stat(), STAT, and statbuf_C.
Referenced by lstat(), PathInfo(), and stat().
bool zypp::filesystem::PathInfo::isExist | ( | ) | const [inline] |
Return whether valid stat info exists.
That's usg. whether the file exist and you had permission to stat it.
Definition at line 279 of file PathInfo.h.
References error_i.
Referenced by zypp::filesystem::assert_dir(), zypp::filesystem::assert_file(), atime(), blksize(), blocks(), zypp::filesystem::clean_dir(), ctime(), dev(), zypp::filesystem::erase(), zypp::filesystem::exchange(), fileType(), gperm(), group(), hasPerm(), ino(), isBlk(), isChr(), isDir(), isFifo(), isFile(), isGid(), isLink(), isPerm(), isRGrp(), isROth(), isRUsr(), isSock(), isUid(), isVtx(), isWGrp(), isWOth(), isWUsr(), isXGrp(), isXOth(), isXUsr(), mtime(), nlink(), zypp::filesystem::operator<<(), operm(), owner(), perm(), rdev(), zypp::filesystem::recursive_rmdir(), size(), st_mode(), uperm(), userMay(), and zypp::filesystem::TmpPath::Impl::~Impl().
FileType zypp::filesystem::PathInfo::fileType | ( | ) | const |
Definition at line 210 of file PathInfo.cc.
References asStatMode(), zypp::filesystem::StatMode::fileType(), zypp::filesystem::FT_NOT_EXIST, and isExist().
Referenced by zypp::filesystem::readdir().
bool zypp::filesystem::PathInfo::isFile | ( | ) | const [inline] |
Definition at line 287 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by zypp::filesystem::assert_file(), zypp::filesystem::copy(), zypp::filesystem::copy_file2dir(), and zypp::filesystem::operator<<().
bool zypp::filesystem::PathInfo::isDir | ( | ) | const [inline] |
Definition at line 288 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by zypp::filesystem::assert_dir(), zypp::filesystem::clean_dir(), zypp::filesystem::copy(), zypp::filesystem::copy_dir(), zypp::filesystem::copy_dir_content(), zypp::filesystem::copy_file2dir(), zypp::filesystem::erase(), zypp::filesystem::recursive_rmdir(), and zypp::filesystem::TmpPath::Impl::~Impl().
bool zypp::filesystem::PathInfo::isLink | ( | ) | const [inline] |
Definition at line 289 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by zypp::filesystem::expandlink(), and zypp::filesystem::hardlinkCopy().
bool zypp::filesystem::PathInfo::isChr | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isBlk | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isFifo | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isSock | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isRUsr | ( | ) | const [inline] |
Definition at line 296 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by isR().
bool zypp::filesystem::PathInfo::isWUsr | ( | ) | const [inline] |
Definition at line 297 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by isW().
bool zypp::filesystem::PathInfo::isXUsr | ( | ) | const [inline] |
Definition at line 298 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by isX().
bool zypp::filesystem::PathInfo::isR | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isW | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isX | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isRGrp | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isWGrp | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isXGrp | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isROth | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isWOth | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isXOth | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isUid | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isGid | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isVtx | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::isPerm | ( | mode_t | m | ) | const [inline] |
bool zypp::filesystem::PathInfo::hasPerm | ( | mode_t | m | ) | const [inline] |
mode_t zypp::filesystem::PathInfo::uperm | ( | ) | const [inline] |
Definition at line 319 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by userMay().
mode_t zypp::filesystem::PathInfo::gperm | ( | ) | const [inline] |
Definition at line 320 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by userMay().
mode_t zypp::filesystem::PathInfo::operm | ( | ) | const [inline] |
Definition at line 321 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by userMay().
mode_t zypp::filesystem::PathInfo::perm | ( | ) | const [inline] |
mode_t zypp::filesystem::PathInfo::st_mode | ( | ) | const [inline] |
Definition at line 324 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by asStatMode().
StatMode zypp::filesystem::PathInfo::asStatMode | ( | ) | const [inline] |
Return st_mode() as filesystem::StatMode.
Definition at line 328 of file PathInfo.h.
References st_mode().
Referenced by fileType(), and zypp::filesystem::operator<<().
nlink_t zypp::filesystem::PathInfo::nlink | ( | ) | const [inline] |
uid_t zypp::filesystem::PathInfo::owner | ( | ) | const [inline] |
Definition at line 334 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by zypp::filesystem::operator<<(), and userMay().
gid_t zypp::filesystem::PathInfo::group | ( | ) | const [inline] |
Definition at line 335 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by zypp::filesystem::operator<<(), and userMay().
mode_t zypp::filesystem::PathInfo::userMay | ( | ) | const |
Returns current users permission ([0-7]
).
Definition at line 222 of file PathInfo.cc.
References gperm(), group(), isExist(), operm(), owner(), and uperm().
Referenced by userMayR(), userMayRW(), userMayRWX(), userMayRX(), userMayW(), userMayWX(), and userMayX().
bool zypp::filesystem::PathInfo::userMayR | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::userMayW | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::userMayX | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::userMayRW | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::userMayRX | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::userMayWX | ( | ) | const [inline] |
bool zypp::filesystem::PathInfo::userMayRWX | ( | ) | const [inline] |
ino_t zypp::filesystem::PathInfo::ino | ( | ) | const [inline] |
dev_t zypp::filesystem::PathInfo::dev | ( | ) | const [inline] |
dev_t zypp::filesystem::PathInfo::rdev | ( | ) | const [inline] |
unsigned int zypp::filesystem::PathInfo::major | ( | ) | const |
unsigned int zypp::filesystem::PathInfo::minor | ( | ) | const |
off_t zypp::filesystem::PathInfo::size | ( | ) | const [inline] |
Definition at line 366 of file PathInfo.h.
References isExist(), and statbuf_C.
Referenced by zypp::filesystem::operator<<().
unsigned long zypp::filesystem::PathInfo::blksize | ( | ) | const [inline] |
unsigned long zypp::filesystem::PathInfo::blocks | ( | ) | const [inline] |
time_t zypp::filesystem::PathInfo::atime | ( | ) | const [inline] |
time_t zypp::filesystem::PathInfo::mtime | ( | ) | const [inline] |
time_t zypp::filesystem::PathInfo::ctime | ( | ) | const [inline] |
std::ostream & operator<< | ( | std::ostream & | str, | |
const PathInfo & | obj | |||
) | [friend] |
Stream output.
Definition at line 259 of file PathInfo.cc.
Pathname zypp::filesystem::PathInfo::path_t [private] |
Definition at line 379 of file PathInfo.h.
Referenced by asString(), c_str(), operator()(), path(), and setPath().
struct stat zypp::filesystem::PathInfo::statbuf_C [read, private] |
Definition at line 380 of file PathInfo.h.
Referenced by atime(), blksize(), blocks(), ctime(), dev(), gperm(), group(), ino(), isBlk(), isChr(), isDir(), isFifo(), isFile(), isGid(), isLink(), isRGrp(), isROth(), isRUsr(), isSock(), isUid(), isVtx(), isWGrp(), isWOth(), isWUsr(), isXGrp(), isXOth(), isXUsr(), major(), minor(), mtime(), nlink(), operator()(), operm(), owner(), perm(), rdev(), size(), st_mode(), and uperm().
Mode zypp::filesystem::PathInfo::mode_e [private] |
int zypp::filesystem::PathInfo::error_i [private] |
Definition at line 382 of file PathInfo.h.
Referenced by error(), isExist(), operator()(), setMode(), and setPath().