author | Wuzzy <Wuzzy2@mail.ru> |
Thu, 14 Nov 2019 17:12:31 +0100 | |
changeset 15509 | 266ff128a65a |
parent 12902 | fc47fc4af6bd |
permissions | -rw-r--r-- |
10017 | 1 |
#ifndef _FileEngine_h |
2 |
#define _FileEngine_h |
|
3 |
||
12902
fc47fc4af6bd
Finish porting. Seems to work, but no thorough testing has been performed
unc0rr
parents:
10017
diff
changeset
|
4 |
#include <private/qabstractfileengine_p.h> |
10017 | 5 |
#include <QDateTime> |
6 |
||
7 |
#include "physfs.h" |
|
8 |
||
9 |
||
10 |
||
11 |
class FileEngine : public QAbstractFileEngine |
|
12 |
{ |
|
13 |
public: |
|
14 |
FileEngine(const QString& filename); |
|
15 |
||
16 |
virtual ~FileEngine(); |
|
17 |
||
18 |
virtual bool open(QIODevice::OpenMode openMode); |
|
19 |
virtual bool close(); |
|
20 |
virtual bool flush(); |
|
21 |
virtual qint64 size() const; |
|
22 |
virtual qint64 pos() const; |
|
23 |
virtual bool setSize(qint64 size); |
|
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 |
QAbstractFileEngineIterator *beginEntryList(QDir::Filters filters, const QStringList & filterNames); |
|
32 |
virtual QStringList entryList(QDir::Filters filters, const QStringList &filterNames) const; |
|
33 |
virtual FileFlags fileFlags(FileFlags type=FileInfoAll) const; |
|
34 |
virtual QString fileName(FileName file=DefaultName) const; |
|
35 |
virtual QDateTime fileTime(FileTime time) const; |
|
36 |
virtual void setFileName(const QString &file); |
|
37 |
bool atEnd() const; |
|
38 |
||
39 |
virtual qint64 read(char *data, qint64 maxlen); |
|
40 |
virtual qint64 readLine(char *data, qint64 maxlen); |
|
41 |
virtual qint64 write(const char *data, qint64 len); |
|
42 |
||
43 |
bool isOpened() const; |
|
44 |
||
45 |
QFile::FileError error() const; |
|
46 |
QString errorString() const; |
|
47 |
||
48 |
virtual bool supportsExtension(Extension extension) const; |
|
49 |
||
50 |
private: |
|
51 |
PHYSFS_file *m_handle; |
|
52 |
qint64 m_size; |
|
53 |
FileFlags m_flags; |
|
54 |
QString m_fileName; |
|
55 |
QDateTime m_date; |
|
56 |
bool m_bufferSet; |
|
57 |
bool m_readWrite; |
|
58 |
}; |
|
59 |
||
60 |
class FileEngineHandler : public QAbstractFileEngineHandler |
|
61 |
{ |
|
62 |
public: |
|
63 |
FileEngineHandler(char * argv0); |
|
64 |
~FileEngineHandler(); |
|
65 |
||
66 |
QAbstractFileEngine *create(const QString &filename) const; |
|
67 |
||
68 |
static void mount(const QString & path); |
|
69 |
static void mount(const QString & path, const QString & mountPoint); |
|
70 |
static void setWriteDir(const QString & path); |
|
71 |
static void mountPacks(); |
|
72 |
static QString errorStr(); |
|
73 |
||
74 |
// private: |
|
75 |
static const QString scheme; |
|
76 |
}; |
|
77 |
||
78 |
class FileEngineIterator : public QAbstractFileEngineIterator |
|
79 |
{ |
|
80 |
public: |
|
81 |
FileEngineIterator(QDir::Filters filters, const QStringList & nameFilters, const QStringList & entries); |
|
82 |
||
83 |
bool hasNext() const; |
|
84 |
QString next(); |
|
85 |
QString currentFileName() const; |
|
86 |
private: |
|
87 |
QStringList m_entries; |
|
88 |
int m_index; |
|
89 |
}; |
|
90 |
||
91 |
#endif |