update io::Device::read

This commit is contained in:
MihailRis 2025-02-04 16:55:43 +03:00
parent dceb5f6ee4
commit 3e67d887f4
5 changed files with 72 additions and 29 deletions

View file

@ -1,6 +1,8 @@
#pragma once
#include <string>
#include <memory>
#include <iostream>
#include <filesystem>
#include "../path.hpp"
@ -13,7 +15,7 @@ namespace io {
virtual std::filesystem::path resolve(std::string_view path) = 0;
virtual void write(std::string_view path, const void* data, size_t size) = 0;
virtual void read(std::string_view path, void* data, size_t size) = 0;
virtual std::unique_ptr<std::istream> read(std::string_view path) = 0;
virtual size_t size(std::string_view path) = 0;
@ -43,8 +45,8 @@ namespace io {
parent->write((root / path).pathPart(), data, size);
}
void read(std::string_view path, void* data, size_t size) override {
parent->read((root / path).pathPart(), data, size);
std::unique_ptr<std::istream> read(std::string_view path) override {
return parent->read((root / path).pathPart());
}
size_t size(std::string_view path) override {