|
1 #ifndef _FileEngine_h |
|
2 #define _FileEngine_h |
|
3 |
|
4 #include <QAbstractFileEngine> |
|
5 #include <QAbstractFileEngineHandler> |
|
6 #include <QDateTime> |
|
7 |
|
8 #include "physfs.h" |
|
9 |
|
10 |
|
11 |
|
12 class FileEngine : public QAbstractFileEngine |
|
13 { |
|
14 public: |
|
15 FileEngine(const QString& filename); |
|
16 |
|
17 virtual ~FileEngine(); |
|
18 |
|
19 virtual bool open(QIODevice::OpenMode openMode); |
|
20 virtual bool close(); |
|
21 virtual bool flush(); |
|
22 virtual qint64 size() const; |
|
23 virtual qint64 pos() const; |
|
24 virtual bool seek(qint64 pos); |
|
25 virtual bool isSequential() const; |
|
26 virtual bool remove(); |
|
27 virtual bool mkdir(const QString &dirName, bool createParentDirectories) const; |
|
28 virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const; |
|
29 virtual bool caseSensitive() const; |
|
30 virtual bool isRelativePath() const; |
|
31 virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const; |
|
32 virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const; |
|
33 virtual QString fileName(FileName file=DefaultName) const; |
|
34 virtual QDateTime fileTime(FileTime time) const; |
|
35 virtual void setFileName(const QString &file); |
|
36 bool atEnd() const; |
|
37 |
|
38 virtual qint64 read(char *data, qint64 maxlen); |
|
39 virtual qint64 readLine(char *data, qint64 maxlen); |
|
40 virtual qint64 write(const char *data, qint64 len); |
|
41 |
|
42 bool isOpened() const; |
|
43 |
|
44 QFile::FileError error() const; |
|
45 QString errorString() const; |
|
46 |
|
47 virtual bool supportsExtension(Extension extension) const; |
|
48 |
|
49 private: |
|
50 PHYSFS_file *_handler; |
|
51 qint64 _size; |
|
52 FileFlags _flags; |
|
53 QString _filename; |
|
54 QDateTime _datetime; |
|
55 }; |
|
56 |
|
57 class FileEngineHandler : public QAbstractFileEngineHandler |
|
58 { |
|
59 public: |
|
60 QAbstractFileEngine *create(const QString &filename) const; |
|
61 }; |
|
62 |
|
63 #endif |