#include <PathInfo.h>
Public Types | |
| enum | Mode { STAT, LSTAT } |
| enum | file_type { NOT_AVAIL = 0x00, NOT_EXIST = 0x01, T_FILE = 0x02, T_DIR = 0x04, T_CHARDEV = 0x08, T_BLOCKDEV = 0x10, T_FIFO = 0x20, T_LINK = 0x40, T_SOCKET = 0x80 } |
| enum | ZIP_TYPE { ZT_NONE, ZT_GZ, ZT_BZ2 } |
| typedef std::list < direntry > | dircontent |
Public Member Functions | |
| PathInfo (const Pathname &path="", Mode initial=STAT) | |
| PathInfo (const std::string &path, Mode initial=STAT) | |
| PathInfo (const char *path, Mode initial=STAT) | |
| virtual | ~PathInfo () |
| const Pathname & | path () const |
| const std::string & | asString () const |
| Mode | mode () const |
| int | error () const |
| void | setPath (const Pathname &path) |
| void | setMode (Mode mode) |
| bool | stat (const Pathname &path) |
| bool | lstat (const Pathname &path) |
| bool | operator() (const Pathname &path) |
| bool | stat () |
| bool | lstat () |
| bool | operator() () |
| bool | isExist () const |
| file_type | fileType () const |
| bool | isFile () const |
| bool | isDir () const |
| bool | isLink () const |
| bool | isChr () const |
| bool | isBlk () const |
| bool | isFifo () const |
| bool | isSock () const |
| nlink_t | nlink () const |
| uid_t | owner () const |
| gid_t | group () 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 |
| mode_t | uperm () const |
| mode_t | gperm () const |
| mode_t | operm () const |
| mode_t | perm () const |
| bool | isPerm (mode_t m) const |
| bool | hasPerm (mode_t m) const |
| mode_t | st_mode () const |
| mode_t | userMay () const |
| bool | userMayR () const |
| bool | userMayW () const |
| bool | userMayX () const |
| bool | userMayRW () const |
| bool | userMayRX () const |
| bool | userMayWX () const |
| bool | userMayRWX () const |
| dev_t | dev () const |
| dev_t | rdev () const |
| ino_t | ino () const |
| off_t | size () const |
| unsigned long | blksize () const |
| unsigned long | blocks () const |
| time_t | atime () const |
| time_t | mtime () const |
| time_t | ctime () const |
Static Public Member Functions | |
| static int | mkdir (const Pathname &path, unsigned mode=0755) |
| static int | assert_dir (const Pathname &path, unsigned mode=0755) |
| static int | rmdir (const Pathname &path) |
| static int | recursive_rmdir (const Pathname &path) |
| static int | clean_dir (const Pathname &path) |
| static int | copy_dir (const Pathname &srcpath, const Pathname &destpath) |
| static int | readdir (std::list< std::string > &retlist, const Pathname &path, bool dots=true) |
| static int | readdir (dircontent &retlist, const Pathname &path, bool dots=true, Mode statmode=STAT) |
| static int | unlink (const Pathname &path) |
| static int | rename (const Pathname &oldpath, const Pathname &newpath) |
| static int | copy (const Pathname &file, const Pathname &dest) |
| static int | symlink (const Pathname &oldpath, const Pathname &newpath) |
| static int | hardlink (const Pathname &oldpath, const Pathname &newpath) |
| static int | copy_file2dir (const Pathname &file, const Pathname &dest) |
| static std::string | md5sum (const Pathname &file) |
| static std::string | sha1sum (const Pathname &file) |
| static int | erase (const Pathname &path) |
| static int | chmod (const Pathname &path, mode_t mode) |
| static ZIP_TYPE | zipType (const Pathname &file) |
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) |
| std::ostream & | operator<< (std::ostream &str, file_type obj) |
Classes | |
| class | devino_cache |
| Simple cache remembering device/inode to detect hardlinks. More... | |
| struct | direntry |
| class | stat_mode |
| Wrapper class for mode_t values as derived from stat. More... | |
| typedef std::list<direntry> PathInfo::dircontent |
| enum PathInfo::Mode |
| enum PathInfo::file_type |
| enum PathInfo::ZIP_TYPE |
| PathInfo::PathInfo | ( | const std::string & | path, | |
| Mode | initial = STAT | |||
| ) |
| PathInfo::PathInfo | ( | const char * | path, | |
| Mode | initial = STAT | |||
| ) |
| virtual PathInfo::~PathInfo | ( | ) | [virtual] |
| const Pathname& PathInfo::path | ( | ) | const [inline] |
| const std::string& PathInfo::asString | ( | ) | const [inline] |
| Mode PathInfo::mode | ( | ) | const [inline] |
| int PathInfo::error | ( | ) | const [inline] |
| void PathInfo::setPath | ( | const Pathname & | path | ) | [inline] |
| void PathInfo::setMode | ( | Mode | mode | ) | [inline] |
| bool PathInfo::stat | ( | const Pathname & | path | ) | [inline] |
| bool PathInfo::lstat | ( | const Pathname & | path | ) | [inline] |
| bool PathInfo::operator() | ( | const Pathname & | path | ) | [inline] |
| bool PathInfo::stat | ( | ) | [inline] |
| bool PathInfo::lstat | ( | ) | [inline] |
| bool PathInfo::operator() | ( | ) |
| bool PathInfo::isExist | ( | ) | const [inline] |
| file_type PathInfo::fileType | ( | ) | const |
| bool PathInfo::isFile | ( | ) | const [inline] |
| bool PathInfo::isDir | ( | ) | const [inline] |
| bool PathInfo::isLink | ( | ) | const [inline] |
| bool PathInfo::isChr | ( | ) | const [inline] |
| bool PathInfo::isBlk | ( | ) | const [inline] |
| bool PathInfo::isFifo | ( | ) | const [inline] |
| bool PathInfo::isSock | ( | ) | const [inline] |
| nlink_t PathInfo::nlink | ( | ) | const [inline] |
| uid_t PathInfo::owner | ( | ) | const [inline] |
| gid_t PathInfo::group | ( | ) | const [inline] |
| bool PathInfo::isRUsr | ( | ) | const [inline] |
| bool PathInfo::isWUsr | ( | ) | const [inline] |
| bool PathInfo::isXUsr | ( | ) | const [inline] |
| bool PathInfo::isR | ( | ) | const [inline] |
| bool PathInfo::isW | ( | ) | const [inline] |
| bool PathInfo::isX | ( | ) | const [inline] |
| bool PathInfo::isRGrp | ( | ) | const [inline] |
| bool PathInfo::isWGrp | ( | ) | const [inline] |
| bool PathInfo::isXGrp | ( | ) | const [inline] |
| bool PathInfo::isROth | ( | ) | const [inline] |
| bool PathInfo::isWOth | ( | ) | const [inline] |
| bool PathInfo::isXOth | ( | ) | const [inline] |
| bool PathInfo::isUid | ( | ) | const [inline] |
| bool PathInfo::isGid | ( | ) | const [inline] |
| bool PathInfo::isVtx | ( | ) | const [inline] |
| mode_t PathInfo::uperm | ( | ) | const [inline] |
| mode_t PathInfo::gperm | ( | ) | const [inline] |
| mode_t PathInfo::operm | ( | ) | const [inline] |
| mode_t PathInfo::perm | ( | ) | const [inline] |
| bool PathInfo::isPerm | ( | mode_t | m | ) | const [inline] |
| bool PathInfo::hasPerm | ( | mode_t | m | ) | const [inline] |
| mode_t PathInfo::st_mode | ( | ) | const [inline] |
| mode_t PathInfo::userMay | ( | ) | const |
| bool PathInfo::userMayR | ( | ) | const [inline] |
| bool PathInfo::userMayW | ( | ) | const [inline] |
| bool PathInfo::userMayX | ( | ) | const [inline] |
| bool PathInfo::userMayRW | ( | ) | const [inline] |
| bool PathInfo::userMayRX | ( | ) | const [inline] |
| bool PathInfo::userMayWX | ( | ) | const [inline] |
| bool PathInfo::userMayRWX | ( | ) | const [inline] |
| dev_t PathInfo::dev | ( | ) | const [inline] |
| dev_t PathInfo::rdev | ( | ) | const [inline] |
| ino_t PathInfo::ino | ( | ) | const [inline] |
| off_t PathInfo::size | ( | ) | const [inline] |
| unsigned long PathInfo::blksize | ( | ) | const [inline] |
| unsigned long PathInfo::blocks | ( | ) | const [inline] |
| time_t PathInfo::atime | ( | ) | const [inline] |
| time_t PathInfo::mtime | ( | ) | const [inline] |
| time_t PathInfo::ctime | ( | ) | const [inline] |
| static int PathInfo::mkdir | ( | const Pathname & | path, | |
| unsigned | mode = 0755 | |||
| ) | [static] |
Like 'mkdir'. Attempt to create a new directory named path. mode specifies the permissions to use. It is modified by the process's umask in the usual way.
| static int PathInfo::assert_dir | ( | const Pathname & | path, | |
| unsigned | mode = 0755 | |||
| ) | [static] |
Like 'mkdir -p'. No error if directory exists. Make parent directories as needed. mode specifies the permissions to use, if directories have to be created. It is modified by the process's umask in the usual way.
| static int PathInfo::rmdir | ( | const Pathname & | path | ) | [static] |
Like 'rmdir'. Delete a directory, which must be empty.
| static int PathInfo::recursive_rmdir | ( | const Pathname & | path | ) | [static] |
Like 'rm -r DIR'. Delete a directory, recursively removing its contents.
| static int PathInfo::clean_dir | ( | const Pathname & | path | ) | [static] |
Like 'rm -r DIR/ *'. Delete directory contents, but keep the directory itself.
Like 'cp -a srcpath destpath'. Copy directory tree. srcpath/destpath must be directories. 'basename srcpath' must not exist in destpath.
| static int PathInfo::readdir | ( | std::list< std::string > & | retlist, | |
| const Pathname & | path, | |||
| bool | dots = true | |||
| ) | [static] |
Return content of directory via retlist. If dots is false entries starting with '.' are not reported. "." and ".." are never reported.
| static int PathInfo::readdir | ( | dircontent & | retlist, | |
| const Pathname & | path, | |||
| bool | dots = true, |
|||
| Mode | statmode = STAT | |||
| ) | [static] |
Return content of directory via retlist. If dots is false entries starting with '.' are not reported. "." and ".." are never reported.
The type of individual directory entries is determined accoding to statmode (i.e. via stat or lstat).
| static int PathInfo::unlink | ( | const Pathname & | path | ) | [static] |
Like 'unlink'. Delete a file (symbolic link, socket, fifo or device).
Like 'rename'. Renames a file, moving it between directories if required.
Like 'cp file dest'. Copy file to destination file.
Like 'symlink'. Creates a symbolic link named newpath which contains the string oldpath. If newpath exists it will not be overwritten.
Like 'link'. Creates a hard link named newpath to an existing file oldpath. If newpath exists it will not be overwritten.
Like 'cp file dest'. Copy file to dest dir.
| static std::string PathInfo::md5sum | ( | const Pathname & | file | ) | [static] |
Compute a files md5sum.
| static std::string PathInfo::sha1sum | ( | const Pathname & | file | ) | [static] |
Compute a files sha1sum.
| static int PathInfo::erase | ( | const Pathname & | path | ) | [static] |
Erase whatever happens to be located at path (file or directory).
| static int PathInfo::chmod | ( | const Pathname & | path, | |
| mode_t | mode | |||
| ) | [static] |
Like 'chmod'. The mode of the file given by path is changed.
| std::ostream& operator<< | ( | std::ostream & | str, | |
| const PathInfo & | obj | |||
| ) | [friend] |
| std::ostream& operator<< | ( | std::ostream & | str, | |
| file_type | obj | |||
| ) | [friend] |
Pathname PathInfo::path_t [private] |
struct stat PathInfo::statbuf_C [read, private] |
Mode PathInfo::mode_e [private] |
int PathInfo::error_i [private] |
1.5.3