aboutsummaryrefslogtreecommitdiff
path: root/src/common/io/Stream.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2022-01-13 18:25:45 +0800
committercrupest <crupest@outlook.com>2022-01-13 18:25:45 +0800
commitd4d9c6810954010e5de23aba19244f59f2139e41 (patch)
treed2e3277cc7e1f352f1aa5f865b7c7450b9fe4247 /src/common/io/Stream.cpp
parent276ae73fa444c16f34a379ae9d8f58c883056b4a (diff)
downloadcru-d4d9c6810954010e5de23aba19244f59f2139e41.tar.gz
cru-d4d9c6810954010e5de23aba19244f59f2139e41.tar.bz2
cru-d4d9c6810954010e5de23aba19244f59f2139e41.zip
...
Diffstat (limited to 'src/common/io/Stream.cpp')
-rw-r--r--src/common/io/Stream.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/common/io/Stream.cpp b/src/common/io/Stream.cpp
new file mode 100644
index 00000000..6addfdc0
--- /dev/null
+++ b/src/common/io/Stream.cpp
@@ -0,0 +1,21 @@
+#include "cru/common/io/Stream.hpp"
+
+namespace cru::io {
+void Stream::Rewind() { Seek(0); }
+
+Index Stream::GetSize() {
+ Index current_position = Tell();
+ Seek(0, SeekOrigin::End);
+ Index size = Tell();
+ Seek(current_position);
+ return size;
+}
+
+Index Stream::Read(std::byte* buffer, Index size) {
+ return Read(buffer, 0, size);
+}
+
+Index Stream::Write(const std::byte* buffer, Index size) {
+ return Write(buffer, 0, size);
+}
+} // namespace cru::io