mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
39 lines
848 B
C++
39 lines
848 B
C++
#ifndef WINFILE_H
|
|
#define WINFILE_H
|
|
|
|
/*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
* Copyright (C) 2020 Raspberry Pi (Trading) Limited
|
|
*/
|
|
|
|
#include <QObject>
|
|
#include <QIODevice>
|
|
#include <windows.h>
|
|
|
|
class WinFile : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit WinFile(QObject *parent = nullptr);
|
|
virtual ~WinFile();
|
|
void setFileName(const QString &name);
|
|
bool open(QIODevice::OpenMode mode);
|
|
void close();
|
|
bool isOpen();
|
|
qint64 write(const char *data, qint64 maxSize);
|
|
qint64 read(char *data, qint64 maxSize);
|
|
HANDLE handle();
|
|
QString errorString() const;
|
|
bool flush();
|
|
bool seek(qint64 pos);
|
|
qint64 pos();
|
|
bool lockVolume();
|
|
bool unlockVolume();
|
|
|
|
protected:
|
|
bool _locked;
|
|
QString _name, _lasterror;
|
|
HANDLE _h;
|
|
};
|
|
|
|
#endif // WINFILE_H
|