15 #ifndef _A_UTILS_UTIL_FILESYSTEM_PATH_INCLUDED_
16 #define _A_UTILS_UTIL_FILESYSTEM_PATH_INCLUDED_
24 namespace filesystem {
76 Path(
const std::string& path);
93 operator std::string()
const;
272 class Implementation;
273 std::unique_ptr<Implementation> _impl;
274 friend
bool operator==(const
Path& lhs, const
Path& rhs);
303 std::ostream& operator<<(std::ostream& os, const
Path& p);
Exception class used by Path methods.
PathException(const std::string &message)
CTOR.
File/Directory path class.
Path(const std::string &path)
Initializing CTOR.
bool isAbsolute() const
Returns whether the current path is absolute.
Path & operator=(const Path &path)
Assignment Operator.
Path getLastElement() const
Get the name of the directory or file.
Path & append(const Path &path)
Appends a relative file or directory path or another file extension to the current path.
Path(const Path &path)
Copy CTOR.
Path & appendToBasename(const std::string &str)
Append a string to a basename.
Path & Clear()
Clears the path and resets it to the empty state.
Path & makeRelative()
Convert the path to a relative path relative to the current working directory.
Path getRootName() const
Get the root name of the directory/file.
Path getRootPath() const
Get the root path of the directory/file.
Path & replaceExtension(const std::string &extension)
Replace the extension of the path.
std::string toString(PathSeparator separator=PS_Native) const
Get the string representation of the current path using the specified separator.
bool setPath(const std::string &path)
Set the current path of the instance, handling platform aspects or any trailing slashes.
std::string getExtension() const
Get the extension of the file (without the '.
Path()
Default CTOR for an empty path.
Path & makeAbsolute()
Convert the path to an absolute path relative to the current working directory.
Path getParent() const
Get the parent path of the directory or file.
Path & makeCanonical()
Make the current path canonical.
bool isEmpty() const
Returns whether the current path is empty.
Path(const char *path)
Initializing CTOR.
Path & removeLastElement()
Remove the last part of the path, making it a directory path.
bool isRelative() const
Returns whether the current path is relative.
PathSeparator
Path separator types.
@ PS_ForwardSlash
Unix slash.
@ PS_BackwardSlash
Windows slash.
@ PS_Native
Native slash, depending on the current platform.
Path getRoot() const
Get the root path of the directory/file.
Definition of preprocessor macro DEV_ESSENTIAL_DEPRECATED.
#define DEV_ESSENTIAL_DEPRECATED(msg)
Adds [[deprecated("msg")]] to allowed declarations.
Path getWorkingDirectory()
Retrieve path to the working directory of the current process.
Serves as the root component, with common functionality documented in core functionality.