refactor file2 and add span with ownership

This commit is contained in:
2024-05-26 21:32:44 +02:00
parent 2420af464f
commit f2f001b190
7 changed files with 72 additions and 14 deletions

View File

@@ -19,7 +19,7 @@ struct File2WFile : public File2I {
bool isGood(void) override;
bool write(const ByteSpan data, int64_t pos = -1) override;
std::variant<ByteSpan, std::vector<uint8_t>> read(uint64_t size, int64_t pos = -1) override;
ByteSpanWithOwnership read(uint64_t size, int64_t pos = -1) override;
};
// read write, requires an existing file, file size is fixed
@@ -35,7 +35,7 @@ struct File2RWFile : public File2I {
bool isGood(void) override;
bool write(const ByteSpan data, int64_t pos = -1) override;
std::variant<ByteSpan, std::vector<uint8_t>> read(uint64_t size, int64_t pos = -1) override;
ByteSpanWithOwnership read(uint64_t size, int64_t pos = -1) override;
};
// cut down interface (write disabled)