The class for file path operations.
More...
#include <filepath.h>
|
| filepath (const std::string &path) |
| Construct a new filepath object.
|
|
| filepath (const filepath &other) |
| Construct a new filepath object by copy.
|
|
filepath & | operator= (const filepath &other) |
| Assign operator, assign a new filepath object by copy.
|
|
| ~filepath ()=default |
| Destroy the filepath object.
|
|
std::string | str () const |
| Get the string of the filepath.
|
|
filepath | join (const std::string &filename) const |
| Join the current filepath with a new filename.
|
|
bool | exists () const |
| Check if the filepath is exists.
|
|
bool | readable () const |
| Check if the filepath is readable.
|
|
bool | writable () const |
| Check if the filepath is writable.
|
|
bool | executable () const |
| Check if the filepath is executable.
|
|
filetype | type () const |
| Get the file type of the filepath.
|
|
bool | isfile () const |
| Check if the filepath is a regular file.
|
|
bool | isdir () const |
| Check if the filepath is a directory.
|
|
bool | issymlink () const |
| Check if the filepath is a symbolic link.
|
|
std::string | dirname () const |
| Get the parent directory of the filepath.
|
|
std::string | basename () const |
| Get the filename or directory name of the filepath.
|
|
std::string | realpath () const |
| Get the real path referenced by symbolic link.
|
|
std::string | abspath () const |
| Get the absolute path of the filepath.
|
|
std::string | extension () const |
| Get the extension of the filepath.
|
|
|
static char | separator () |
| Get the path separator of the current os platform.
|
|
The class for file path operations.
◆ filepath() [1/2]
cutl::filepath::filepath |
( |
const std::string & | path | ) |
|
Construct a new filepath object.
- Parameters
-
◆ filepath() [2/2]
cutl::filepath::filepath |
( |
const filepath & | other | ) |
|
Construct a new filepath object by copy.
- Parameters
-
other | other filepath object |
◆ abspath()
std::string cutl::filepath::abspath |
( |
| ) |
const |
Get the absolute path of the filepath.
- Returns
- std::string the absolute path of the filepath.
◆ basename()
std::string cutl::filepath::basename |
( |
| ) |
const |
Get the filename or directory name of the filepath.
- Returns
- filename or directory name
◆ dirname()
std::string cutl::filepath::dirname |
( |
| ) |
const |
Get the parent directory of the filepath.
- Returns
- parent directory path
◆ executable()
bool cutl::filepath::executable |
( |
| ) |
const |
Check if the filepath is executable.
- Returns
- true means executable, false means not executable.
◆ exists()
bool cutl::filepath::exists |
( |
| ) |
const |
Check if the filepath is exists.
- Returns
- true means the filepath is exists, otherwise not exists.
◆ extension()
std::string cutl::filepath::extension |
( |
| ) |
const |
Get the extension of the filepath.
- Returns
- extension with dot
◆ isdir()
bool cutl::filepath::isdir |
( |
| ) |
const |
Check if the filepath is a directory.
- Returns
- true means directory, false means not directory.
◆ isfile()
bool cutl::filepath::isfile |
( |
| ) |
const |
Check if the filepath is a regular file.
- Returns
- true mena regular file, false means not regular file.
◆ issymlink()
bool cutl::filepath::issymlink |
( |
| ) |
const |
Check if the filepath is a symbolic link.
- Returns
- true means symbolic link, false means not symbolic link.
◆ join()
filepath cutl::filepath::join |
( |
const std::string & | filename | ) |
const |
Join the current filepath with a new filename.
- Parameters
-
filename | the filename to be joined |
- Returns
- the new filepath object
◆ operator=()
Assign operator, assign a new filepath object by copy.
- Parameters
-
other | other filepath object |
- Returns
- filepath& the reference of the current filepath object
◆ readable()
bool cutl::filepath::readable |
( |
| ) |
const |
Check if the filepath is readable.
- Returns
- true means readable, false means not readable.
◆ realpath()
std::string cutl::filepath::realpath |
( |
| ) |
const |
Get the real path referenced by symbolic link.
- Note
- This function only works on Unix-like systems, not support on Windows.
- Returns
- real path referenced by symbolic link or shortcuts
◆ separator()
static char cutl::filepath::separator |
( |
| ) |
|
|
static |
Get the path separator of the current os platform.
- Returns
- the path separator
◆ str()
std::string cutl::filepath::str |
( |
| ) |
const |
Get the string of the filepath.
- Returns
- the filepath
◆ type()
Get the file type of the filepath.
- Returns
- file type
◆ writable()
bool cutl::filepath::writable |
( |
| ) |
const |
Check if the filepath is writable.
- Returns
- true menas writable, false means not writable.
The documentation for this class was generated from the following file: