ROLAND
0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
|
[std::string] extension for filenames More...
#include <filename.h>
Public Member Functions | |
FileName () | |
FileName (const string &filename) | |
~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) |
Static Private Member Functions | |
static char | delim () |
Static Private Attributes | |
static bool | mCaseSensitive = false |
[std::string] extension for filenames
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.
|
inline |
|
inline |
|
inline |
References base(), ext(), operator<(), operator==(), path(), qualified(), and relpath().
string base | ( | bool | ext = true | ) | const |
References delim().
Referenced by Directory::Directory(), and ~FileName().
|
inlinestaticprivate |
Referenced by base(), path(), qualified(), relpath(), setBase(), setCaseSensitiveCompare(), and setPath().
string ext | ( | bool | dot = true | ) | const |
Referenced by ~FileName().
bool operator< | ( | const FileName & | fn | ) |
bool operator== | ( | const FileName & | fn | ) |
for case sensitive or insensitive equalization
References mCaseSensitive.
Referenced by ~FileName().
string path | ( | ) | const |
References delim().
Referenced by ~FileName().
string qualified | ( | ) | const |
string relpath | ( | ) | const |
References delim().
Referenced by ~FileName().
|
inline |
void setBase | ( | const string & | basename, |
bool | ext = true |
||
) |
|
inlinestatic |
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.
References delim(), and mCaseSensitive.
Referenced by Directory::sort().
void setExt | ( | const string & | extension | ) |
Referenced by set().
|
staticprivate |
Referenced by operator<(), operator==(), and setCaseSensitiveCompare().