libcommonc++
0.7
|
A class representing a filename. More...
#include <FileName.h++>
Public Member Functions | |
FileName () | |
Construct a new, empty FileName. More... | |
FileName (const String &path) | |
Construct a new FileName for the given path. More... | |
FileName (const String &dir, const String &filename) | |
Construct a new FileName for the given directory and filename. More... | |
FileName (const FileName &other) | |
Copy constructor. More... | |
FileName (const char *path) | |
Construct a new FileName for the given path. More... | |
FileName & | operator= (const FileName &other) |
Assignment operator. More... | |
FileName & | operator= (const String &path) |
Assignment operator. More... | |
FileName & | operator= (const char *path) |
Assignment operator. More... | |
~FileName () | |
Destructor. More... | |
String | toString () const |
Get a String representation of the FileName. More... | |
String | getPathName () const |
Get the full path represented by this FileName, as a String. More... | |
void | setPathName (const String &path) |
Set the path for this FileName. More... | |
String | getVolume () const |
Get the volume for this FileName. More... | |
void | setVolume (const String &volume) |
Set the volume for this FileName. More... | |
String | getDirectory () const |
Get the directory for this FileName. More... | |
void | setDirectory (const String &dir) |
Set the directory for this FileName. More... | |
FileName & | pushDirectory (const String &dir) |
Push a directory. More... | |
FileName & | popDirectory () |
Pop a directory. More... | |
String | getBaseName () const |
Get the base name from the FileName. More... | |
void | setBaseName (const String &name) |
Set the base name for the FileName. More... | |
String | getExtension () const |
Get the extension for the FileName. More... | |
void | setExtension (const String &ext) |
Set the extension for the FileName. More... | |
String | getFileName () const |
Get the filename for the FileName. More... | |
void | setFileName (const String &name) |
Set the filename for the FileName. More... | |
bool | isAbsolute () const |
Determine wheter the FileName represents an absolute or relative path. More... | |
FileName & | canonicalize () |
Canonicalize the FileName. More... | |
A class representing a filename.
The filename is composed of the following components, each of which can be individually modified:
Example: The Windows path C:\Program Files\TestProg\TestProg.exe
breaks down as follows:
Volume: C:
Directory: \Program Files\TestProg\
Filename: TestProg.exe
Base name: TestProg
Extension: exe
Construct a new FileName for the given directory and filename.
~FileName | ( | ) |
Destructor.
FileName & canonicalize | ( | ) |
Canonicalize the FileName.
All "." components are removed and all ".." components are resolved. If there are more ".." components than literal components, an empty path will result.
|
inline |
Get the volume for this FileName.
For non-Windows systems, this will be an empty string.
bool isAbsolute | ( | ) | const |
Determine wheter the FileName represents an absolute or relative path.
FileName & operator= | ( | const char * | path | ) |
Assignment operator.
FileName & popDirectory | ( | ) |
Pop a directory.
Removes the rightmost path component from the directory component of the FileName.
Push a directory.
The directory is added to the end of the directory component of the FileName.
dir | The directory to push. May include multiple path components. |
void setFileName | ( | const String & | name | ) |
Set the filename for the FileName.
name | The filename. If name contains no path separators, it simply becomes the new filename. If it begins with a path separator, the call does nothing. Otherwise, it is treated as a relative path: it is appended to the path, and then the entire path is reparsed, with the last component of name becoming the new filename. |
void setVolume | ( | const String & | volume | ) |
Set the volume for this FileName.
On non-Windows systems, this call has no effect.
|
inline |
Get a String representation of the FileName.
Equivalent to getPathName().