VR-Link API Documentation for HLA 1516
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Attributes
DtFilename Class Reference

Instances of DtFilename are DtStrings which convert filenames to the native format. More...

+ Inheritance diagram for DtFilename:
+ Collaboration diagram for DtFilename:

List of all members.

Public Member Functions

 DtFilename ()
 default constructor
 DtFilename (const char *str)
 constructor
virtual ~DtFilename ()
 destructor
 DtFilename (const DtFilename &orig)
 copy constructor
DtFilenameoperator= (const DtFilename &orig)
 assignment operator
DtFilenameoperator= (const DtString &orig)
 assignment operators
DtFilenameoperator= (const char *orig)
 assignment operators
virtual bool absolute () const
 Returns true if the filename is an absolute filename, or a relative filename, respectively.
virtual bool relative () const
virtual void append (DtFilename const &filename)
 This filename is considered a path and the supplied filename is appended.
virtual void prepend (DtFilename const &pathName)
 This filename is considered a relative path (or filename) and the supplied path is prepended.
virtual DtString extension () const
 Returns the file extension, which are all the characters following the last '.
virtual void setExtension (const DtString &extension)
 Sets the extension for the filename, if the existing file has an extension it is removed, else this extension is appended.
virtual void stripFilename ()
 Strip the filename from this path.
virtual void stripPath ()
 Strip the path from this filename.
virtual void stripExtension ()
 Strip the extension from the filename.
virtual bool isWritable () const
 Returns true if the filename is writable.
virtual bool isReadable () const
 Return true if the filename is readable.
virtual unsigned long fileLength () const
 Returns the size of the file in bytes.
virtual bool exists () const
 Returns true if the filename exists.

Static Public Member Functions

static const DtFilenamenullFilename ()
 Return empty filename.
static DtFilename stripFilename (const DtFilename &orig)
 Strip the filename from a path.
static DtFilename stripPath (const DtFilename &orig)
 Strip the path from a filename.
static DtFilename stripExtension (const DtFilename &orig)
 Strip the extension from a filename.
static DtFilename combine (const DtFilename &path, const DtFilename &filename)
 Constructs a new filename by combining the path with filename, which is an absolute or relative path.
static char separator ()
 Returns the separator used in representing directories.

Protected Member Functions

void replaceSlashes ()
 Replaces slashes.

Static Protected Attributes

static const char theSeparator

Detailed Description

Instances of DtFilename are DtStrings which convert filenames to the native format.


Constructor & Destructor Documentation

default constructor

DtFilename::DtFilename ( const char *  str)

constructor

virtual DtFilename::~DtFilename ( ) [virtual]

destructor

copy constructor


Member Function Documentation

virtual bool DtFilename::absolute ( ) const [virtual]

Returns true if the filename is an absolute filename, or a relative filename, respectively.

virtual void DtFilename::append ( DtFilename const &  filename) [virtual]

This filename is considered a path and the supplied filename is appended.

The filename may be an absolute or relative path. If the filename is absolute, then it replaces this one. A separator is inserted between this path and the filename if necessary.

static DtFilename DtFilename::combine ( const DtFilename path,
const DtFilename filename 
) [static]

Constructs a new filename by combining the path with filename, which is an absolute or relative path.

If the filename is an absolute filename, then filename is returned. If the filename is a relative filename, then path is prepended to it. If path is empty, then the filename is returned.

virtual bool DtFilename::exists ( ) const [virtual]

Returns true if the filename exists.

virtual DtString DtFilename::extension ( ) const [virtual]

Returns the file extension, which are all the characters following the last '.

' period. If there is no extension in the filename, an empty string is returned.

virtual unsigned long DtFilename::fileLength ( ) const [virtual]

Returns the size of the file in bytes.

If file does not exist results are undefined.

virtual bool DtFilename::isReadable ( ) const [virtual]

Return true if the filename is readable.

virtual bool DtFilename::isWritable ( ) const [virtual]

Returns true if the filename is writable.

static const DtFilename& DtFilename::nullFilename ( ) [static]

Return empty filename.

DtFilename& DtFilename::operator= ( const DtFilename orig)

assignment operator

DtFilename& DtFilename::operator= ( const DtString orig)

assignment operators

Reimplemented from DtString.

DtFilename& DtFilename::operator= ( const char *  orig)

assignment operators

Reimplemented from DtString.

virtual void DtFilename::prepend ( DtFilename const &  pathName) [virtual]

This filename is considered a relative path (or filename) and the supplied path is prepended.

The path name may be an absolute or relative path. If this filename is absolute it is left unchanged. A separator is inserted between the path and this filename if necessary.

virtual bool DtFilename::relative ( ) const [virtual]
void DtFilename::replaceSlashes ( ) [protected]

Replaces slashes.

On unix, this replaces backslashes with forward slashes. Vice versa on win32. Hail Mr Gates. This is not virtual, because we call this from the constructors and destructor.

static char DtFilename::separator ( ) [static]

Returns the separator used in representing directories.

virtual void DtFilename::setExtension ( const DtString extension) [virtual]

Sets the extension for the filename, if the existing file has an extension it is removed, else this extension is appended.

The extension string does NOT need a leading period.

virtual void DtFilename::stripExtension ( ) [virtual]

Strip the extension from the filename.

This will remove all characters after the last '.' in the filename including the '.'. The implementation: DtFilename path = DtFilename::stripFilename(*this); this->stripPath(); this->snipBack('.'); this->prepend(path);

static DtFilename DtFilename::stripExtension ( const DtFilename orig) [static]

Strip the extension from a filename.

virtual void DtFilename::stripFilename ( ) [virtual]

Strip the filename from this path.

static DtFilename DtFilename::stripFilename ( const DtFilename orig) [static]

Strip the filename from a path.

virtual void DtFilename::stripPath ( ) [virtual]

Strip the path from this filename.

static DtFilename DtFilename::stripPath ( const DtFilename orig) [static]

Strip the path from a filename.


Member Data Documentation

const char DtFilename::theSeparator [static, protected]

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

Document ID: Generated on Mon May 14 08:06:18 EDT 2012 from SVN revision 114750
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)