summaryrefslogtreecommitdiff
path: root/include/fud_c_file.hpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2024-10-02 10:12:45 -0500
committerDominick Allen <djallen@librehumanitas.org>2024-10-02 10:12:45 -0500
commit132ddf65fe6e253ebd113036d61c51cd0eb5e827 (patch)
treea3a3d475a7919cf42fb6736a74187bc4dbdbdab2 /include/fud_c_file.hpp
parent2cdb2cac44a07fa5db72408f62427a64f32c1d90 (diff)
Add method to write data where size = length.
Diffstat (limited to 'include/fud_c_file.hpp')
-rw-r--r--include/fud_c_file.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/fud_c_file.hpp b/include/fud_c_file.hpp
index f451292..0d52e95 100644
--- a/include/fud_c_file.hpp
+++ b/include/fud_c_file.hpp
@@ -267,6 +267,17 @@ class CFile {
return self.read(&destination, sizeof(destination), length, offset);
}
+ [[nodiscard]] WriteResult write(const void* source, size_t sourceSize)
+ {
+ auto& self = static_cast<Derived&>(*this);
+ auto offsetResult = self.size();
+ if (offsetResult.isError()) {
+ return WriteResult{0, offsetResult.getError()};
+ }
+
+ return self.write(source, sourceSize, sourceSize, offsetResult.getOkay());
+ }
+
[[nodiscard]] WriteResult write(const void* source, size_t sourceSize, size_t length)
{
auto& self = static_cast<Derived&>(*this);