Public Member Functions | Static Public Member Functions | Protected Attributes

zeus::TFile Class Reference

#include <File.h>

Inheritance diagram for zeus::TFile:
zeus::TZObject zeus::IZUnknown zeus::TPropertyFile zeus::TXMLFile zeus::TZipFile

List of all members.

Public Member Functions

 TFile (const IString &rAbsName)
 TFile (const TDirectoryItem &rItem)
 TFile (TString strAbsName)
 TFile (const IString &rFileRootPath, const IString &rFileName)
 TFile (const TFile &rFile)
virtual ~TFile ()
TString getAbsoluteName () const
TString extractFileName () const
TString extractFileExt () const
TString extractFileNameBase () const
TString extractFilePath () const
bool deleteFile (bool bForce=false)
bool canWrite () const
bool canRead () const
bool exists () const
bool createEmptyFile () const
bool equals (const TFile &rFile) const
bool equals (const IString &rFileName) const
Int64 getSize () const
Timeval getCreationTime () const
Timeval getLastAccessTime () const
Timeval getModificationTime () const
bool copyTo (const IString &rTargetName) const
bool setReadOnly (bool bValue)
void createBackupFiles (Uint uiBackupNum)
bool refresh ()
void splitPath (IString &rDrive, IString &rDirectory, IString &rFileName, IString &rExtension)
bool matchesPattern (const TString &rPattern)
void simplifyPathName (bool *pbError=NULL)
TString getFileVersion () const
TString getFileInformation (const IString &rEntryName) const
TString toString () const
TFileoperator= (const TFile &rFile)
bool operator== (const TFile &rFile) const
bool operator== (const TString &rFile) const
bool operator!= (const TFile &rFile) const
bool operator!= (const TString &rFile) const

Static Public Member Functions

static bool isFile (const IString &rDirectoryItem)
static bool isDirectory (const IString &rDirectoryItem)
static bool isHidden (const IString &rDirectoryItem)
static TString createAbsoluteFileNamePath (const IString &rFileName, const IString &rPathToComplete)
static bool matchesPattern (const TString &rFileName, const TString &rPattern)

Protected Attributes

TString m_strAbsName
 Absolute name.

Detailed Description

The directory class implements methods to access the system directory


Constructor & Destructor Documentation

TFile::TFile ( const IString rAbsName )

Creates an new file wrapper object

Parameters:
rAbsName: Name of the file
TFile::TFile ( const TDirectoryItem rItem )

Creates a file wrapper out of a directory item

Parameters:
rItem: Item containing the informations
TFile::TFile ( TString  strAbsName )

Creates an new file wrapper object

Parameters:
strAbsName: Name of the file
TFile::TFile ( const IString rFileRootPath,
const IString rFileName 
)

Creates a file wrapper out of a root directory and a file name (path)

Parameters:
rFileRootPath: Root directory. Note that the path should end with '/' or '\' separator
rFileName: File name (path). Leading '/' or '\' will be ignored
TFile::TFile ( const TFile rFile )

Copy constructor

TFile::~TFile (  ) [virtual]

Destroys the Directory wrapper object


Member Function Documentation

bool TFile::canRead (  ) const

Checks if the file can be read

Return values:
true: Able to read file
false,:Unable to read file
Todo:
This method is not unicode compatible for Unix systems
bool TFile::canWrite (  ) const

Checks if the file can be written

Return values:
true: Able to write file
false,:Unable to write file
Todo:
This method is not unicode compatible for Unix systems
bool TFile::copyTo ( const IString rTargetName ) const

Copies the file and renames it

Parameters:
rTargetName: Name of the copied file
Return values:
true: File deleted
false,:could not delete file
TString TFile::createAbsoluteFileNamePath ( const IString rFileName,
const IString rPathToComplete 
) [static]

creates a complete file name (absolute path)

void TFile::createBackupFiles ( Uint  uiBackupNum )

Creates the backup

Parameters:
uiBackupNum: Max number of backups. The first backup will be called [name]~1.[ext].
bool TFile::createEmptyFile (  ) const

Create an empty file.

The file is neither recreated nor truncated if it already exists.

Returns:
: No error.
bool TFile::deleteFile ( bool  bForce = false )

Deletes the file

Return values:
true: File deleted
false,:could not delete file
bool zeus::TFile::equals ( const TFile rFile ) const [inline]

Checks if the two files are equal. This method does only a path check and not a content check.

Parameters:
rFile: Path to check
Return values:
true: Path is equal
false,:Path is not equal
bool TFile::equals ( const IString rFileName ) const

Checks if the two files are equal

See also:
TFile::equals
bool TFile::exists (  ) const

Checks if the file exists

Return values:
true: File exists
false: File doesnt exist
Todo:
This method is not unicode compatible for Unix systems
TString TFile::extractFileExt (  ) const

This method is used to extract the file extentsion out of the whole path

TString TFile::extractFileName (  ) const

This method is used to extract the filename out of the whole path

TString TFile::extractFileNameBase (  ) const

This method is used to extract the file base name out of the whole path

TString TFile::extractFilePath (  ) const

This method is used to extract the path of the file

TString zeus::TFile::getAbsoluteName (  ) const [inline]

Returns the absolute name of the directory

Timeval TFile::getCreationTime (  ) const

Returns the time of the file creation

Returns:
time
TString TFile::getFileInformation ( const IString rEntryName ) const

Returns a resource data of the file depending on the EntryName This works only for win32 platforms or platforms supporting resource data of files.

Parameters:
rEntryName: Name of the resource data
Returns:
Data
TString zeus::TFile::getFileVersion (  ) const [inline]

Returns the version of the file. This works only for win32 platforms or platforms supporting resource data of files

Timeval TFile::getLastAccessTime (  ) const

Returns the time of the last access

Returns:
time
Timeval TFile::getModificationTime (  ) const

Returns the time of the last change

Returns:
time
Int64 TFile::getSize (  ) const

Reads the size of the file

Returns:
File size in bytes
bool TFile::isDirectory ( const IString rDirectoryItem ) [static]

Checks if a directory item is a directory

Parameters:
rDirectoryItem: Name of the directory item
bool zeus::TFile::isFile ( const IString rDirectoryItem ) [inline, static]

Checks if a directory item is a file

Parameters:
rDirectoryItem: Name of the directory item
bool TFile::isHidden ( const IString rDirectoryItem ) [static]

Checks if a directory item is hidden

Parameters:
rDirectoryItem: Name of the directory item
bool TFile::matchesPattern ( const TString rFileName,
const TString rPattern 
) [static]

This method is used to check if the filename (and path) matches a wildcard pattern. The pattern is case sensitive for linux platforms. For windows plattforms the pattern is independend of the cases (*.zip and *.ZIP will match the same files).

Parameters:
rFileName: file name
rPattern: Wildcard pattern
Return values:
true: file name matches the pattern
false: no matching
Note:
The basic concept of this algorithm is developped and copyrighted by Alessandro Cantatore (http://xoomer.virgilio.it/acantato/dev/wildcard/wildmatch.html). XAtlantis declines the responsability how the code is used. Please check the licence Alessandro Cantatore before using it!!!! XAtlantis modified few lines of the original algorithm to meet the coding restrictions of the zeus-framework.
bool zeus::TFile::matchesPattern ( const TString rPattern ) [inline]
bool zeus::TFile::operator!= ( const TFile rFile ) const [inline]

Checks if two files are equal

bool zeus::TFile::operator!= ( const TString rFile ) const [inline]

Checks if two files are equal

TFile & TFile::operator= ( const TFile rFile )

Copy operator

Parameters:
rFile: File to copy
bool zeus::TFile::operator== ( const TFile rFile ) const [inline]

Checks if two files are equal

bool zeus::TFile::operator== ( const TString rFile ) const [inline]

Checks if two files are equal

bool TFile::refresh (  )

Refreshes the status of the file object

Return values:
true: Status read
false: Could not read status
Todo:
This method is not unicode compatible for Unix systems
bool TFile::setReadOnly ( bool  bValue )

sets or clears the readonly mode

Parameters:
bValue: true = set to readonly; false= set to writable
Return values:
true: Mode successfully set
false,:Setting mode failed
Todo:
This method is not unicode compatible for Unix systems
void TFile::simplifyPathName ( bool *  pbError = NULL )

simplifies the path name

void TFile::splitPath ( IString rDrive,
IString rDirectory,
IString rFileName,
IString rExtension 
)

This method splits into a drive (windows only), directory name, file name and file extension

Todo:
This method is not unicode compatible for Unix systems
TString zeus::TFile::toString (  ) const [inline]
See also:
TZObject::toString

Reimplemented from zeus::TZObject.


Member Data Documentation

Absolute name.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:33