all repos — mgba @ 67905d281bfecbb06f51f2ca5ac939df378734a5

mGBA Game Boy Advance Emulator

src/platform/qt/VFileDevice.h (view raw)

 1/* Copyright (c) 2013-2014 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#ifndef QGBA_VFILE_DEVICE
 7#define QGBA_VFILE_DEVICE
 8
 9#include <QFileDevice>
10
11extern "C" {
12#include "util/vfs.h"
13}
14
15namespace QGBA {
16
17class VFileDevice : public QIODevice {
18Q_OBJECT
19
20public:
21	VFileDevice(VFile* vf, QObject* parent = nullptr);
22
23	static VFile* open(const QString& path, int mode);
24	static VDir* openDir(const QString& path);
25	static VDir* openArchive(const QString& path);
26
27protected:
28	virtual qint64 readData(char* data, qint64 maxSize) override;
29	virtual qint64 writeData(const char* data, qint64 maxSize) override;
30	virtual qint64 size() const override;
31
32private:
33	VFile* m_vf;
34};
35
36}
37
38#endif