author | nemo |
Sun, 17 Mar 2013 14:09:54 -0400 | |
changeset 8744 | 6c87486fd89b |
parent 8178 | 8bd087478b48 |
child 9170 | 7c75643d0b66 |
permissions | -rw-r--r-- |
7768 | 1 |
#ifndef _FileEngine_h |
2 |
#define _FileEngine_h |
|
3 |
||
4 |
#include <QAbstractFileEngine> |
|
5 |
#include <QAbstractFileEngineHandler> |
|
7770 | 6 |
#include <QAbstractFileEngineIterator> |
7768 | 7 |
#include <QDateTime> |
8 |
||
9 |
#include "physfs.h" |
|
10 |
||
11 |
||
12 |
||
13 |
class FileEngine : public QAbstractFileEngine |
|
14 |
{ |
|
15 |
public: |
|
16 |
FileEngine(const QString& filename); |
|
17 |
||
18 |
virtual ~FileEngine(); |
|
19 |
||
20 |
virtual bool open(QIODevice::OpenMode openMode); |
|
21 |
virtual bool close(); |
|
22 |
virtual bool flush(); |
|
23 |
virtual qint64 size() const; |
|
24 |
virtual qint64 pos() const; |
|
8178 | 25 |
virtual bool setSize(qint64 size); |
7768 | 26 |
virtual bool seek(qint64 pos); |
27 |
virtual bool isSequential() const; |
|
28 |
virtual bool remove(); |
|
29 |
virtual bool mkdir(const QString &dirName, bool createParentDirectories) const; |
|
30 |
virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const; |
|
31 |
virtual bool caseSensitive() const; |
|
32 |
virtual bool isRelativePath() const; |
|
7770 | 33 |
QAbstractFileEngineIterator *beginEntryList(QDir::Filters filters, const QStringList & filterNames); |
7768 | 34 |
virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const; |
35 |
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const; |
|
36 |
virtual QString fileName(FileName file=DefaultName) const; |
|
37 |
virtual QDateTime fileTime(FileTime time) const; |
|
38 |
virtual void setFileName(const QString &file); |
|
39 |
bool atEnd() const; |
|
40 |
||
41 |
virtual qint64 read(char *data, qint64 maxlen); |
|
8112
d85dc8a8f41c
Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents:
8055
diff
changeset
|
42 |
virtual qint64 readLine(char *data, qint64 maxlen); |
7768 | 43 |
virtual qint64 write(const char *data, qint64 len); |
44 |
||
45 |
bool isOpened() const; |
|
46 |
||
47 |
QFile::FileError error() const; |
|
48 |
QString errorString() const; |
|
49 |
||
50 |
virtual bool supportsExtension(Extension extension) const; |
|
51 |
||
52 |
private: |
|
8115 | 53 |
PHYSFS_file *m_handle; |
54 |
qint64 m_size; |
|
55 |
FileFlags m_flags; |
|
56 |
QString m_fileName; |
|
57 |
QDateTime m_date; |
|
8112
d85dc8a8f41c
Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents:
8055
diff
changeset
|
58 |
bool m_bufferSet; |
8178 | 59 |
bool m_readWrite; |
7768 | 60 |
}; |
61 |
||
62 |
class FileEngineHandler : public QAbstractFileEngineHandler |
|
63 |
{ |
|
64 |
public: |
|
7770 | 65 |
FileEngineHandler(char * argv0); |
66 |
~FileEngineHandler(); |
|
67 |
||
7768 | 68 |
QAbstractFileEngine *create(const QString &filename) const; |
7770 | 69 |
|
8055
04dd8b7fb605
- Download .hwp files into Data folder and mount them immediately (yes, could cause problems in case of overlapped contents)
unc0rr
parents:
8052
diff
changeset
|
70 |
static void mount(const QString & path); |
04dd8b7fb605
- Download .hwp files into Data folder and mount them immediately (yes, could cause problems in case of overlapped contents)
unc0rr
parents:
8052
diff
changeset
|
71 |
static void mount(const QString & path, const QString & mountPoint); |
04dd8b7fb605
- Download .hwp files into Data folder and mount them immediately (yes, could cause problems in case of overlapped contents)
unc0rr
parents:
8052
diff
changeset
|
72 |
static void setWriteDir(const QString & path); |
04dd8b7fb605
- Download .hwp files into Data folder and mount them immediately (yes, could cause problems in case of overlapped contents)
unc0rr
parents:
8052
diff
changeset
|
73 |
static void mountPacks(); |
7770 | 74 |
|
75 |
// private: |
|
76 |
static const QString scheme; |
|
77 |
}; |
|
78 |
||
79 |
class FileEngineIterator : public QAbstractFileEngineIterator |
|
80 |
{ |
|
81 |
public: |
|
82 |
FileEngineIterator(QDir::Filters filters, const QStringList & nameFilters, const QStringList & entries); |
|
83 |
||
84 |
bool hasNext() const; |
|
85 |
QString next(); |
|
86 |
QString currentFileName() const; |
|
87 |
private: |
|
88 |
QStringList m_entries; |
|
89 |
int m_index; |
|
7768 | 90 |
}; |
91 |
||
92 |
#endif |