diff --git a/lib/libimhex/include/hex/providers/provider.hpp b/lib/libimhex/include/hex/providers/provider.hpp index 521a44033..f7e1dfefa 100644 --- a/lib/libimhex/include/hex/providers/provider.hpp +++ b/lib/libimhex/include/hex/providers/provider.hpp @@ -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;