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 Member Functions | Static Protected Attributes
DtUcFilename Class Reference

Instances of DtUcFilename are DtUcStrings which convert filenames to the native format. More...

+ Inheritance diagram for DtUcFilename:
+ Collaboration diagram for DtUcFilename:

Public Member Functions

 DtUcFilename ()
 CTOR. More...
 
 DtUcFilename (const char *str)
 CTOR. More...
 
 DtUcFilename (const DtUcString &str)
 CTOR. More...
 
 DtUcFilename (const DtUcFilename &orig)
 Copy CTOR. More...
 
virtual ~DtUcFilename ()
 Virtual DTOR. More...
 
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 (const DtUcFilename &filename)
 This filename is considered a path and the supplied filename is appended. More...
 
virtual void prepend (const DtUcFilename &pathName)
 This filename is considered a relative path (or filename) and the supplied path is prepended. More...
 
virtual DtUcString extension () const
 Returns the file extension, which are all the characters following the last '. More...
 
virtual void setExtension (const DtUcString &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...
 
Assigment operators.
DtUcFilenameoperator= (const DtUcFilename &orig)
 
DtUcFilenameoperator= (const DtUcString &orig)
 
DtUcFilenameoperator= (const char *orig)
 
- Public Member Functions inherited from DtUcString
 DtUcString ()
 CTOR creates an empty string. More...
 
 DtUcString (size_t len, DtUnicodeChar c=DtUnicodeChar('\0'))
 CTOR create a string of n length filled with the unicode character c. More...
 
 DtUcString (const DtUcString &str)
 Copy ctor copies the string, this function will NOT allocate memory for the string, and thus it is fast to pass by value, and create many identical copies of a string. More...
 
 ~DtUcString ()
 DTOR may NOT deallocate memory as this string may share data. More...
 
DtUcStringoperator= (const DtUcString &str)
 Assignment operator copies the string, this function will NOT allocate memory for the string, and thus it is fast to pass by value, and create many identical copies of a string. More...
 
template<typename QStringType , typename QCoreApp >
QStringType translate () const
 Utility function for translating a DtUcString variable initialized using the static DtUcString::tr function, and QLinguist. More...
 
void setFromWCharArray (const wchar_t utf16[], int len=-1)
 Set from an wchar string, the string MUST be zero terminated if the length is not passed, the encoding of wchar arrays are different on each platform. More...
 
void setFromUtf8 (const unsigned char *utf8, int len=-1)
 Set from an UTF-8 encoded string, the string MUST be zero terminated if the length is not passed. More...
 
void setFromUtf8 (const std::string &utf8)
 
void setFromLatin1 (const char *latin, int len=-1)
 Set from an UTF-8 encoded string, the string MUST be zero terminated if the length is not passed. More...
 
void setFromUtf16 (const unsigned short *utf16, int len=-1)
 Set from an UTF-16 encoded string, the string MUST be zero terminated if the length is not passed. More...
 
void setFromUtf32 (const unsigned int *utf32, int len=-1)
 Set from an UTF-32 encoded string, the string MUST be zero terminated if the length is not passed. More...
 
void setFromAscii (const std::string &ascii)
 Set from an ascii string, the string MUST be zero terminated if the length is not passed. More...
 
void setFromAscii (const char *ascii, int len=-1)
 Set from an ascii string, the string MUST be zero terminated if the length is not passed. More...
 
template<typename QStringType >
void setFromQString (QStringType qstr)
 Template function for setting from Qt 4 style string. More...
 
void toAscii (std::string &str) const
 Encode to an ascii string. More...
 
std::string toAscii () const
 
void toLatin1 (std::string &str) const
 Encode to an Latin-1 string. More...
 
std::string toLatin1 () const
 
void toUtf8 (std::string &str) const
 Encode to a UTF-8 string. More...
 
std::string toUtf8 () const
 
void toWideString (std::wstring &str) const
 Encode to a wstring. More...
 
std::wstring toWideString () const
 
template<typename QStringType >
QStringType toQString () const
 Template function for outputting a Qt 4 style string. More...
 
template<typename QStringType >
void toQString (QStringType &qstr) const
 Template function for initializing a Qt 4 style string. More...
 
DtUcStringoperator+= (const DtUcString &str)
 Append a string to the end. More...
 
DtUcStringoperator+= (const DtUnicodeChar &x)
 Append a character to the end. More...
 
DtUcString operator+ (const DtUcString &str) const
 Append two strings together. More...
 
bool operator== (const DtUcString &other) const
 Test if two strings are identical. More...
 
bool operator!= (const DtUcString &other) const
 Test if two strings are not identical. More...
 
bool operator< (const DtUcString &other) const
 Test if a string is less than another based on their first different character or the length. More...
 
size_t length () const
 Get the length in Code Units. More...
 
size_t sizeInBytes () const
 Get the size in 8bit bytes. More...
 
size_t calculateCodePoints () const
 Calculate the number of Code Points. More...
 
const CodeUnitcodeUnits () const
 Get an array of code units. More...
 
int indexOf (const DtUnicodeChar &x, size_t pos=0) const
 Search for a character starting a pos, returns index, or -1 if not found. More...
 
int indexOf (const DtUcString &x, size_t pos=0) const
 Search for a string starting a pos, returns index, or -1 if not found. More...
 
int lastIndexOf (const DtUnicodeChar &x, size_t pos=0) const
 Search for a character starting a pos, returns index, or -1 if not found. More...
 
int lastIndexOf (const DtUcString &x, size_t pos=0) const
 Search for a string starting a pos, returns index, or -1 if not found. More...
 
DtUcString subString (size_t pos=0, int len=-1) const
 Create a substring starting at position, for n characters. More...
 
void push_back (const DtUnicodeChar &x)
 Append a unicode character to the string. More...
 
void resize (int size)
 Resize a string to a new size, if the size < 0 the string will be empty. More...
 
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...
 

Static Public Member Functions

static const DtUcFilenamenullFilename ()
 Return empty filename. More...
 
static DtUcFilename stripFilename (const DtUcFilename &orig)
 Strip the filename from a path. More...
 
static DtUcFilename stripPath (const DtUcFilename &orig)
 Strip the path from a filename. More...
 
static DtUcFilename stripExtension (const DtUcFilename &orig)
 Strip the extension from a filename. More...
 
static DtUcFilename combine (const DtUcFilename &path, const DtUcFilename &filename)
 Constructs a new filename by combining the path with filename, which is an absolute or relative path. More...
 
static const DtUnicodeCharseparator ()
 Returns the separator used in representing directories. More...
 
- Static Public Member Functions inherited from DtUcString
static DtUcString fromWCharArray (const wchar_t utf16[], int len=-1)
 Set from a wchar_t array, compiler encoding specific, the string MUST be zero terminated if the length is not passed. More...
 
static DtUcString fromWideString (const std::wstring &str)
 Set from a std::wstring. More...
 
static DtUcString fromUtf8 (const unsigned char *utf8, int len=-1)
 Create a unicode string from an UTF-16 encoded string, the string MUST be zero terminated if the length is not passed. More...
 
static DtUcString fromUtf8 (const std::string &utf8)
 
static DtUcString fromUtf16 (const unsigned short *utf16, int len=-1)
 Create a unicode string from an UTF-16 encoded string, the string MUST be zero terminated if the length is not passed. More...
 
static DtUcString fromUtf32 (const unsigned int *utf32, int len=-1)
 Create a unicode string from an UTF-32 encoded string, the string MUST be zero terminated if the length is not passed. More...
 
static DtUcString fromAscii (const std::string &ascii)
 Create a unicode string from an ascii string, the string MUST be zero terminated if the length is not passed. More...
 
static DtUcString fromAscii (const char *ascii, int len=-1)
 Create a unicode string from an ascii string, the string MUST be zero terminated if the length is not passed. More...
 
static DtUcString tr (const char *ascii)
 Ascii translation function, used to be compatible with Qt's translation tools. More...
 
template<typename QStringType >
static DtUcString fromQString (QStringType qstr)
 Template function for setting from Qt 4 style string. More...
 

Protected Member Functions

void replaceSlashes ()
 Replace the slashes in this filename. More...
 
- Protected Member Functions inherited from DtUcString
 DtUcString (const char *ascii, int len=-1, Encoding encoding=Ascii)
 
 DtUcString (const unsigned short *utf16, int len=-1)
 
 DtUcString (const unsigned int *utf32, int len=-1)
 
 DtUcString (const std::string &ascii)
 
 DtUcString (const DtUcString &a, const DtUcString &b)
 

Static Protected Member Functions

static DtUcString replaceSlashes (const DtUcString &str)
 Replace the slashes in the given filename. More...
 

Static Protected Attributes

static const DtUnicodeChar theSeparator
 

Additional Inherited Members

- Public Types inherited from DtUcString
typedef unsigned short CodeUnit
 
- Protected Types inherited from DtUcString
enum  Encoding { Ascii, Latin1, Utf8 }
 
- Protected Attributes inherited from DtUcString
CodeUnitArray myCodeUnits
 

Detailed Description

Instances of DtUcFilename are DtUcStrings which convert filenames to the native format.

Constructor & Destructor Documentation

DtUcFilename::DtUcFilename ( )

CTOR.

DtUcFilename::DtUcFilename ( const char *  str)

CTOR.

DtUcFilename::DtUcFilename ( const DtUcString str)

CTOR.

DtUcFilename::DtUcFilename ( const DtUcFilename orig)

Copy CTOR.

virtual DtUcFilename::~DtUcFilename ( )
virtual

Virtual DTOR.

Member Function Documentation

virtual bool DtUcFilename::absolute ( ) const
virtual

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

virtual void DtUcFilename::append ( const DtUcFilename 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 DtUcFilename DtUcFilename::combine ( const DtUcFilename path,
const DtUcFilename 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 DtUcFilename::exists ( ) const
virtual

Returns true if the filename exists.

virtual DtUcString DtUcFilename::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 DtUcFilename::fileLength ( ) const
virtual

Returns the size of the file in bytes.

If file does not exist results are undefined.

virtual bool DtUcFilename::isReadable ( ) const
virtual

Return true if the filename is readable.

virtual bool DtUcFilename::isWritable ( ) const
virtual

Returns true if the filename is writable.

static const DtUcFilename& DtUcFilename::nullFilename ( )
static

Return empty filename.

DtUcFilename& DtUcFilename::operator= ( const DtUcFilename orig)
DtUcFilename& DtUcFilename::operator= ( const DtUcString orig)
DtUcFilename& DtUcFilename::operator= ( const char *  orig)
virtual void DtUcFilename::prepend ( const DtUcFilename 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 DtUcFilename::relative ( ) const
virtual
void DtUcFilename::replaceSlashes ( )
protected

Replace the slashes in this filename.

On unix, this replaces backslashes with forward slashes. On windows, this replaces forward slashes with backslashes. Non-virtual: Called from CTOR.

static DtUcString DtUcFilename::replaceSlashes ( const DtUcString str)
staticprotected

Replace the slashes in the given filename.

On unix, this replaces backslashes with forward slashes. On windows, this replaces forward slashes with backslashes.

static const DtUnicodeChar& DtUcFilename::separator ( )
static

Returns the separator used in representing directories.

virtual void DtUcFilename::setExtension ( const DtUcString 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 DtUcFilename::stripExtension ( )
virtual

Strip the extension from the filename.

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

static DtUcFilename DtUcFilename::stripExtension ( const DtUcFilename orig)
static

Strip the extension from a filename.

virtual void DtUcFilename::stripFilename ( )
virtual

Strip the filename from this path.

static DtUcFilename DtUcFilename::stripFilename ( const DtUcFilename orig)
static

Strip the filename from a path.

virtual void DtUcFilename::stripPath ( )
virtual

Strip the path from this filename.

static DtUcFilename DtUcFilename::stripPath ( const DtUcFilename orig)
static

Strip the path from a filename.

Member Data Documentation

const DtUnicodeChar DtUcFilename::theSeparator
staticprotected

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

Document ID: Generated on Wed Mar 27 02:04:30 EDT 2024 from SVN revision 264570
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)