2020-11-11 09:18:35 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "providers/provider.hpp"
|
|
|
|
|
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
namespace hex::prv {
|
|
|
|
|
|
|
|
class FileProvider : public Provider {
|
|
|
|
public:
|
2020-11-11 10:47:02 +01:00
|
|
|
explicit FileProvider(std::string_view path);
|
|
|
|
~FileProvider() override;
|
2020-11-11 09:18:35 +01:00
|
|
|
|
2020-11-11 10:47:02 +01:00
|
|
|
bool isAvailable() override;
|
|
|
|
bool isReadable() override;
|
|
|
|
bool isWritable() override;
|
2020-11-11 09:18:35 +01:00
|
|
|
|
2020-11-11 10:47:02 +01:00
|
|
|
void read(u64 offset, void *buffer, size_t size) override;
|
|
|
|
void write(u64 offset, void *buffer, size_t size) override;
|
|
|
|
size_t getSize() override;
|
2020-11-11 09:18:35 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
FILE *m_file;
|
|
|
|
|
|
|
|
bool m_readable, m_writable;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|