1
0
mirror of synced 2025-01-31 03:53:44 +01:00

impr: Added some documentation to providers (#1001)

This commit is contained in:
Thomas 2023-04-01 11:17:19 +02:00 committed by GitHub
parent 60efb6973b
commit 24106b860a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,9 @@
namespace hex::prv {
/**
* @brief Represent the data source for a tab
*/
class Provider {
public:
constexpr static size_t PageSize = 0x1000'0000;
@ -29,7 +32,21 @@ namespace hex::prv {
[[nodiscard]] virtual bool isResizable() const = 0;
[[nodiscard]] virtual bool isSavable() const = 0;
/**
* @brief Read data from this provider, applying overlays and patches
* @param offset offset to start reading the data
* @param buffer buffer to write read data
* @param size number of bytes to read
* @param overlays apply overlays and patches is true. Same as readRaw() if false
*/
virtual void read(u64 offset, void *buffer, size_t size, bool overlays = true);
/**
* @brief Write data to the patches of this provider. Will not directly modify provider.
* @param offset offset to start writing the data
* @param buffer buffer to take data to write from
* @param size number of bytes to write
*/
virtual void write(u64 offset, const void *buffer, size_t size);
virtual void resize(size_t newSize);
@ -39,7 +56,19 @@ namespace hex::prv {
virtual void save();
virtual void saveAs(const std::fs::path &path);
/**
* @brief Read data from this provider, without applying overlays and patches
* @param offset offset to start reading the data
* @param buffer buffer to write read data
* @param size number of bytes to read
*/
virtual void readRaw(u64 offset, void *buffer, size_t size) = 0;
/**
* @brief Write data directly to this provider
* @param offset offset to start writing the data
* @param buffer buffer to take data to write from
* @param size number of bytes to write
*/
virtual void writeRaw(u64 offset, const void *buffer, size_t size) = 0;
[[nodiscard]] virtual size_t getActualSize() const = 0;