12 if (mmapBuf.
empty()) {
33 if (newSize < oldSize) {
37 auto remaining = newSize - oldSize;
40 std::array<uint8_t, 4096> buf = {};
42 auto chunkSize =
std::min(buf.size(), remaining);
44 remaining -= chunkSize;
virtual void write(std::span< const uint8_t > buffer)=0
virtual size_t getSize()=0
virtual const std::string & getURL() const =0
virtual void read(std::span< uint8_t > buffer)=0
virtual std::string_view getOriginalName()
virtual std::string getLocalReference()
virtual void seek(size_t pos)=0
virtual std::span< const uint8_t > mmap()
virtual size_t getPos()=0
virtual void truncate(size_t size)
bool empty() const
No memory allocated?
const T * data() const
Returns pointer to the start of the memory buffer.
void clear()
Free the allocated memory block and set the current size to 0.
constexpr vecN< N, T > min(const vecN< N, T > &x, const vecN< N, T > &y)
string_view getFilename(string_view path)
Returns the file portion of a path name.
This file implemented 3 utility functions:
void swap(openmsx::MemBuffer< T > &l, openmsx::MemBuffer< T > &r) noexcept
size_t size(std::string_view utf8)
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)