Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- //#include <QtCore/private/qabstractfileengine_p.h>
- #include <QtCore/5.3.1/QtCore/private/qabstractfileengine_p.h>
- #include <Utilities/PackageReader.h>
- namespace qml
- {
- class ResourcesEngineHandler : public QAbstractFileEngineHandler
- {
- public:
- ResourcesEngineHandler();
- QAbstractFileEngine* create(const QString& fileName) const;
- private:
- QString mCurrentDir;
- };
- class ResourcesEngine : public QAbstractFileEngine
- {
- public:
- ResourcesEngine(const QString& fileName);
- bool open(QIODevice::OpenMode openMode) override;
- bool close() override;
- bool flush() override;
- bool syncToDisk() override;
- qint64 size() const override;
- qint64 pos() const override;
- bool seek(qint64 pos) override;
- bool isSequential() const override;
- bool remove() override;
- bool copy(const QString& newName) override;
- bool rename(const QString& newName) override;
- bool renameOverwrite(const QString& newName) override;
- bool link(const QString& newName) override;
- bool mkdir(const QString& dirName, bool createParentDirectories) const override;
- bool rmdir(const QString& dirName, bool recurseParentDirectories) const override;
- bool setSize(qint64 size) override;
- bool caseSensitive() const override;
- bool isRelativePath() const override;
- QStringList entryList(QDir::Filters filters, const QStringList& filterNames) const override;
- FileFlags fileFlags(FileFlags type = FileInfoAll) const override;
- bool setPermissions(uint perms) override;
- QString fileName(FileName file = DefaultName) const override;
- uint ownerId(FileOwner) const override;
- QString owner(FileOwner) const override;
- QDateTime fileTime(FileTime time) const override;
- void setFileName(const QString& file) override;
- int handle() const override;
- Iterator *beginEntryList(QDir::Filters filters, const QStringList& filterNames) override;
- Iterator *endEntryList() override;
- qint64 read(char *data, qint64 maxlen) override;
- qint64 readLine(char *data, qint64 maxlen) override;
- qint64 write(const char *data, qint64 len) override;
- bool extension(Extension extension, const ExtensionOption *option = 0, ExtensionReturn *output = 0) override;
- bool supportsExtension(Extension extension) const override;
- private:
- QString mPath;
- packageReader::File mFile;
- };
- class ResourcesEngineIterator : public QAbstractFileEngineIterator
- {
- public:
- ResourcesEngineIterator(QDir::Filters filters, const QStringList& nameFilters, const std::vector<packageReader::FileInfo>& infos, bool haveFolders, bool isEndIterator);
- QString next() override;
- bool hasNext() const override;
- QString currentFileName() const override;
- private:
- bool mHaveFolders;
- bool mIsEndIterator;
- int mIndex;
- std::vector<packageReader::FileInfo> mFiles;
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement