all repos — mgba @ 2f2e5398719f9d6a78ae84fc241945b46839b01c

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(QString path, int mode) {
30	return VFileOpen(path.toLocal8Bit().constData(), mode);
31}