ROLAND  0.70
Amstrad Emulator based on Caprice Source rewritten in C++.
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
FileName Class Reference

[std::string] extension for filenames More...

#include <filename.h>

Inheritance diagram for FileName:
FileListItem

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
 

Detailed Description

[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.

Todo:
Drive/Root not yet considered.

Example:
Author
Fred Klaus

Constructor & Destructor Documentation

FileName ( )
inline
FileName ( const string &  filename)
inline
~FileName ( )
inline

Member Function Documentation

string base ( bool  ext = true) const
Bug:
with ext=false may couse bad name

References delim().

Referenced by Directory::Directory(), and ~FileName().

static char delim ( )
inlinestaticprivate
string ext ( bool  dot = true) const

Referenced by ~FileName().

bool isRelative ( )
Todo:
implement me

Referenced by set().

bool isValid ( )
Todo:
implement me

Referenced by set().

bool operator< ( const FileName fn)

for case sensitive or insensitive sorting

References mCaseSensitive.

Referenced by ~FileName().

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
Todo:
not yet implemented

References delim().

Referenced by ~FileName().

string relpath ( ) const

References delim().

Referenced by ~FileName().

void set ( const string &  filename)
inline
Todo:

used function -localtime- not threadsafe but -localtime_r- not included in MinGW !!

implement errorhandling

References isRelative(), isValid(), setBase(), setExt(), and setPath().

void setBase ( const string &  basename,
bool  ext = true 
)
Todo:
ext=false not yet implemented
See also
base

References delim().

Referenced by set().

static void setCaseSensitiveCompare ( bool  csc)
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().

void setPath ( const string &  path)

References delim().

Referenced by set().

Member Data Documentation

bool mCaseSensitive = false
staticprivate

The documentation for this class was generated from the following files: