all repos — mgba @ 67905d281bfecbb06f51f2ca5ac939df378734a5

mGBA Game Boy Advance Emulator

src/platform/qt/VFileDevice.cpp (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#include "VFileDevice.h"
 7
 8using namespace QGBA;
 9
10VFileDevice::VFileDevice(VFile* vf, QObject* parent)
11	: QIODevice(parent)
12	, m_vf(vf)
13{
14	// Nothing to do
15}
16
17qint64 VFileDevice::readData(char* data, qint64 maxSize) {
18	return m_vf->read(m_vf, data, maxSize);
19}
20
21qint64 VFileDevice::writeData(const char* data, qint64 maxSize) {
22	return m_vf->write(m_vf, data, maxSize);
23}
24
25qint64 VFileDevice::size() const {
26	return m_vf->size(m_vf);
27}
28
29VFile* VFileDevice::open(const QString& path, int mode) {
30	return VFileOpen(path.toUtf8().constData(), mode);
31}
32
33VDir* VFileDevice::openDir(const QString& path) {
34	return VDirOpen(path.toUtf8().constData());
35}
36VDir* VFileDevice::openArchive(const QString& path) {
37	return VDirOpenArchive(path.toUtf8().constData());
38}