aboutsummaryrefslogtreecommitdiff
path: root/src/base/io/ProxyStream.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2026-03-07 20:42:37 +0800
committerYuqian Yang <crupest@crupest.life>2026-03-07 20:42:37 +0800
commit38756822825e20eca3b9e01b735946175223d692 (patch)
treefc2a495bfc0e082d5ed9a1642278ae6467fe2742 /src/base/io/ProxyStream.cpp
parent924f4b472712d0cfc55b81dcb3eaed3f8a478288 (diff)
downloadcru-38756822825e20eca3b9e01b735946175223d692.tar.gz
cru-38756822825e20eca3b9e01b735946175223d692.tar.bz2
cru-38756822825e20eca3b9e01b735946175223d692.zip
Refactor stream.
Diffstat (limited to 'src/base/io/ProxyStream.cpp')
-rw-r--r--src/base/io/ProxyStream.cpp37
1 files changed, 0 insertions, 37 deletions
diff --git a/src/base/io/ProxyStream.cpp b/src/base/io/ProxyStream.cpp
deleted file mode 100644
index de66169e..00000000
--- a/src/base/io/ProxyStream.cpp
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "cru/base/io/ProxyStream.h"
-#include "cru/base/io/Stream.h"
-
-namespace cru::io {
-ProxyStream::ProxyStream(ProxyStreamHandlers handlers)
- : Stream(static_cast<bool>(handlers.seek), static_cast<bool>(handlers.read),
- static_cast<bool>(handlers.write)),
- handlers_(std::move(handlers)) {}
-
-ProxyStream::~ProxyStream() { DoClose(); }
-
-Index ProxyStream::DoSeek(Index offset, SeekOrigin origin) {
- return handlers_.seek(offset, origin);
-}
-
-Index ProxyStream::DoRead(std::byte* buffer, Index offset, Index size) {
- return handlers_.read(buffer, offset, size);
-}
-
-Index ProxyStream::DoWrite(const std::byte* buffer, Index offset, Index size) {
- return handlers_.write(buffer, offset, size);
-}
-
-void ProxyStream::DoFlush() {
- if (handlers_.flush) {
- handlers_.flush();
- }
-}
-
-void ProxyStream::DoClose() {
- CRU_STREAM_BEGIN_CLOSE
- if (handlers_.close) {
- handlers_.close();
- }
- handlers_ = {};
-}
-} // namespace cru::io