ansys::Project::Path Class Reference
Last update: 19.05.2025Paths used for internal Project filesystem. More...
#include "Path.hpp"
Public Member Functions | |
| Path () | |
| Path (const std::string &pPath) | |
| Path (const char *pPath) | |
| bool | isNull () const |
| Indicates if the path is empty. More... | |
| std::vector< std::string > | getPathComponents () const |
| Return the path components as a vector of string. More... | |
| bool | isFolderPath () const |
| Indicates if the path is a folder path (ends with /) More... | |
| Path | getParentPath () const |
| Return the Path for the enclosing folder. More... | |
| std::string | getFilename () const |
| Return the filename part of the path. More... | |
| std::string | getFolderName () const |
| Return the folder name - only if Path is a folder path. More... | |
| Path | getRelativePathTo (const Path &pTarget) const |
| Convert a global path and a global target to a relative path to the target. More... | |
| const std::string & | str () const |
| Return as string. More... | |
| const char * | c_str () const |
| bool | operator== (const Path &pPath) const |
| bool | operator== (const std::string &pPathStr) const |
| bool | operator== (const char *pPathStr) const |
| bool | operator!= (const Path &pPath) const |
| bool | operator!= (const std::string &pPathStr) const |
| void | operator+= (const std::string &pPathStr) |
| Appends the string to the Path. More... | |
Static Public Member Functions | |
| static bool | isValidFilename (const std::string &pStr) |
| Check if the specified name is valid for a file. More... | |
| static bool | isValidPath (const std::string &pStr) |
| Check if the specified path is correct. More... | |
| static std::string | formatPath (const std::string &pPath, bool pFilenameOnly=false) |
| Converts a string to a valid path string. More... | |
Detailed Description
Paths used for internal Project filesystem.
The paths used for project filenames might differ from the actual disk storage, as the project might have different file/folder names or even virtual folders.
- A global path starts with /
- A relative path starts with ./
- Folder paths end with /
- Acceptable characters: Alphanumeric, _ - . + @
Constructor & Destructor Documentation
◆ Path() [1/3]
| ansys::Project::Path::Path | ( | ) |
◆ Path() [2/3]
| ansys::Project::Path::Path | ( | const std::string & | pPath | ) |
◆ Path() [3/3]
| ansys::Project::Path::Path | ( | const char * | pPath | ) |
Member Function Documentation
◆ c_str()
|
inline |
◆ formatPath()
|
static |
Converts a string to a valid path string.
Whitespace is strippped and invalid characters are replaced by _ Can also be used to check if a path is valid as-is.
- Parameters
-
pFilenameOnly : to check if the path is for a filename (not a folder)
◆ getFilename()
| std::string ansys::Project::Path::getFilename | ( | ) | const |
Return the filename part of the path.
If the path is a folder path, filename is empty
◆ getFolderName()
| std::string ansys::Project::Path::getFolderName | ( | ) | const |
Return the folder name - only if Path is a folder path.
◆ getParentPath()
◆ getPathComponents()
| std::vector< std::string > ansys::Project::Path::getPathComponents | ( | ) | const |
Return the path components as a vector of string.
Each folder component is returned with trailing /
/path/folder/filename will lead to: [ /, path/, folder/, filename ]
◆ getRelativePathTo()
Convert a global path and a global target to a relative path to the target.
◆ isFolderPath()
| bool ansys::Project::Path::isFolderPath | ( | ) | const |
Indicates if the path is a folder path (ends with /)
◆ isNull()
| bool ansys::Project::Path::isNull | ( | ) | const |
Indicates if the path is empty.
◆ isValidFilename()
|
static |
Check if the specified name is valid for a file.
- Returns
- false if the filename contains any invalid characters
◆ isValidPath()
|
static |
Check if the specified path is correct.
◆ operator!=() [1/2]
|
inline |
◆ operator!=() [2/2]
|
inline |
◆ operator+=()
| void ansys::Project::Path::operator+= | ( | const std::string & | pPathStr | ) |
Appends the string to the Path.
◆ operator==() [1/3]
|
inline |
◆ operator==() [2/3]
| bool ansys::Project::Path::operator== | ( | const Path & | pPath | ) | const |
◆ operator==() [3/3]
| bool ansys::Project::Path::operator== | ( | const std::string & | pPathStr | ) | const |
◆ str()
| const std::string & ansys::Project::Path::str | ( | ) | const |
Return as string.