mirror of
https://github.com/akuker/RASCSI.git
synced 2024-11-25 05:32:20 +00:00
621cc7d5a2
* Unit test updates * Lambda syntax cleanup * Use new-style casts * Use std::none_of when saving the cache * Use to_integer instead of casts * Use accessors for getting CDB data * Made ctrl_t private * Improved encapsulation * Replaced pointers by references * Removed all remaining occurrences of DWORD and BYTE, making os.h obsolete
43 lines
860 B
C++
43 lines
860 B
C++
//---------------------------------------------------------------------------
|
||
//
|
||
// X68000 EMULATOR "XM6"
|
||
//
|
||
// Copyright (C) 2001-2005 PI.(ytanaka@ipc-tokai.or.jp)
|
||
// Copyright (C) 2013-2020 GIMONS
|
||
// [ File I/O (Subset for RaSCSI) ]
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
|
||
#pragma once
|
||
|
||
#include <cstdint>
|
||
#include <cstdlib>
|
||
|
||
class Fileio
|
||
{
|
||
public:
|
||
|
||
enum class OpenMode {
|
||
ReadOnly,
|
||
WriteOnly,
|
||
ReadWrite
|
||
};
|
||
|
||
Fileio() = default;
|
||
virtual ~Fileio();
|
||
Fileio(Fileio&) = default;
|
||
Fileio& operator=(const Fileio&) = default;
|
||
|
||
bool Open(const char *fname, OpenMode mode);
|
||
bool Read(uint8_t *buffer, int size) const;
|
||
bool Write(const uint8_t *buffer, int size) const;
|
||
off_t GetFileSize() const;
|
||
void Close();
|
||
|
||
private:
|
||
|
||
bool Open(const char *fname, OpenMode mode, bool directIO);
|
||
|
||
int handle = -1;
|
||
};
|