diff options
author | João Abecasis <joao.abecasis@nokia.com> | 2010-08-30 12:02:39 +0200 |
---|---|---|
committer | João Abecasis <joao.abecasis@nokia.com> | 2010-08-30 14:00:21 +0200 |
commit | 1d52b8a0643dca077de432d841df5f49f472352a (patch) | |
tree | abdab952ae27d3a64873b576b467b1d9c029f49c /src/corelib/io/qfsfileengine_p.h | |
parent | 5dfcf2c6778e6852b3d1a2f9c6cc4c9e7c8a5d3b (diff) |
Removed native file path handling from QFSFileEngine
Moved it into QFileSystemEntry, instead.
For the time being, QFileSystemEntry may look like an unnecessary extra
layer of indirection. For the time being, this allows us to do some code
cleanup and de-duplication. It is also a stepping stone to becoming
completely independent of the current file engine abstraction.
Changes to QFileSystemEntry:
- native file path on Windows is now a QString, instead of a
QByteArray. Accordingly, constructors taking a QByteArray were
removed for these platforms.
- Encoding/decoding of file names uses QFile::encode/decodeName API,
instead of assuming local 8 bit. On Windows, UTF-16 is used for
native, as was being done in QFSFileEngine.
- new functions isRoot(), isDriveRoot() [Windows/Symbian], and path()
- convenience functions clear() and isEmpty() added to facilitate
porting.
Changes to QFSFileEngine (Windows):
- removed QFSFileEnginePrivate::sizeFdFh(): the function was broken
and never used, so might as well not get compiled in.
- repeated pattern for use of FindFirstFile/FindClose hidden away in a
static inline function.
- repeated and inconsistent conversions from QString to native file
paths reduced through the use of QFileSystemEntry.
Done-with: Prasanth Ullattil
Done-with: Thomas Zander
Diffstat (limited to 'src/corelib/io/qfsfileengine_p.h')
-rw-r--r-- | src/corelib/io/qfsfileengine_p.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index e9e55f32e6..74cbca3043 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -56,6 +56,7 @@ #include "qplatformdefs.h" #include "QtCore/qfsfileengine.h" #include "private/qabstractfileengine_p.h" +#include "private/qfilesystementry_p.h" #include <qhash.h> #ifndef QT_NO_FSFILEENGINE @@ -76,11 +77,9 @@ public: #endif static QString canonicalized(const QString &path); - QString filePath; - QByteArray nativeFilePath; + QFileSystemEntry fileEntry; QIODevice::OpenMode openMode; - void nativeInitFileName(); bool nativeOpen(QIODevice::OpenMode openMode); bool openFh(QIODevice::OpenMode flags, FILE *fh); bool openFd(QIODevice::OpenMode flags, int fd); @@ -89,7 +88,9 @@ public: bool nativeFlush(); bool flushFh(); qint64 nativeSize() const; +#ifndef Q_OS_WIN qint64 sizeFdFh() const; +#endif qint64 nativePos() const; qint64 posFdFh() const; bool nativeSeek(qint64); |