#include <filename.h>
Public Member Functions | |
FileName (const string &filename) | |
bool | operator< (const FileName &fn) |
bool | operator== (const FileName &fn) |
string | qualified () const |
string | base (bool ext=true) const |
string | path () const |
string | relpath () const |
string | ext (bool dot=true) const |
void | set (const string &filename) |
void | setBase (const string &basename, bool ext=true) |
void | setExt (const string &extension) |
void | setPath (const string &path) |
bool | isValid () |
bool | isRelative () |
Static Public Member Functions | |
static void | setCaseSensitiveCompare (bool csc) |
This class is derived from std::string and is nothing more or less than that, with additional functions to extract parts of a filename in a cross-safe manner under consideration of the different delimiters and the Drive/Root thing of Linux and Win32. It is also possible to sort FileNames caseinsensitive (the default) in STL containers. Also, no slicing can occure by passing pointers of FileNames, because no additional variables are added at all. Just use it as an ordinary std::string.
bool FileName::operator< | ( | const FileName & | fn | ) |
for case sensitive or insensitive sorting
bool FileName::operator== | ( | const FileName & | fn | ) |
for case sensitive or insensitive equalization
string FileName::qualified | ( | ) | const |
string FileName::base | ( | bool | ext = true |
) | const |
void FileName::set | ( | const string & | filename | ) | [inline] |
implement errorhandling
void FileName::setBase | ( | const string & | basename, | |
bool | ext = true | |||
) |
bool FileName::isValid | ( | ) |
bool FileName::isRelative | ( | ) |
static void FileName::setCaseSensitiveCompare | ( | bool | csc | ) | [inline, static] |
Sets wether the operator< should work case sensitive. Switches a static private variable and is therefore NOT THREADSAFE but in most cases riskless. Asynchronus setting this vally may cause mixed sorted Filenames.