Qt 4.8
|
The QFSFileEngine class implements Qt's default file engine. More...
#include <qfsfileengine.h>
Public Functions | |
Iterator * | beginEntryList (QDir::Filters filters, const QStringList &filterNames) |
bool | caseSensitive () const |
Returns true for Windows, false for Unix. More... | |
bool | close () |
Reimplemented Function More... | |
bool | copy (const QString &newName) |
For windows, copy the file to file copyName. More... | |
Iterator * | endEntryList () |
QStringList | entryList (QDir::Filters filters, const QStringList &filterNames) const |
bool | extension (Extension extension, const ExtensionOption *option=0, ExtensionReturn *output=0) |
Reimplemented Function More... | |
FileFlags | fileFlags (FileFlags type) const |
Reimplemented Function More... | |
QString | fileName (FileName file) const |
Reimplemented Function More... | |
QDateTime | fileTime (FileTime time) const |
Reimplemented Function More... | |
bool | flush () |
Reimplemented Function More... | |
int | handle () const |
Reimplemented Function More... | |
bool | isRelativePath () const |
Reimplemented Function More... | |
bool | isSequential () const |
Reimplemented Function More... | |
bool | link (const QString &newName) |
Creates a link from the file currently specified by fileName() to newName. More... | |
bool | mkdir (const QString &dirName, bool createParentDirectories) const |
Reimplemented Function More... | |
bool | open (QIODevice::OpenMode openMode) |
Reimplemented Function More... | |
bool | open (QIODevice::OpenMode flags, FILE *fh) |
Opens the file handle fh in openMode mode. More... | |
bool | open (QIODevice::OpenMode flags, int fd) |
Opens the file descriptor fd in openMode mode. More... | |
bool | open (QIODevice::OpenMode flags, int fd, QFile::FileHandleFlags handleFlags) |
Opens the file descriptor fd in openMode mode. More... | |
bool | open (QIODevice::OpenMode flags, FILE *fh, QFile::FileHandleFlags handleFlags) |
Opens the file handle fh in openMode mode. More... | |
QString | owner (FileOwner) const |
Reimplemented Function More... | |
uint | ownerId (FileOwner) const |
In Unix, if stat() is successful, the uid is returned if own is the owner. More... | |
qint64 | pos () const |
Reimplemented Function More... | |
QFSFileEngine () | |
Constructs a QFSFileEngine. More... | |
QFSFileEngine (const QString &file) | |
Constructs a QFSFileEngine for the file name file. More... | |
qint64 | read (char *data, qint64 maxlen) |
Reimplemented Function More... | |
qint64 | readLine (char *data, qint64 maxlen) |
Reimplemented Function More... | |
bool | remove () |
Reimplemented Function More... | |
bool | rename (const QString &newName) |
Reimplemented Function More... | |
bool | rmdir (const QString &dirName, bool recurseParentDirectories) const |
Reimplemented Function More... | |
bool | seek (qint64) |
Reimplemented Function More... | |
void | setFileName (const QString &file) |
Reimplemented Function More... | |
bool | setPermissions (uint perms) |
Reimplemented Function More... | |
bool | setSize (qint64 size) |
Reimplemented Function More... | |
qint64 | size () const |
Reimplemented Function More... | |
bool | supportsExtension (Extension extension) const |
Reimplemented Function More... | |
qint64 | write (const char *data, qint64 len) |
Reimplemented Function More... | |
~QFSFileEngine () | |
Destructs the QFSFileEngine. More... | |
Public Functions inherited from QAbstractFileEngine | |
bool | atEnd () const |
Returns true if the current position is at the end of the file; otherwise, returns false. More... | |
QFile::FileError | error () const |
Returns the QFile::FileError that resulted from the last failed operation. More... | |
QString | errorString () const |
Returns the human-readable message appropriate to the current error reported by error(). More... | |
uchar * | map (qint64 offset, qint64 size, QFile::MemoryMapFlags flags) |
Maps size bytes of the file into memory starting at offset. More... | |
bool | unmap (uchar *ptr) |
Unmaps the memory address. More... | |
virtual | ~QAbstractFileEngine () |
Destroys the QAbstractFileEngine. More... | |
Static Public Functions | |
static QString | currentPath (const QString &path=QString()) |
For Unix, returns the current working directory for the file engine. More... | |
static QFileInfoList | drives () |
For Windows, returns the list of drives in the file system as a list of QFileInfo objects. More... | |
static QString | homePath () |
Returns the home path of the current user. More... | |
static QString | rootPath () |
Returns the root path. More... | |
static bool | setCurrentPath (const QString &path) |
Sets the current path (e. More... | |
static QString | tempPath () |
Returns the temporary path (i. More... | |
Static Public Functions inherited from QAbstractFileEngine | |
static QAbstractFileEngine * | create (const QString &fileName) |
Creates and returns a QAbstractFileEngine suitable for processing fileName. More... | |
Protected Functions | |
QFSFileEngine (QFSFileEnginePrivate &dd) | |
Protected Functions inherited from QAbstractFileEngine | |
QAbstractFileEngine () | |
Constructs a new QAbstractFileEngine that does not refer to any file or directory. More... | |
QAbstractFileEngine (QAbstractFileEnginePrivate &) | |
Constructs a QAbstractFileEngine. More... | |
void | setError (QFile::FileError error, const QString &str) |
Sets the error type to error, and the error string to errorString. More... | |
Additional Inherited Members | |
Public Types inherited from QAbstractFileEngine | |
enum | Extension { AtEndExtension, FastReadLineExtension, MapExtension, UnMapExtension } |
This enum describes the types of extensions that the file engine can support. More... | |
enum | FileFlag { ReadOwnerPerm = 0x4000, WriteOwnerPerm = 0x2000, ExeOwnerPerm = 0x1000, ReadUserPerm = 0x0400, WriteUserPerm = 0x0200, ExeUserPerm = 0x0100, ReadGroupPerm = 0x0040, WriteGroupPerm = 0x0020, ExeGroupPerm = 0x0010, ReadOtherPerm = 0x0004, WriteOtherPerm = 0x0002, ExeOtherPerm = 0x0001, LinkType = 0x10000, FileType = 0x20000, DirectoryType = 0x40000, BundleType = 0x80000, HiddenFlag = 0x0100000, LocalDiskFlag = 0x0200000, ExistsFlag = 0x0400000, RootFlag = 0x0800000, Refresh = 0x1000000, PermsMask = 0x0000FFFF, TypesMask = 0x000F0000, FlagsMask = 0x0FF00000, FileInfoAll = FlagsMask | PermsMask | TypesMask } |
The permissions and types of a file, suitable for OR'ing together. More... | |
enum | FileName { DefaultName, BaseName, PathName, AbsoluteName, AbsolutePathName, LinkName, CanonicalName, CanonicalPathName, BundleName, NFileNames = 9 } |
These values are used to request a file name in a particular format. More... | |
enum | FileOwner { OwnerUser, OwnerGroup } |
enum | FileTime { CreationTime, ModificationTime, AccessTime } |
These are used by the fileTime() function. More... | |
typedef QAbstractFileEngineIterator | Iterator |
Protected Variables inherited from QAbstractFileEngine | |
QScopedPointer< QAbstractFileEnginePrivate > | d_ptr |
Related Functions inherited from QAbstractFileEngine | |
Iterator | |
Synonym for QAbstractFileEngineIterator. More... | |
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 instead.
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()).
Definition at line 60 of file qfsfileengine.h.
QFSFileEngine::QFSFileEngine | ( | ) |
Constructs a QFSFileEngine.
Definition at line 158 of file qfsfileengine.cpp.
|
explicit |
Constructs a QFSFileEngine for the file name file.
Definition at line 148 of file qfsfileengine.cpp.
QFSFileEngine::~QFSFileEngine | ( | ) |
Destructs the QFSFileEngine.
Definition at line 173 of file qfsfileengine.cpp.
|
protected |
Definition at line 165 of file qfsfileengine.cpp.
|
virtual |
Reimplemented from QAbstractFileEngine.
Definition at line 787 of file qfsfileengine.cpp.
|
virtual |
Returns true for Windows, false for Unix.
Reimplemented from QAbstractFileEngine.
Definition at line 725 of file qfsfileengine_unix.cpp.
Referenced by QExtendedInformation::isCaseSensitive(), and QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Reimplemented in QTemporaryFileEngine.
Definition at line 377 of file qfsfileengine.cpp.
Referenced by QTemporaryFileEngine::remove(), QTemporaryFileEngine::rename(), QTemporaryFileEngine::setFileName(), and QTemporaryFileEngine::~QTemporaryFileEngine().
|
virtual |
For windows, copy the file to file copyName.
Not implemented for Unix.
Reimplemented from QAbstractFileEngine.
Definition at line 659 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
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:).
Definition at line 739 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
static |
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 "/".
Definition at line 759 of file qfsfileengine_unix.cpp.
Referenced by QDir::drives(), and QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented from QAbstractFileEngine.
Definition at line 795 of file qfsfileengine.cpp.
|
virtual |
Reimplemented from QAbstractFileEngine.
Definition at line 804 of file qfsfileengine.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 835 of file qfsfileengine.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 813 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 884 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 1012 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 454 of file qfsfileengine.cpp.
Referenced by QFSFileEnginePrivate::longFileName(), read(), readLine(), size(), and write().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 585 of file qfsfileengine.cpp.
|
static |
Returns the home path of the current user.
Definition at line 744 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 914 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 812 of file qfsfileengine.cpp.
Referenced by extension(), and supportsExtension().
|
virtual |
Creates a link from the file currently specified by fileName() to 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.
Reimplemented from QAbstractFileEngine.
Definition at line 683 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 715 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Reimplemented in QTemporaryFileEngine.
Definition at line 207 of file qfsfileengine.cpp.
Referenced by open(), QTemporaryFileEngine::open(), QFilePrivate::openExternalFile(), and setCloseOnExec().
bool QFSFileEngine::open | ( | QIODevice::OpenMode | openMode, |
FILE * | fh | ||
) |
Opens the file handle fh in openMode mode.
Returns true on success; otherwise returns false.
Definition at line 237 of file qfsfileengine.cpp.
bool QFSFileEngine::open | ( | QIODevice::OpenMode | openMode, |
int | fd | ||
) |
Opens the file descriptor fd in openMode mode.
Returns true on success; otherwise returns false.
Definition at line 306 of file qfsfileengine.cpp.
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 documentation for more information.
Definition at line 319 of file qfsfileengine.cpp.
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 documentation for more information.
Definition at line 250 of file qfsfileengine.cpp.
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 935 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
In Unix, if stat() is successful, the uid
is returned if own is the owner.
Otherwise the gid
is returned. If stat() is unsuccessful, -2 is reuturned.
For Windows, -2 is always returned.
Reimplemented from QAbstractFileEngine.
Definition at line 924 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 519 of file qfsfileengine.cpp.
Referenced by QFSFileEnginePrivate::seekFdFh().
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 594 of file qfsfileengine.cpp.
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 670 of file qfsfileengine.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Reimplemented in QTemporaryFileEngine.
Definition at line 647 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName(), and QTemporaryFileEngine::remove().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Reimplemented in QTemporaryFileEngine.
Definition at line 670 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName(), and QTemporaryFileEngine::rename().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 720 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
static |
Returns the root path.
Definition at line 749 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 538 of file qfsfileengine.cpp.
Referenced by QTemporaryFileEngine::close().
|
static |
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.
Definition at line 734 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Reimplemented in QTemporaryFileEngine.
Definition at line 197 of file qfsfileengine.cpp.
Referenced by QTemporaryFileEngine::QTemporaryFileEngine(), and QTemporaryFileEngine::setFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 947 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 996 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName(), and setPermissions().
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 493 of file qfsfileengine.cpp.
|
virtual |
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 858 of file qfsfileengine.cpp.
|
static |
Returns the temporary path (i.
e., a path in which it is safe to store temporary files).
Definition at line 754 of file qfsfileengine_unix.cpp.
Referenced by QFSFileEnginePrivate::longFileName().
Reimplemented Function
Reimplemented from QAbstractFileEngine.
Definition at line 723 of file qfsfileengine.cpp.