author | Joe Doyle (Ginto8) <ginto8@gmail.com> |
Sat, 01 Dec 2012 15:56:19 -0500 | |
changeset 8174 | df02c2ad4a2c |
parent 8115 | ac1007c6dea8 |
child 8178 | 8bd087478b48 |
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; |
|
25 |
virtual bool seek(qint64 pos); |
|
26 |
virtual bool isSequential() const; |
|
27 |
virtual bool remove(); |
|
28 |
virtual bool mkdir(const QString &dirName, bool createParentDirectories) const; |
|
29 |
virtual bool rmdir(const QString &dirName, bool recurseParentDirectories) const; |
|
30 |
virtual bool caseSensitive() const; |
|
31 |
virtual bool isRelativePath() const; |
|
7770 | 32 |
QAbstractFileEngineIterator *beginEntryList(QDir::Filters filters, const QStringList & filterNames); |
7768 | 33 |
virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const; |
34 |
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const; |
|
35 |
virtual QString fileName(FileName file=DefaultName) const; |
|
36 |
virtual QDateTime fileTime(FileTime time) const; |
|
37 |
virtual void setFileName(const QString &file); |
|
38 |
bool atEnd() const; |
|
39 |
||
40 |
virtual qint64 read(char *data, qint64 maxlen); |
|
8112
d85dc8a8f41c
Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents:
8055
diff
changeset
|
41 |
virtual qint64 readLine(char *data, qint64 maxlen); |
7768 | 42 |
virtual qint64 write(const char *data, qint64 len); |
43 |
||
44 |
bool isOpened() const; |
|
45 |
||
46 |
QFile::FileError error() const; |
|
47 |
QString errorString() const; |
|
48 |
||
49 |
virtual bool supportsExtension(Extension extension) const; |
|
50 |
||
51 |
private: |
|
8115 | 52 |
PHYSFS_file *m_handle; |
53 |
qint64 m_size; |
|
54 |
FileFlags m_flags; |
|
55 |
QString m_fileName; |
|
56 |
QDateTime m_date; |
|
8112
d85dc8a8f41c
Implement QAbstractFileEngine::FastReadLineExtension
unc0rr
parents:
8055
diff
changeset
|
57 |
bool m_bufferSet; |
7768 | 58 |
}; |
59 |
||
60 |
class FileEngineHandler : public QAbstractFileEngineHandler |
|
61 |
{ |
|
62 |
public: |
|
7770 | 63 |
FileEngineHandler(char * argv0); |
64 |
~FileEngineHandler(); |
|
65 |
||
7768 | 66 |
QAbstractFileEngine *create(const QString &filename) const; |
7770 | 67 |
|
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
|
68 |
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
|
69 |
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
|
70 |
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
|
71 |
static void mountPacks(); |
7770 | 72 |
|
73 |
// private: |
|
74 |
static const QString scheme; |
|
75 |
}; |
|
76 |
||
77 |
class FileEngineIterator : public QAbstractFileEngineIterator |
|
78 |
{ |
|
79 |
public: |
|
80 |
FileEngineIterator(QDir::Filters filters, const QStringList & nameFilters, const QStringList & entries); |
|
81 |
||
82 |
bool hasNext() const; |
|
83 |
QString next(); |
|
84 |
QString currentFileName() const; |
|
85 |
private: |
|
86 |
QStringList m_entries; |
|
87 |
int m_index; |
|
7768 | 88 |
}; |
89 |
||
90 |
#endif |