FX::QDir Class Reference

#include <QDir.h>

List of all members.


Detailed Description

Provides detailed information about a directory in the file system (Qt compatible).

This class permits you to enumerate the contents of a directory in a very flexible fashion. It works in tandem with FX::QFileInfo to provide the ultimate in both directory enumeration and comparing before & after snapshots of directory contents.

Warning:
The wildcard mechanism used by QDir is not the same as QDir. QDir uses a space-separated set of *.x as a file open dialog would use. As Tn has disposed permanently of file open dialogs, FOX-style wildcards were far more useful to me - sorry!
FOX-style wildcards are as follows: ? matches a single char, * matches many, [...] specifies any one of what's between the square brackets. Ranges work, so [1-4] matches any one of 1,2,3,4. [!1-4] or [^1-4] would be any char not 1,2,3,4. Lists of matchable expressions can be delimited using | or , so *.cpp|*.h,*.cxx means anything with the extensions cpp,h or cxx. Brackets nest expressions, so foo.(a,b,c) matches foo.a, foo.b and foo.c. You can escape any of these special characters with \

You should (like QDir) try to avoid fancy filtering as it's slow - often getting the full list and copying the items you want into a new list based upon a speculative retrieval of QFileInfo's can be faster than running a regular expression match on a subset filter though care has been taken to avoid quadratic behaviour (unlike Qt, which goes real slow on large directories). In particular, setting FilterSpec or SortSpec options which require fetching a QFileInfo for each item can be particularly slow. Note that all expression matches are case insensitive - this can cause too much data to be returned on POSIX, but also means consistent behaviour between Windows and POSIX.

QDir like QDir performs a certain amount of caching - the list of names are cached. If a list of FX::QFileInfo's is requested, the cached list of names are used to generate the list of FX::QFileInfo's - which may mean an incomplete listing. If the directory enumerated has vanished altogether, then a null pointer is returned. The static method extractChanges() is additional functionality over Qt.

Note that as with all TnFOX functionality, if something fails it throws an exception. Thus many of the boolean returns are always true.

Definition at line 76 of file QDir.h.

Public Types

 Dirs
 Files
 NoSymLinks
 All
 TypeMask
 Readable
 Writeable
 Writable
 Executable
 RWEMask
 Hidden
 AccessMask
 DefaultFilter
 Name
 Time
 Size
 Unsorted
 SortByMask
 DirsFirst
 Reversed
 IgnoreCase
 DefaultSort
enum  FilterSpec {
  Dirs, Files, NoSymLinks, All,
  TypeMask, Readable, Writeable, Writable,
  Executable, RWEMask, Hidden, AccessMask,
  DefaultFilter
}
enum  SortSpec {
  Name, Time, Size, Unsorted,
  SortByMask, DirsFirst, Reversed, IgnoreCase,
  DefaultSort
}

Public Member Functions

 QDir ()
 QDir (const FXString &path, const FXString &regex=FXString::nullStr(), int sortBy=Name|IgnoreCase, int filter=All)
 QDir (const QDir &o)
QDiroperator= (const QDir &o)
QDiroperator= (const FXString &path)
 ~QDir ()
bool operator== (const QDir &o) const
bool operator!= (const QDir &o) const
void setPath (const FXString &path)
const FXStringpath () const
FXString absPath () const
FXString canonicalPath () const
FXString dirName () const
FXString filePath (const FXString &file, bool acceptAbs=true) const
FXString absFilePath (const FXString &file, bool acceptAbs=true) const
bool cd (const FXString &name, bool acceptAbs=true)
bool cdUp ()
const FXStringnameFilter () const
void setNameFilter (const FXString &regex)
FilterSpec filter () const
void setFilter (int filter)
SortSpec sorting () const
void setSorting (int sorting)
bool matchAllDirs () const
void setMatchAllDirs (bool matchAll)
FXuint count () const
const FXStringoperator[] (int idx) const
QStringList entryList (const FXString &regex, int filter=DefaultFilter, int sorting=DefaultSort)
QStringList entryList (int filter=DefaultFilter, int sorting=DefaultSort)
const QFileInfoListentryInfoList (const FXString &regex, int filter=DefaultFilter, int sorting=DefaultSort)
const QFileInfoListentryInfoList (int filter=DefaultFilter, int sorting=DefaultSort)
void refresh ()
bool mkdir (const FXString &leaf, bool acceptAbs=true)
bool rmdir (const FXString &leaf, bool acceptAbs=true)
bool remove (const FXString &leaf, bool acceptAbs=true)
bool rename (const FXString &src, const FXString &dest, bool acceptAbs=true)
bool exists (const FXString &leaf, bool acceptAbs=true)
bool isReadable () const
bool exists () const
bool isRoot () const
bool isRelative () const
void convertToAbs ()

Static Public Member Functions

static FXString convertSeparators (const FXString &path)
static QStringList drives ()
static FXString separator ()
static QDir current ()
static QDir home ()
static QDir root ()
static FXString currentDirPath ()
static FXString homeDirPath ()
static FXString rootDirPath ()
static bool match (const FXString &filter, const FXString &filename)
static FXString cleanDirPath (const FXString &path)
static bool isRelativePath (const FXString &path)
static QStringList extractChanges (const QDir &A, const QDir &B)


The documentation for this class was generated from the following file:
(C) 2002-2009 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Nov 20 18:37:37 2009 for TnFOX by doxygen v1.4.7