#include <Path.h>
Public Member Functions | |
| Path () | |
| Create a root path. | |
| Path (const char *path) | |
| Path (const std::string &path) | |
| Path (const std::vector< std::string > &compV) | |
| Create a path built from the strings in compV, by concatenating them with a path separator between each pair. | |
| void | appendComponent (const std::string &comp) |
| Append comp, preceded if necessary by a path separator. | |
| void | appendExtension (const std::string &ext) |
| Append ext, preceded if necessary by a dot. | |
| void | deleteLastComponent () |
| Delete the last path component from the object, along with any final path separator. | |
| void | deleteExtension () |
| Delete the extension (if any, and only the last). | |
| void | expandTilde () |
| Expand the initial component, if it begins with '~' or '~user', to its full path value. | |
| void | abbreviateWithTilde () |
| Abbreviate the initial component so that it becomes a path, with a tilde, '~', substituted for the full path to the current user's home directory, or '~user' for a user other than the current user. | |
| const bool | isAbsolute () const |
| Check if this in an absolute path (originating at the root). | |
| const std::vector< std::string > | getComponents () const |
| Return a vector of strings containing, in order, each path component of the path. | |
| const std::string | getLastComponent () const |
| Returns the last path component of the path. | |
| const std::string | getExtension () const |
| Return the path's extension, if any (not including the extension divider). | |
Static Public Attributes | |
| static const char | PATH_DELIM |
| Token used to separate path components, '/' on UNIX. | |
| Path::Path | ( | ) | [inline] |
Create a root path.
| Path::Path | ( | const char * | path | ) | [inline] |
| Path::Path | ( | const std::string & | path | ) | [inline] |
| Path::Path | ( | const std::vector< std::string > & | compV | ) |
Create a path built from the strings in compV, by concatenating them with a path separator between each pair.
To create an absolute path, use a path delimiter as the first component. To include a trailing path divider, use an empty string as the last component.
| void Path::abbreviateWithTilde | ( | ) |
Abbreviate the initial component so that it becomes a path, with a tilde, '~', substituted for the full path to the current user's home directory, or '~user' for a user other than the current user.
Unaltered if it doesn't begin with the user?s home directory.
| void Path::appendComponent | ( | const std::string & | comp | ) |
Append comp, preceded if necessary by a path separator.
| void Path::appendExtension | ( | const std::string & | ext | ) |
Append ext, preceded if necessary by a dot.
| void Path::deleteExtension | ( | ) |
Delete the extension (if any, and only the last).
Strips any trailing path separator before checking for an extension. If the path represents the root path, however, it is unaltered.
| void Path::deleteLastComponent | ( | ) |
Delete the last path component from the object, along with any final path separator.
If the path represents the root path, however, it is unaltered.
| void Path::expandTilde | ( | ) |
Expand the initial component, if it begins with '~' or '~user', to its full path value.
The path remains unaltered if that component cannot be expanded.
| const std::vector<std::string> Path::getComponents | ( | ) | const |
Return a vector of strings containing, in order, each path component of the path.
The strings in the vector appear in the order they did in the path. If the path begins or ends with the path separator, then the first or last component, respectively, will contain the separator. Empty components (caused by consecutive path separators) are deleted.
| const std::string Path::getExtension | ( | ) | const |
Return the path's extension, if any (not including the extension divider).
| const std::string Path::getLastComponent | ( | ) | const |
Returns the last path component of the path.
| const bool Path::isAbsolute | ( | ) | const [inline] |
Check if this in an absolute path (originating at the root).
const char Path::PATH_DELIM [static] |
Token used to separate path components, '/' on UNIX.
1.4.7