FilePath represents a path to a file or directory name. More...
#include <filepath.h>
Public Member Functions | |
bool | exists () const |
FilePath | filename () const |
Returns filename of the FilePath object by pruning the path off. More... | |
FilePath (const string &path="", bool check_exists=false) | |
Constructor. More... | |
bool | isBlockSpecial () const |
bool | isCharSpecial () const |
bool | isDirectory () const |
bool | isFifo () const |
bool | isRegular () const |
bool | isSocket () const |
operator string () const | |
FilePath | operator+ (const FilePath &name) const |
Concatenates FilePath objects. More... | |
FilePath & | operator= (const string &rhs) |
Protected Member Functions | |
void | check () const |
This function sets _checked to true, stats the path, to see if it exists and to determine what type of file it is. More... | |
void | pruneTrailingSeparator () |
Prunes the trailing separator of a specified path. More... | |
Detailed Description
FilePath represents a path to a file or directory name.
FilePath has member functions to check if the file path is a valid file system entity, and to check what kind of file system entity it is, e.g. is it a file, a directory, a pipe etc.
Constructor & Destructor Documentation
◆ FilePath()
zipios::FilePath::FilePath | ( | const string & | path = "" , |
bool | check_exists = false |
||
) |
Constructor.
- Parameters
-
path A string representation of the path. check_exists If true is specified the constructor will check the existence and type of the path immidiately, instead of deferring that task until it is needed.
References exists(), and pruneTrailingSeparator().
Member Function Documentation
◆ check()
|
protected |
This function sets _checked to true, stats the path, to see if it exists and to determine what type of file it is.
All the query functions check if _checked is true, and if it isn't they call check(). This means stat'ing is deferred until it becomes necessary.
◆ exists()
bool zipios::FilePath::exists | ( | ) | const |
- Returns
- true If the path is a valid file system entity.
Referenced by FilePath().
◆ filename()
FilePath zipios::FilePath::filename | ( | ) | const |
Returns filename of the FilePath object by pruning the path off.
◆ isBlockSpecial()
bool zipios::FilePath::isBlockSpecial | ( | ) | const |
- Returns
- true if the path is block special (a block device file).
◆ isCharSpecial()
bool zipios::FilePath::isCharSpecial | ( | ) | const |
- Returns
- true if the path is character special (a character device file).
◆ isDirectory()
bool zipios::FilePath::isDirectory | ( | ) | const |
- Returns
- true if the path is a directory.
◆ isFifo()
bool zipios::FilePath::isFifo | ( | ) | const |
- Returns
- true if the path is a Fifo (a pipe).
◆ isRegular()
bool zipios::FilePath::isRegular | ( | ) | const |
- Returns
- true if the path is a regular file.
◆ isSocket()
bool zipios::FilePath::isSocket | ( | ) | const |
- Returns
- true if the path is a socket.
◆ operator string()
zipios::FilePath::operator string | ( | ) | const |
◆ operator+()
Concatenates FilePath objects.
A file separator is inserted if appropriate.
◆ operator=()
FilePath & zipios::FilePath::operator= | ( | const string & | rhs | ) |
◆ pruneTrailingSeparator()
|
protected |
Prunes the trailing separator of a specified path.
Referenced by FilePath().
The documentation for this class was generated from the following files:
- src/zipios++/filepath.h
- src/zipios++/filepath.cpp