FX::QFileInfo Class Reference

#include <QFileInfo.h>

List of all members.


Detailed Description

Provides detailed information about an entry in the file system (Qt compatible).

While most of what is offered by this class can be done manually via the static methods in FX::QFile, it can be useful to have a container knowing everything there is to know about an entry in a file system, particularly for purposes of comparison.

Like Qt's QFileInfo, this class also caches its information by default and thus after construction or refresh(), queries are far quicker (this is the default). API compatibility with QFileInfo has been mostly maintained - however, the old system of permissions has been replaced with an ACL based one so that NT file permissions are available. On Linux or BSD, suitable entries are created to reflect the much simpler POSIX security model though it could be easily extended to reflect the ACL security implemented by SE-Linux. For these reasons, I recommend you use QFileInfo over QFile directly (it's just as efficient at worst as the original FOX code does a stat() even where on Win32 there's a separate faster call - except for isFile() and isDirectory()). Note that if FX::FXACL throws an exception when reading the file entry's security info (this could happen if the file entry does not give you permission to read its ACL), QFileInfo will simply create an empty ACL belonging to FX::FXACLEntity::root() for that file entry.

If you wish to enumerate the contents of a directory, please see FX::QDir. The default operators <, > and == compare by case insensitive name.

Public Member Functions

 QFileInfo ()
 QFileInfo (const FXString &path)
 QFileInfo (const QFile &file)
 QFileInfo (const QDir &dir, const FXString &leafname)
 QFileInfo (const QFileInfo &o)
QFileInfooperator= (const QFileInfo &o)
bool operator< (const QFileInfo &o) const
bool operator== (const QFileInfo &o) const
bool operator!= (const QFileInfo &o) const
bool operator> (const QFileInfo &o) const
void setFile (const FXString &path)
void setFile (const QFile &file)
void setFile (const QDir &dir, const FXString &leafname)
bool exists () const
void refresh ()
bool caching () const
void setCaching (bool newon)
const FXStringfilePath () const
FXString fileName () const
FXString absFilePath () const
FXString baseName (bool complete=false) const
FXString extension (bool complete=true) const
FXString dirPath (bool absPath=false) const
QDir dir (bool absPath=false) const
bool isReadable () const
bool isWriteable () const
bool isWritable () const
bool isExecutable () const
FXuint metaFlags () const
bool isHidden () const
bool isRelative () const
bool convertToAbs ()
bool isFile () const
bool isDir () const
bool isSymLink () const
FXString readLink () const
const FXACLEntityowner () const
const FXACLpermissions () const
bool permission (FXACL::Perms what) const
FXString permissionsAsString () const
FXfval size () const
FXString sizeAsString () const
FXTime created () const
FXString createdAsString (const FXString &format="%Y/%b/%d %H:%M:%S.%F %Z", bool inLocalTime=true) const
FXTime lastModified () const
FXString lastModifiedAsString (const FXString &format="%Y/%b/%d %H:%M:%S.%F %Z", bool inLocalTime=true) const
FXTime lastRead () const
FXString lastReadAsString (const FXString &format="%Y/%b/%d %H:%M:%S.%F %Z", bool inLocalTime=true) const


Constructor & Destructor Documentation

FX::QFileInfo::QFileInfo (  ) 

Constructs a new instance.

FX::QFileInfo::QFileInfo ( const FXString path  ) 

Constructs a new instance detailing path.

FX::QFileInfo::QFileInfo ( const QFile file  ) 

Constructs a new instance detailing the file used by the QFile.

FX::QFileInfo::QFileInfo ( const QDir dir,
const FXString leafname 
)

Constructs a new instance detailing the file leafname within directory dir.


Member Function Documentation

void FX::QFileInfo::setFile ( const FXString path  ) 

Sets the detail to use path.

void FX::QFileInfo::setFile ( const QFile file  ) 

Sets the detail to use file.

void FX::QFileInfo::setFile ( const QDir dir,
const FXString leafname 
)

Sets the detail to use leafname in dir.

bool FX::QFileInfo::exists (  )  const

Returns true if the filing system entry exists.

void FX::QFileInfo::refresh (  ) 

Refreshes the information if caching is on.

bool FX::QFileInfo::caching (  )  const

True if caching is enabled.

void FX::QFileInfo::setCaching ( bool  newon  ) 

Sets if caching is enabled.

const FXString& FX::QFileInfo::filePath (  )  const

Returns the path + leafname of the filing system entry.

FXString FX::QFileInfo::fileName (  )  const

Returns the leafname of the entry.

FXString FX::QFileInfo::absFilePath (  )  const

Returns the absolute path of the entry.

FXString FX::QFileInfo::baseName ( bool  complete = false  )  const

Returns the base name of the entry (name before the '.'). If complete is true, returns up to last dot else returns up to first dot

FXString FX::QFileInfo::extension ( bool  complete = true  )  const

Returns the extension of the entry (name after the '.'). If complete is true, returns from first dot else returns from last dot

FXString FX::QFileInfo::dirPath ( bool  absPath = false  )  const

Returns the entry's path, an absolute path if absPath is true.

QDir FX::QFileInfo::dir ( bool  absPath = false  )  const [inline]

Returns the entry's path as a FX::QDir.

bool FX::QFileInfo::isReadable (  )  const

Returns true if the entry is readable.

bool FX::QFileInfo::isWriteable (  )  const

Returns true if the entry is writeable.

bool FX::QFileInfo::isExecutable (  )  const

Returns true if the entry is an executable.

FXuint FX::QFileInfo::metaFlags (  )  const

Returns the flags for this entry in the format FX::QFile::MetaFileFlags.

bool FX::QFileInfo::isHidden (  )  const

Returns true if the entry is hidden.

bool FX::QFileInfo::isRelative (  )  const

Returns true if the entry's path is relative.

bool FX::QFileInfo::convertToAbs (  ) 

Converts the entry's path to an absolute one.

bool FX::QFileInfo::isFile (  )  const

Returns true if the entry is a file.

bool FX::QFileInfo::isDir (  )  const

Returns true if the entry is a directory.

bool FX::QFileInfo::isSymLink (  )  const

Returns true if the entry is a symbolic link.

FXString FX::QFileInfo::readLink (  )  const

Returns what the entry (when a symbolic link) points towards.

const FXACLEntity& FX::QFileInfo::owner (  )  const

Returns the owner of this entry (alias for permissions().owner()).

const FXACL& FX::QFileInfo::permissions (  )  const

Returns the permissions for the entry.

bool FX::QFileInfo::permission ( FXACL::Perms  what  )  const

Returns true if the file permits what (alias for permissions().check()).

FXString FX::QFileInfo::permissionsAsString (  )  const

Returns as a string the permissions for the entry.

FXfval FX::QFileInfo::size (  )  const

Returns the size of the entry.

FXString FX::QFileInfo::sizeAsString (  )  const

Returns the size of the entry as a string (eg; 1.2Mb).

FXTime FX::QFileInfo::created (  )  const

Returns the datestamp of when the entry was created (Windows only).

FXString FX::QFileInfo::createdAsString ( const FXString format = "%Y/%b/%d %H:%M:%S.%F %Z",
bool  inLocalTime = true 
) const

Returns the datestamp formatted as a string (see FX::FXTime).

FXTime FX::QFileInfo::lastModified (  )  const

Returns the datestamp of when the entry's data was last modified.

FXString FX::QFileInfo::lastModifiedAsString ( const FXString format = "%Y/%b/%d %H:%M:%S.%F %Z",
bool  inLocalTime = true 
) const

Returns the datestamp formatted as a string (see FX::FXTime).

FXTime FX::QFileInfo::lastRead (  )  const

Returns the datestamp of when the entry was last accessed.

FXString FX::QFileInfo::lastReadAsString ( const FXString format = "%Y/%b/%d %H:%M:%S.%F %Z",
bool  inLocalTime = true 
) const

Returns the datestamp formatted as a string (see FX::FXTime).


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

(C) 2002-2008 Niall Douglas. Some parts (C) to assorted authors.
Generated on Fri Jun 13 22:27:45 2008 for TnFOX by doxygen v1.5.6