VR-Link API Documentation for HLA 1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | 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:

Public Member Functions

 DtFilename ()
 default constructor More...
 
 DtFilename (const char *str)
 constructor More...
 
virtual ~DtFilename ()
 destructor More...
 
 DtFilename (const DtFilename &orig)
 copy constructor More...
 
DtFilenameoperator= (const DtFilename &orig)
 assignment operator More...
 
DtFilenameoperator= (const DtString &orig)
 
DtFilenameoperator= (const char *orig)
 
virtual bool absolute () const
 Returns true if the filename is an absolute filename, or a relative filename, respectively. More...
 
virtual bool relative () const
 
virtual void append (DtFilename const &filename)
 This filename is considered a path and the supplied filename is appended. More...
 
virtual void prepend (DtFilename const &pathName)
 This filename is considered a relative path (or filename) and the supplied path is prepended. More...
 
virtual DtString extension () const
 Returns the file extension, which are all the characters following the last '. More...
 
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. More...
 
virtual void stripFilename ()
 Strip the filename from this path. More...
 
virtual void stripPath ()
 Strip the path from this filename. More...
 
virtual void stripExtension ()
 Strip the extension from the filename. More...
 
virtual bool isWritable () const
 Returns true if the filename is writable. More...
 
virtual bool isReadable () const
 Return true if the filename is readable. More...
 
virtual unsigned long fileLength () const
 Returns the size of the file in bytes. More...
 
virtual bool exists () const
 Returns true if the filename exists. More...
 
virtual bool searchAlternatePath (const char *theAlternatePath)
 Search for this file, first using this filename. More...
 
- Public Member Functions inherited from DtString
 DtString ()
 Default CTOR. More...
 
 DtString (const char *str)
 CTOR. More...
 
 DtString (const char *str, int length)
 CTOR (fixed length). More...
 
 DtString (const std::string &str)
 CTOR (std::string). More...
 
 DtString (const DtString &orig)
 Copy CTOR. More...
 
virtual ~DtString ()
 Virtual DTOR. More...
 
virtual operator const char * () const
 Cast operator. More...
 
virtual DtStringclone () const
 Clone operator. More...
 
virtual void tokenize (const char delimiter, std::vector< DtString > &tokens) const
 Tokenize the string baseed on the input character. More...
 
virtual int toInt (bool *ok=0) const
 Conversion to integer, if ok is provided ok is set if conversion succeeds. More...
 
virtual unsigned int toUInt (bool *ok=0) const
 Conversion to unsigned integer, if ok is provided ok is set if conversion succeeds. More...
 
virtual float toFloat (bool *ok=0) const
 Convert to floating point. More...
 
virtual double toDouble (bool *ok=0) const
 Convert to double precision floating point. More...
 
virtual bool toBoolean (bool *ok=0) const
 Convert to double precision floating point. More...
 
virtual void toUpper ()
 Convert this string's alphabetic characters to uppercase. More...
 
virtual void toLower ()
 Convert this string's alphabetic characters to lowercase. More...
 
virtual int findChar (const char ch)
 Search the string for first occurrence of a character and return its index. More...
 
virtual int findLastChar (const char ch)
 Search the string for the last occurrence of a character and return its index. More...
 
virtual int findString (const DtString &string) const
 Search the string for the first occurrence of another string and return the starting index. More...
 
virtual int findLastString (const DtString &string)
 Search the string for the last occurrence of another string and return the starting index. More...
 
bool snipFrontToLast (const char ch)
 
bool snipBackToFirst (const char ch)
 
virtual int count (const char ch) const
 Returns the number of occurrences of the character. More...
 
virtual int length () const
 length() - Exactly the same as size(): More...
 
virtual int size () const
 size() - returns the length of the string not including the terminating '\0' More...
 
virtual std::string stdString () const
 stdString() - returns a standard string representation of the DtString More...
 
virtual const char * string () const
 string() - Returns a char * representation of the DtString: deprecated More...
 
virtual const char * c_str () const
 Returns a char* representation of the DtString;. More...
 
virtual bool isEmpty () const
 returns true if the string is empty, where empty is size() == 0 More...
 
virtual DtString section (const char sep, int start, int end=-1) const
 returns a section of the string based on the separator. More...
 
 DtString (double val)
 Constructors for creating DtString representations of numbers. More...
 
 DtString (int val)
 Constructors for creating DtString representations of numbers. More...
 
 DtString (long val)
 Constructors for creating DtString representations of numbers. More...
 
 DtString (char val)
 Constructors for creating DtString representations of numbers. More...
 
 DtString (unsigned int val)
 Constructors for creating DtString representations of numbers. More...
 
 DtString (unsigned long val)
 Constructors for creating DtString representations of numbers. More...
 
virtual bool caseCompare (const char *str) const
 Case-insensitive string compare. More...
 
virtual bool caseCompare (const DtString &str) const
 Case-insensitive string compare. More...
 
virtual char & operator[] (int index)
 
virtual const char & operator[] (int index) const
 
virtual bool snipFront (const char ch, bool toLastCh=false)
 Truncates everything before or after the character, including the character, respectively. More...
 
virtual bool snipBack (const char ch, bool fromFirstCh=false)
 Truncates everything before or after the character, including the character, respectively. More...
 
virtual bool chompFront ()
 Remove all whitespace at front or back of a string. More...
 
virtual bool chompBack ()
 Remove all whitespace at front or back of a string. More...
 
virtual bool operator< (const char *str) const
 
virtual bool operator> (const char *str) const
 
virtual bool operator== (const char *str) const
 
virtual bool operator!= (const char *str) const
 
virtual bool operator<= (const char *str) const
 
virtual bool operator>= (const char *str) const
 
virtual DtString operator+ (const char *str) const
 
virtual DtStringoperator+= (const char *str)
 
virtual DtStringoperator+= (const DtString &str)
 

Static Public Member Functions

static const DtFilenamenullFilename ()
 Return empty filename. More...
 
static DtFilename stripFilename (const DtFilename &orig)
 Strip the filename from a path. More...
 
static DtFilename stripPath (const DtFilename &orig)
 Strip the path from a filename. More...
 
static DtFilename stripExtension (const DtFilename &orig)
 Strip the extension from a filename. More...
 
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. More...
 
static DtString absolutePath (const DtString &path, DtString &newAbsolutePath)
 Given a file path to an existing file, make it an absolute path in the provided result. More...
 
static char separator ()
 Returns the separator used in representing directories. More...
 
- Static Public Member Functions inherited from DtString
static const DtStringnullString ()
 a Null representation of a string, which is the same as an empty string More...
 
static const DtStringnullId ()
 a Null representation of a string, which is the same as an empty string This is the same as nullString, but allows for a cross protocol DtGlobalObjectDesignator More...
 

Protected Member Functions

void replaceSlashes ()
 Replaces slashes. More...
 
- Protected Member Functions inherited from DtString
void clear ()
 Deletes the string, and sets the myString pointer to NULL. More...
 
void setString (const char *str)
 Set/Get for myString - char pointer that holds the string. More...
 

Static Protected Attributes

static const char theSeparator
 
- Static Protected Attributes inherited from DtString
static const int theMaxInsertionStringSize
 current buffer size More...
 

Additional Inherited Members

- Protected Types inherited from DtString
enum  { theDefaultBufferSize = 64 }
 
- Protected Attributes inherited from DtString
char myDefaultBuffer [theDefaultBufferSize]
 
char * myString
 Use this buffer if possible. More...
 
bool myStringAlloced
 &myDefaultBuffer[0], or a ptr to heap memory if needed More...
 
unsigned int myBufSize
 Does myString need to be deleted when done? More...
 

Detailed Description

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

Constructor & Destructor Documentation

DtFilename::DtFilename ( )

default constructor

DtFilename::DtFilename ( const char *  str)

constructor

virtual DtFilename::~DtFilename ( )
virtual

destructor

DtFilename::DtFilename ( const DtFilename orig)

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.

static DtString DtFilename::absolutePath ( const DtString path,
DtString newAbsolutePath 
)
static

Given a file path to an existing file, make it an absolute path in the provided result.

Result is an empty string if file does not exist. Return a reference to the absolute path

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)
virtual

Reimplemented from DtString.

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

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.

virtual bool DtFilename::searchAlternatePath ( const char *  theAlternatePath)
virtual

Search for this file, first using this filename.

If not found, and the alternate filename isn't NULL, prepend the alternate path and try a second time (note that prepend will not update an absolute path). Returns true if the filename exists and updates this filename to match the found file. Returns false if not found and filename is not changed.

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
staticprotected

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

Document ID: Generated on Thu Sep 19 02:12:35 EDT 2024 from SVN revision 269601
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)