openMSX
MemoryBufferFile.hh
Go to the documentation of this file.
1#ifndef MEMORYBUFFERFILE_HH
2#define MEMORYBUFFERFILE_HH
3
4#include "FileBase.hh"
5
6namespace openmsx {
7
8class File;
9
10class MemoryBufferFile final : public FileBase
11{
12public:
13 explicit MemoryBufferFile(std::span<const uint8_t> buffer_)
14 : buffer(buffer_) {}
15
16 void read(std::span<uint8_t> dst) override;
17 void write(std::span<const uint8_t> src) override;
18
19 size_t getSize() override;
20 void seek(size_t newPos) override;
21 size_t getPos() override;
22 void flush() override;
23
24 const std::string& getURL() const override;
25 bool isReadOnly() const override;
26 time_t getModificationDate() override;
27
28private:
29 std::span<const uint8_t> buffer;
30 size_t pos = 0;
31};
32
33File memory_buffer_file(std::span<const uint8_t> buffer);
34
35} // namespace openmsx
36
37#endif
const std::string & getURL() const override
void write(std::span< const uint8_t > src) override
time_t getModificationDate() override
bool isReadOnly() const override
void read(std::span< uint8_t > dst) override
MemoryBufferFile(std::span< const uint8_t > buffer_)
void seek(size_t newPos) override
This file implemented 3 utility functions:
Definition Autofire.cc:11
File memory_buffer_file(std::span< const uint8_t > buffer)