class STDriveOps
|
Provide directory and file functionality.
More... |
|
|
Public Types
Public Methods
- STDriveOps ()
- ~STDriveOps ()
- void FileIOErrorCodes ()
- QString ExtractPath (QString &ProvidedPathFile)
- QString ExtractPath (const char *ProvidedPathFile)
- QString ExtractFileName (QString &PathFileName)
- QString ExtractFileName (const char *PathFileName)
- double GetFileMDate (QString &PathFileName)
- double GetFileMDate (const char *PathFileName)
- bool FileExists (QString &PathFileName)
- bool FileExists (const char *PathFileName)
- bool DirExists (QString &PathFileName)
- bool DirExists (const char *PathFileName)
- bool MakePath (QString &PathToCreate)
- bool MakePath (const char *PathToCreate)
- void RecurseFiles (STStringList *FilesStringList, int LevelOfRecurtion)
- void RecurseFiles (STStringList *FilesStringList, int LevelOfRecurtion, QString &DirectoryToStartIn)
- void RecurseFiles (STStringList *FilesStringList, int LevelOfRecurtion, char *DirectoryToStartIn)
- void RecursePath (STStringList *PathStringList, int LevelOfRecurtion)
- void RecursePath (STStringList *PathStringList, int LevelOfRecurtion, QString &DirectoryToStartIn)
- void RecursePath (STStringList *PathStringList, int LevelOfRecurtion, char *DirectoryToStartIn)
- QString GetDir ()
- QString GetParentDir (QString &ChildPath)
- void GetDirectories (STStringList *DirectoryList)
- void GetDirectories (STStringList *DirectoryList, QString &StartingDir)
- void GetFiles (STStringList *FilesList)
- void GetFiles (STStringList *FilesList, QString &StartingDir)
- int KillFile (QString &FileToDelete)
- int KillFile (const char *FileToDelete)
- int KillDir (QString &FileToDelete)
- int KillDir (const char *FileToDelete)
- int FileSize (QString &FilePathName)
- void ResetSearchPeramiters ()
Public Members
Provides directory and file functionality that are commanly used.
Constructor
~STDriveOps ()
| ~STDriveOps |
Destructor
TReturnParts (struct) | TReturnParts |
ReturnParts lets you define what information is retuned in the lists when
RecurseFiles is called.
TReturnParts ReturnParts
| ReturnParts |
TSearchPeramiters (struct) | TSearchPeramiters |
SearchPeramiters lets you define what information is qualified to be retuned
in the lists when GetFiles is called.
TSearchPeramiters SearchPeramiters
| SearchPeramiters |
int DefaultPermissions
| DefaultPermissions |
QString DefaultOwner
| DefaultOwner |
void FileIOErrorCodes ()
| FileIOErrorCodes |
Any file I/O errors are handled here and out put a text description.
QString DefaultGroup
| DefaultGroup |
QString ExtractPath (QString &ProvidedPathFile)
| ExtractPath |
Attempts to return the path part of a path to a file.
The path does not have to exist, therefor if the given path to a file
is only a path to a directory, the parent directory will be returned.
QString ExtractPath (const char *ProvidedPathFile)
| ExtractPath |
QString ExtractFileName (QString &PathFileName)
| ExtractFileName |
Attempts to return the file part of a path and file.
The path and file do not have to exist, therefor if the given path and file
is only a path to a directory, the parent directory will be returned.
QString ExtractFileName (const char *PathFileName)
| ExtractFileName |
double GetFileMDate (QString &PathFileName)
| GetFileMDate |
Returns a double that is the number of days and fraction of a day accorning
to STTime::Now since the file was last modified.
double GetFileMDate (const char *PathFileName)
| GetFileMDate |
bool FileExists (QString &PathFileName)
| FileExists |
Returns true if a given file exists.
bool FileExists (const char *PathFileName)
| FileExists |
bool DirExists (QString &PathFileName)
| DirExists |
Returns true if a given path exists.
bool DirExists (const char *PathFileName)
| DirExists |
bool MakePath (QString &PathToCreate)
| MakePath |
Tests every part in a given path and creats them if needed.
bool MakePath (const char *PathToCreate)
| MakePath |
Tests every part in a given path and creats them if needed.
void RecurseFiles (STStringList *FilesStringList, int LevelOfRecurtion)
| RecurseFiles |
Recursivly enters sub directories form the current directory looking for
files, all files found are placed in the string list. If LevelOfRecurtion = 0
then the recursion will continue for as many deepths as the directories go or as far
as the system memory will support. If LevelOfRecurtion > 0 then recursion will
continue for as many sub-directory deepths as LevelOfRecurtion's value. The starting
directory is has the level of 1. If LevelOfRecurtion = 1 then only files in the
starting directory will be added to the list, no sub directories will be checked.
If LevelOfRecurtion = 2 then the files in the starting directory and the files that
are found imediatly in the sub-directories of the starting directory will be added to
the list.
TReturnParts
void RecurseFiles (STStringList *FilesStringList, int LevelOfRecurtion, QString &DirectoryToStartIn)
| RecurseFiles |
Works just like RecurseFiles(STStringList *,int) but lets you set the directory that
you want to start searching from.
void RecurseFiles (STStringList *FilesStringList, int LevelOfRecurtion, char *DirectoryToStartIn)
| RecurseFiles |
void RecursePath (STStringList *PathStringList, int LevelOfRecurtion)
| RecursePath |
Recursivly enters sub directories form the current directory looking for
directories, all directories found are placed in the string list. If LevelOfRecurtion = 0
then the recursion will continue for as many deepths as the directories go or as far
as the system memory will support. If LevelOfRecurtion > 0 then recursion will
continue for as many sub-directory deepths as LevelOfRecurtion's value. The starting
directory is has the level of 1. If LevelOfRecurtion = 1 then only directories in the
starting directory will be added to the list, no sub directories contents will be checked.
If LevelOfRecurtion = 2 then the directories in the starting directory and the directories that
are found imediatly in the sub-directories of the starting directory will be added to
the list.
void RecursePath (STStringList *PathStringList, int LevelOfRecurtion, QString &DirectoryToStartIn)
| RecursePath |
Works just like RecursePath(STStringList *,int) but lets you set the directory that
you want to start searching from.
void RecursePath (STStringList *PathStringList, int LevelOfRecurtion, char *DirectoryToStartIn)
| RecursePath |
Returns the name of the current directory that the application is in.
Example:
QString TempString;
STDriveOps *DriveOps1;
DriveOps1 = new STDriveOps();
TempString = DriveOps1->GetDir();
LineEdit1->setText(TempString);
delete DriveOps1;
|
QString GetParentDir (QString &ChildPath)
| GetParentDir |
Tries to find the full path to the parent dir of a given file or path.
- Things you can give it
- /
- ../ (and mutiples of)
- ../../../
- ./
- Aname/ (and mutiples of)
- Aname/Bname/
- Things you can not give it.
- .././
- ./../
- ..//Aname
- Aname/Bname/../Cname/
- Aname/Bname/./Cname/
- Some day I may add the smarts to detect these, but not now.
void GetDirectories (STStringList *DirectoryList)
| GetDirectories |
Fills a given list with name of directories in the current directory.
Example:
int ALoopCounter;
QString OriginalDir;
STStringList *Directories;
STDriveOps *DriveOps1;
Directories = new STStringList();
DriveOps1 = new STDriveOps();
OriginalDir = DriveOps1->GetDir();
chdir("/");
DriveOps1->GetDirectories(Directories);
for(ALoopCounter=0;ALoopCounterCount();ALoopCounter++)
{
MultiLineEdit1->append(Directories->Item(ALoopCounter));
}
chdir(OriginalDir);
delete Directories;
|
void GetDirectories (STStringList *DirectoryList, QString &StartingDir)
| GetDirectories |
Fills a given list with name of directories in a spacific directory.
Fills a given list with name of files in the current directory.
TSearchPeramiters
Example:
int ALoopCounter;
QString OriginalDir;
STStringList *TheFiles;
STDriveOps *DriveOps1;
TheFiles = new STStringList();
DriveOps1 = new STDriveOps();
OriginalDir = DriveOps1->GetDir();
chdir("/");
// Only look for *.txt files.
DriveOps1->SearchPeramiters.FileMatch = "*.txt";
DriveOps1->GetFiles(TheFiles);
for(ALoopCounter=0;ALoopCounterCount();ALoopCounter++)
{
MultiLineEdit1->append(TheFiles->Item(ALoopCounter));
}
chdir(OriginalDir);
delete TheFiles;
|
void GetFiles (STStringList *FilesList, QString &StartingDir)
| GetFiles |
Fills a given list with name of files in a spacific directory.
int KillFile (QString &FileToDelete)
| KillFile |
Attempts to delete a given file.
int KillFile (const char *FileToDelete)
| KillFile |
int KillDir (QString &FileToDelete)
| KillDir |
Attempts to delete a given directroy and every thing in it.
int KillDir (const char *FileToDelete)
| KillDir |
int FileSize (QString &FilePathName)
| FileSize |
Returns the number of bytes in a given file.
void ResetSearchPeramiters ()
| ResetSearchPeramiters |
Generated by: root on UtopiaPlanitia.Ept on Mon Dec 10 22:55:12 2001, using kdoc 2.0a53. |