openMSX
MemoryBufferFile.hh
Go to the documentation of this file.
1 #ifndef MEMORYBUFFERFILE_HH
2 #define MEMORYBUFFERFILE_HH
3 
4 #include "FileBase.hh"
5 
6 namespace openmsx {
7 
8 class File;
9 
10 class MemoryBufferFile final : public FileBase
11 {
12 public:
14  : buffer(buffer_) {}
15 
16  void read(void* dst, size_t num) override;
17  void write(const void* src, size_t num) 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 
28 private:
29  span<const uint8_t> buffer;
30  size_t pos = 0;
31 };
32 
34 
35 } // namespace openmsx
36 
37 #endif
const std::string & getURL() const override
time_t getModificationDate() override
bool isReadOnly() const override
MemoryBufferFile(span< const uint8_t > buffer_)
void write(const void *src, size_t num) override
void read(void *dst, size_t num) override
void seek(size_t newPos) override
This file implemented 3 utility functions:
Definition: Autofire.cc:9
File memory_buffer_file(span< const uint8_t > buffer)