12 if (mmapBuf.
empty()) {
17 read(std::span{tmpBuf});
18 std::swap(mmapBuf, tmpBuf);
22 return std::span{mmapBuf};
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)
This class manages the lifetime of a block of memory.
void clear()
Free the allocated memory block and set the current size to 0.
string_view getFilename(string_view path)
Returns the file portion of a path name.
This file implemented 3 utility functions:
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)