libzypp  17.5.0
zypp::filesystem::PathInfo Class Reference

Wrapper class for ::stat/::lstat. More...

#include <PathInfo.h>

Public Types

enum  Mode { STAT, LSTAT }
 stat() or lstat() More...
 

Public Member Functions

 ~PathInfo ()
 Dtor. More...
 
const Pathnamepath () const
 Return current Pathname. More...
 
const std::string & asString () const
 Return current Pathname as String. More...
 
const char * c_str () const
 Return current Pathname as C-string. More...
 
Mode mode () const
 Return current stat Mode. More...
 
int error () const
 Return error returned from last stat/lstat call. More...
 
void setPath (const Pathname &path)
 Set a new Pathname. More...
 
void setMode (Mode mode)
 Set a new Mode . More...
 
bool stat (const Pathname &path)
 STAT path. More...
 
bool lstat (const Pathname &path)
 LSTAT path. More...
 
bool operator() (const Pathname &path)
 Restat path using current mode. More...
 
bool stat ()
 STAT current path. More...
 
bool lstat ()
 LSTAT current path. More...
 
bool operator() ()
 Restat current path using current mode. More...
 
bool isExist () const
 Return whether valid stat info exists. More...
 
StatMode asStatMode () const
 Return st_mode() as filesystem::StatMode. More...
 
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]) More...
 
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 devMajor () const
 
unsigned int devMinor () 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)
 

Related Functions

(Note that these are not member functions.)

std::ostream & operator<< (std::ostream &str, const PathInfo &obj)
 

Detailed Description

Wrapper class for ::stat/::lstat.

Note
All attribute quieries test for isExist(), and return false or 0, if stat was not successful.
For convenience PathInfo is available as zypp::PathInfo too.

Definition at line 220 of file PathInfo.h.

Member Enumeration Documentation

◆ Mode

stat() or lstat()

Enumerator
STAT 
LSTAT 

Definition at line 226 of file PathInfo.h.

Constructor & Destructor Documentation

◆ PathInfo() [1/4]

zypp::filesystem::PathInfo::PathInfo ( )

Definition at line 131 of file PathInfo.cc.

◆ PathInfo() [2/4]

zypp::filesystem::PathInfo::PathInfo ( const Pathname path,
Mode  initial = STAT 
)
explicit

Definition at line 141 of file PathInfo.cc.

◆ PathInfo() [3/4]

zypp::filesystem::PathInfo::PathInfo ( const std::string &  path,
Mode  initial = STAT 
)
explicit

Definition at line 154 of file PathInfo.cc.

◆ PathInfo() [4/4]

zypp::filesystem::PathInfo::PathInfo ( const char *  path,
Mode  initial = STAT 
)
explicit

Definition at line 167 of file PathInfo.cc.

◆ ~PathInfo()

zypp::filesystem::PathInfo::~PathInfo ( )

Dtor.

Definition at line 180 of file PathInfo.cc.

Member Function Documentation

◆ path()

const Pathname& zypp::filesystem::PathInfo::path ( ) const
inline

Return current Pathname.

Definition at line 246 of file PathInfo.h.

◆ asString()

const std::string& zypp::filesystem::PathInfo::asString ( ) const
inline

Return current Pathname as String.

Definition at line 248 of file PathInfo.h.

◆ c_str()

const char* zypp::filesystem::PathInfo::c_str ( ) const
inline

Return current Pathname as C-string.

Definition at line 250 of file PathInfo.h.

◆ mode()

Mode zypp::filesystem::PathInfo::mode ( ) const
inline

Return current stat Mode.

Definition at line 252 of file PathInfo.h.

◆ error()

int zypp::filesystem::PathInfo::error ( ) const
inline

Return error returned from last stat/lstat call.

Definition at line 254 of file PathInfo.h.

◆ setPath()

void zypp::filesystem::PathInfo::setPath ( const Pathname path)
inline

Set a new Pathname.

Definition at line 257 of file PathInfo.h.

◆ setMode()

void zypp::filesystem::PathInfo::setMode ( Mode  mode)
inline

Set a new Mode .

Definition at line 259 of file PathInfo.h.

◆ stat() [1/2]

bool zypp::filesystem::PathInfo::stat ( const Pathname path)
inline

STAT path.

Definition at line 262 of file PathInfo.h.

◆ lstat() [1/2]

bool zypp::filesystem::PathInfo::lstat ( const Pathname path)
inline

LSTAT path.

Definition at line 264 of file PathInfo.h.

◆ operator()() [1/2]

bool zypp::filesystem::PathInfo::operator() ( const Pathname path)
inline

Restat path using current mode.

Definition at line 266 of file PathInfo.h.

◆ stat() [2/2]

bool zypp::filesystem::PathInfo::stat ( )
inline

STAT current path.

Definition at line 269 of file PathInfo.h.

◆ lstat() [2/2]

bool zypp::filesystem::PathInfo::lstat ( )
inline

LSTAT current path.

Definition at line 271 of file PathInfo.h.

◆ operator()() [2/2]

bool zypp::filesystem::PathInfo::operator() ( )

Restat current path using current mode.

Definition at line 189 of file PathInfo.cc.

◆ isExist()

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 281 of file PathInfo.h.

◆ fileType()

FileType zypp::filesystem::PathInfo::fileType ( ) const

Definition at line 213 of file PathInfo.cc.

◆ isFile()

bool zypp::filesystem::PathInfo::isFile ( ) const
inline

Definition at line 289 of file PathInfo.h.

◆ isDir()

bool zypp::filesystem::PathInfo::isDir ( ) const
inline

Definition at line 290 of file PathInfo.h.

◆ isLink()

bool zypp::filesystem::PathInfo::isLink ( ) const
inline

Definition at line 291 of file PathInfo.h.

◆ isChr()

bool zypp::filesystem::PathInfo::isChr ( ) const
inline

Definition at line 292 of file PathInfo.h.

◆ isBlk()

bool zypp::filesystem::PathInfo::isBlk ( ) const
inline

Definition at line 293 of file PathInfo.h.

◆ isFifo()

bool zypp::filesystem::PathInfo::isFifo ( ) const
inline

Definition at line 294 of file PathInfo.h.

◆ isSock()

bool zypp::filesystem::PathInfo::isSock ( ) const
inline

Definition at line 295 of file PathInfo.h.

◆ isRUsr()

bool zypp::filesystem::PathInfo::isRUsr ( ) const
inline

Definition at line 298 of file PathInfo.h.

◆ isWUsr()

bool zypp::filesystem::PathInfo::isWUsr ( ) const
inline

Definition at line 299 of file PathInfo.h.

◆ isXUsr()

bool zypp::filesystem::PathInfo::isXUsr ( ) const
inline

Definition at line 300 of file PathInfo.h.

◆ isR()

bool zypp::filesystem::PathInfo::isR ( ) const
inline

Definition at line 302 of file PathInfo.h.

◆ isW()

bool zypp::filesystem::PathInfo::isW ( ) const
inline

Definition at line 303 of file PathInfo.h.

◆ isX()

bool zypp::filesystem::PathInfo::isX ( ) const
inline

Definition at line 304 of file PathInfo.h.

◆ isRGrp()

bool zypp::filesystem::PathInfo::isRGrp ( ) const
inline

Definition at line 306 of file PathInfo.h.

◆ isWGrp()

bool zypp::filesystem::PathInfo::isWGrp ( ) const
inline

Definition at line 307 of file PathInfo.h.

◆ isXGrp()

bool zypp::filesystem::PathInfo::isXGrp ( ) const
inline

Definition at line 308 of file PathInfo.h.

◆ isROth()

bool zypp::filesystem::PathInfo::isROth ( ) const
inline

Definition at line 310 of file PathInfo.h.

◆ isWOth()

bool zypp::filesystem::PathInfo::isWOth ( ) const
inline

Definition at line 311 of file PathInfo.h.

◆ isXOth()

bool zypp::filesystem::PathInfo::isXOth ( ) const
inline

Definition at line 312 of file PathInfo.h.

◆ isUid()

bool zypp::filesystem::PathInfo::isUid ( ) const
inline

Definition at line 314 of file PathInfo.h.

◆ isGid()

bool zypp::filesystem::PathInfo::isGid ( ) const
inline

Definition at line 315 of file PathInfo.h.

◆ isVtx()

bool zypp::filesystem::PathInfo::isVtx ( ) const
inline

Definition at line 316 of file PathInfo.h.

◆ isPerm()

bool zypp::filesystem::PathInfo::isPerm ( mode_t  m) const
inline

Definition at line 318 of file PathInfo.h.

◆ hasPerm()

bool zypp::filesystem::PathInfo::hasPerm ( mode_t  m) const
inline

Definition at line 319 of file PathInfo.h.

◆ uperm()

mode_t zypp::filesystem::PathInfo::uperm ( ) const
inline

Definition at line 321 of file PathInfo.h.

◆ gperm()

mode_t zypp::filesystem::PathInfo::gperm ( ) const
inline

Definition at line 322 of file PathInfo.h.

◆ operm()

mode_t zypp::filesystem::PathInfo::operm ( ) const
inline

Definition at line 323 of file PathInfo.h.

◆ perm()

mode_t zypp::filesystem::PathInfo::perm ( ) const
inline

Definition at line 324 of file PathInfo.h.

◆ st_mode()

mode_t zypp::filesystem::PathInfo::st_mode ( ) const
inline

Definition at line 326 of file PathInfo.h.

◆ asStatMode()

StatMode zypp::filesystem::PathInfo::asStatMode ( ) const
inline

Return st_mode() as filesystem::StatMode.

Definition at line 330 of file PathInfo.h.

◆ nlink()

nlink_t zypp::filesystem::PathInfo::nlink ( ) const
inline

Definition at line 332 of file PathInfo.h.

◆ owner()

uid_t zypp::filesystem::PathInfo::owner ( ) const
inline

Definition at line 336 of file PathInfo.h.

◆ group()

gid_t zypp::filesystem::PathInfo::group ( ) const
inline

Definition at line 337 of file PathInfo.h.

◆ userMay()

mode_t zypp::filesystem::PathInfo::userMay ( ) const

Returns current users permission ([0-7])

Definition at line 225 of file PathInfo.cc.

◆ userMayR()

bool zypp::filesystem::PathInfo::userMayR ( ) const
inline

Definition at line 345 of file PathInfo.h.

◆ userMayW()

bool zypp::filesystem::PathInfo::userMayW ( ) const
inline

Definition at line 346 of file PathInfo.h.

◆ userMayX()

bool zypp::filesystem::PathInfo::userMayX ( ) const
inline

Definition at line 347 of file PathInfo.h.

◆ userMayRW()

bool zypp::filesystem::PathInfo::userMayRW ( ) const
inline

Definition at line 349 of file PathInfo.h.

◆ userMayRX()

bool zypp::filesystem::PathInfo::userMayRX ( ) const
inline

Definition at line 350 of file PathInfo.h.

◆ userMayWX()

bool zypp::filesystem::PathInfo::userMayWX ( ) const
inline

Definition at line 351 of file PathInfo.h.

◆ userMayRWX()

bool zypp::filesystem::PathInfo::userMayRWX ( ) const
inline

Definition at line 353 of file PathInfo.h.

◆ ino()

ino_t zypp::filesystem::PathInfo::ino ( ) const
inline

Definition at line 358 of file PathInfo.h.

◆ dev()

dev_t zypp::filesystem::PathInfo::dev ( ) const
inline

Definition at line 359 of file PathInfo.h.

◆ rdev()

dev_t zypp::filesystem::PathInfo::rdev ( ) const
inline

Definition at line 360 of file PathInfo.h.

◆ devMajor()

unsigned int zypp::filesystem::PathInfo::devMajor ( ) const

Definition at line 242 of file PathInfo.cc.

◆ devMinor()

unsigned int zypp::filesystem::PathInfo::devMinor ( ) const

Definition at line 252 of file PathInfo.cc.

◆ size()

off_t zypp::filesystem::PathInfo::size ( ) const
inline

Definition at line 368 of file PathInfo.h.

◆ blksize()

unsigned long zypp::filesystem::PathInfo::blksize ( ) const
inline

Definition at line 369 of file PathInfo.h.

◆ blocks()

unsigned long zypp::filesystem::PathInfo::blocks ( ) const
inline

Definition at line 370 of file PathInfo.h.

◆ atime()

time_t zypp::filesystem::PathInfo::atime ( ) const
inline

Definition at line 375 of file PathInfo.h.

◆ mtime()

time_t zypp::filesystem::PathInfo::mtime ( ) const
inline

Definition at line 376 of file PathInfo.h.

◆ ctime()

time_t zypp::filesystem::PathInfo::ctime ( ) const
inline

Definition at line 377 of file PathInfo.h.

Friends And Related Function Documentation

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  str,
const PathInfo obj 
)
friend

Definition at line 262 of file PathInfo.cc.

◆ operator<<() [2/2]

std::ostream & operator<< ( std::ostream &  str,
const PathInfo obj 
)
related

Stream output.

Definition at line 262 of file PathInfo.cc.

Member Data Documentation

◆ path_t

Pathname zypp::filesystem::PathInfo::path_t
private

Definition at line 381 of file PathInfo.h.

◆ statbuf_C

struct stat zypp::filesystem::PathInfo::statbuf_C
private

Definition at line 382 of file PathInfo.h.

◆ mode_e

Mode zypp::filesystem::PathInfo::mode_e
private

Definition at line 383 of file PathInfo.h.

◆ error_i

int zypp::filesystem::PathInfo::error_i
private

Definition at line 384 of file PathInfo.h.


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