QFSFileEngine Class

The QFSFileEngine class implements Qt's default file engine. 更多...

頭: #include <QFSFileEngine>
Since: Qt 4.1
繼承: QAbstractFileEngine

公共類型

typedef Iterator

公共函數

QFSFileEngine ()
QFSFileEngine (const QString & file )
~QFSFileEngine ()
bool open (QIODevice::OpenMode openMode , FILE * fh )
bool open (QIODevice::OpenMode openMode , int fd )
bool open (QIODevice::OpenMode openMode , int fd , QFile::FileHandleFlags handleFlags )
bool open (QIODevice::OpenMode openMode , FILE * fh , QFile::FileHandleFlags handleFlags )
bool open (QIODevice::OpenMode openMode , const RFile & file , QFile::FileHandleFlags handleFlags )

重實現公共函數

virtual bool caseSensitive () const
virtual bool close ()
virtual bool copy (const QString & copyName )
virtual bool extension (Extension extension , const ExtensionOption * option = 0, ExtensionReturn * output = 0)
virtual FileFlags fileFlags (FileFlags type ) const
virtual QString fileName (FileName file ) const
virtual QDateTime fileTime (FileTime time ) const
virtual bool flush ()
virtual int handle () const
virtual bool isRelativePath () const
virtual bool isSequential () const
virtual bool link (const QString & newName )
virtual bool mkdir (const QString & name , bool createParentDirectories ) const
virtual bool open (QIODevice::OpenMode openMode )
virtual QString owner (FileOwner own ) const
virtual uint ownerId (FileOwner own ) const
virtual qint64 pos () const
virtual qint64 read (char * data , qint64 maxlen )
virtual qint64 readLine (char * data , qint64 maxlen )
virtual bool remove ()
virtual bool rename (const QString & newName )
virtual bool rmdir (const QString & name , bool recurseParentDirectories ) const
virtual bool seek (qint64 pos )
virtual void setFileName (const QString & file )
virtual bool setPermissions (uint perms )
virtual bool setSize (qint64 size )
virtual qint64 size () const
virtual bool supportsExtension (Extension extension ) const
virtual qint64 write (const char * data , qint64 len )

靜態公共成員

QString currentPath (const QString & fileName = QString())
QFileInfoList drives ()
QString homePath ()
QString rootPath ()
bool setCurrentPath (const QString & path )
QString tempPath ()

額外繼承成員

詳細描述

The QFSFileEngine class implements Qt's default file engine.

This class is part of the file engine framework in Qt. If you only want to access files or directories, use QFile , QFileInfo or QDir 代替。

QFSFileEngine is the default file engine for accessing regular files. It is provided for convenience; by subclassing this class, you can alter its behavior slightly, without having to write a complete QAbstractFileEngine subclass. To install your custom file engine, you must also subclass QAbstractFileEngineHandler and create an instance of your handler.

It can also be useful to create a QFSFileEngine object directly if you need to use the local file system inside QAbstractFileEngine::create (), in order to avoid recursion (as higher-level classes tend to call QAbstractFileEngine::create ()).

成員函數文檔編製

QFSFileEngine:: QFSFileEngine ()

構造 QFSFileEngine .

QFSFileEngine:: QFSFileEngine (const QString & file )

構造 QFSFileEngine for the file name file .

QFSFileEngine:: ~QFSFileEngine ()

銷毀 QFSFileEngine .

[虛擬] bool QFSFileEngine:: caseSensitive () const

重實現自 QAbstractFileEngine::caseSensitive ().

Returns true for Windows, false for Unix.

[虛擬] bool QFSFileEngine:: close ()

重實現自 QAbstractFileEngine::close ().

[虛擬] bool QFSFileEngine:: copy (const QString & copyName )

重實現自 QAbstractFileEngine::copy ().

For windows, copy the file to file copyName .

Not implemented for Unix.

[static] QString QFSFileEngine:: currentPath (const QString & fileName = QString())

For Unix, returns the current working directory for the file engine.

For Windows, returns the canonicalized form of the current path used by the file engine for the drive specified by fileName . On Windows, each drive has its own current directory, so a different path is returned for file names that include different drive names (e.g. A: or C:).

另請參閱 setCurrentPath ().

[static] QFileInfoList QFSFileEngine:: drives ()

For Windows, returns the list of drives in the file system as a list of QFileInfo objects. On unix, Mac OS X and Windows CE, only the root path is returned. On Windows, this function returns all drives (A:, C:, D:, etc.).

For Unix, the list contains just the root path "/".

[虛擬] bool QFSFileEngine:: extension ( Extension extension , const ExtensionOption * option = 0, ExtensionReturn * output = 0)

重實現自 QAbstractFileEngine::extension ().

[虛擬] FileFlags QFSFileEngine:: fileFlags ( FileFlags type ) const

重實現自 QAbstractFileEngine::fileFlags ().

[虛擬] QString QFSFileEngine:: fileName ( FileName file ) const

重實現自 QAbstractFileEngine::fileName ().

另請參閱 setFileName ().

[虛擬] QDateTime QFSFileEngine:: fileTime ( FileTime time ) const

重實現自 QAbstractFileEngine::fileTime ().

[虛擬] bool QFSFileEngine:: flush ()

重實現自 QAbstractFileEngine::flush ().

[虛擬] int QFSFileEngine:: handle () const

重實現自 QAbstractFileEngine::handle ().

[static] QString QFSFileEngine:: homePath ()

Returns the home path of the current user.

另請參閱 rootPath ().

[虛擬] bool QFSFileEngine:: isRelativePath () const

重實現自 QAbstractFileEngine::isRelativePath ().

[虛擬] bool QFSFileEngine:: isSequential () const

重實現自 QAbstractFileEngine::isSequential ().

重實現自 QAbstractFileEngine::link ().

Creates a link from the file currently specified by fileName () 到 newName . What a link is depends on the underlying filesystem (be it a shortcut on Windows or a symbolic link on Unix). Returns true if successful; otherwise returns false.

[虛擬] bool QFSFileEngine:: mkdir (const QString & name , bool createParentDirectories ) const

重實現自 QAbstractFileEngine::mkdir ().

[虛擬] bool QFSFileEngine:: open ( QIODevice::OpenMode openMode )

重實現自 QAbstractFileEngine::open ().

bool QFSFileEngine:: open ( QIODevice::OpenMode openMode , FILE * fh )

Opens the file handle fh in openMode mode. Returns true on success; otherwise returns false.

bool QFSFileEngine:: open ( QIODevice::OpenMode openMode , int fd )

Opens the file descriptor fd in openMode mode. Returns true on success; otherwise returns false.

bool QFSFileEngine:: open ( QIODevice::OpenMode openMode , int fd , QFile::FileHandleFlags handleFlags )

Opens the file descriptor fd in openMode mode. Returns true on success; otherwise returns false.

The handleFlags argument specifies whether the file handle will be closed by Qt. See the QFile::FileHandleFlags 文檔編製,瞭解更多信息。

bool QFSFileEngine:: open ( QIODevice::OpenMode openMode , FILE * fh , QFile::FileHandleFlags handleFlags )

Opens the file handle fh in openMode mode. Returns true on success; otherwise returns false.

The handleFlags argument specifies whether the file handle will be closed by Qt. See the QFile::FileHandleFlags 文檔編製,瞭解更多信息。

bool QFSFileEngine:: open ( QIODevice::OpenMode openMode , const RFile & file , QFile::FileHandleFlags handleFlags )

Opens the file descriptor specified by file in the mode given by openMode . Returns true on success; otherwise returns false.

The handleFlags argument specifies whether the file handle will be closed by Qt. See the QFile::FileHandleFlags 文檔編製,瞭解更多信息。

[虛擬] QString QFSFileEngine:: owner ( FileOwner own ) const

重實現自 QAbstractFileEngine::owner ().

[虛擬] uint QFSFileEngine:: ownerId ( FileOwner own ) const

重實現自 QAbstractFileEngine::ownerId ().

In Unix, if stat() is successful, the uid 被返迴若 own is the owner. Otherwise the gid is returned. If stat() is unsuccessful, -2 is reuturned.

For Windows, -2 is always returned.

[虛擬] qint64 QFSFileEngine:: pos () const

重實現自 QAbstractFileEngine::pos ().

[虛擬] qint64 QFSFileEngine:: read ( char * data , qint64 maxlen )

重實現自 QAbstractFileEngine::read ().

[虛擬] qint64 QFSFileEngine:: readLine ( char * data , qint64 maxlen )

重實現自 QAbstractFileEngine::readLine ().

[虛擬] bool QFSFileEngine:: remove ()

重實現自 QAbstractFileEngine::remove ().

[虛擬] bool QFSFileEngine:: rename (const QString & newName )

重實現自 QAbstractFileEngine::rename ().

[虛擬] bool QFSFileEngine:: rmdir (const QString & name , bool recurseParentDirectories ) const

重實現自 QAbstractFileEngine::rmdir ().

[static] QString QFSFileEngine:: rootPath ()

Returns the root path.

另請參閱 homePath ().

[虛擬] bool QFSFileEngine:: seek ( qint64 pos )

重實現自 QAbstractFileEngine::seek ().

[static] bool QFSFileEngine:: setCurrentPath (const QString & path )

Sets the current path (e.g., for QDir ), to path . Returns true if the new path exists; otherwise this function does nothing, and returns false.

另請參閱 currentPath ().

[虛擬] void QFSFileEngine:: setFileName (const QString & file )

重實現自 QAbstractFileEngine::setFileName ().

另請參閱 fileName ().

[虛擬] bool QFSFileEngine:: setPermissions ( uint perms )

重實現自 QAbstractFileEngine::setPermissions ().

[虛擬] bool QFSFileEngine:: setSize ( qint64 size )

重實現自 QAbstractFileEngine::setSize ().

另請參閱 size ().

[虛擬] qint64 QFSFileEngine:: size () const

重實現自 QAbstractFileEngine::size ().

另請參閱 setSize ().

[虛擬] bool QFSFileEngine:: supportsExtension ( Extension extension ) const

重實現自 QAbstractFileEngine::supportsExtension ().

[static] QString QFSFileEngine:: tempPath ()

Returns the temporary path (i.e., a path in which it is safe to store temporary files).

[虛擬] qint64 QFSFileEngine:: write (const char * data , qint64 len )

重實現自 QAbstractFileEngine::write ().