diff options
author | crupest <crupest@outlook.com> | 2024-06-24 00:06:25 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2024-10-04 19:55:33 +0800 |
commit | f51eb955e188858272230a990565931e7403f23b (patch) | |
tree | 04de484bfcd056b6eea56c13c42cce83315c448f /include/cru/common/io/BufferStream.h | |
parent | 1b30150ab79ff1338f209a8ddb54b3dc60cfb599 (diff) | |
download | cru-f51eb955e188858272230a990565931e7403f23b.tar.gz cru-f51eb955e188858272230a990565931e7403f23b.tar.bz2 cru-f51eb955e188858272230a990565931e7403f23b.zip |
HALF WORK: Stream refactor.
TODO: Complete refactor of BufferStream and AutoReadStream.
NEED TEST: BufferStream, AutoReadStream, SubProcess.
Diffstat (limited to 'include/cru/common/io/BufferStream.h')
-rw-r--r-- | include/cru/common/io/BufferStream.h | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/include/cru/common/io/BufferStream.h b/include/cru/common/io/BufferStream.h index 16ba999b..5ebff546 100644 --- a/include/cru/common/io/BufferStream.h +++ b/include/cru/common/io/BufferStream.h @@ -59,21 +59,18 @@ struct BufferStreamOptions { class BufferStream : public Stream { public: BufferStream(const BufferStreamOptions& options); - ~BufferStream() override; - bool CanSeek() override; - Index Seek(Index offset, SeekOrigin origin = SeekOrigin::Current) override; + CRU_STREAM_IMPLEMENT_CLOSE_BY_DO_CLOSE - bool CanRead() override; - Index Read(std::byte* buffer, Index offset, Index size) override; - using Stream::Read; + void SetEof(); - bool CanWrite() override; - Index Write(const std::byte* buffer, Index offset, Index size) override; - using Stream::Write; + protected: + Index DoRead(std::byte* buffer, Index offset, Index size) override; + Index DoWrite(const std::byte* buffer, Index offset, Index size) override; - void SetEof(); + private: + void DoClose(); private: Index block_size_; |