Cleanup filter_out_stream implementation

This commit is contained in:
topjohnwu
2023-05-20 01:28:10 -07:00
parent 655f778171
commit f5aaff2b1e
6 changed files with 13 additions and 50 deletions

View File

@@ -18,16 +18,11 @@ using out_strm_ptr = std::unique_ptr<out_stream>;
class filter_out_stream : public out_stream {
public:
filter_out_stream(out_strm_ptr &&base) : base(std::move(base)) {}
bool write(const void *buf, size_t len) override;
virtual bool write(const void *buf, size_t len, bool final);
protected:
out_strm_ptr base;
};
using filter_strm_ptr = std::unique_ptr<filter_out_stream>;
// Buffered output stream, writing in chunks
class chunk_out_stream : public filter_out_stream {
public:
@@ -40,7 +35,6 @@ public:
~chunk_out_stream() override { delete[] _buf; }
bool write(const void *buf, size_t len) final;
bool write(const void *buf, size_t len, bool final) final;
protected:
// Classes inheriting this class has to call finalize() in its destructor
@@ -63,7 +57,7 @@ struct in_stream {
};
// A channel is something that is writable, readable, and seekable
struct channel : public in_stream, public out_stream {
struct channel : public out_stream, public in_stream {
virtual off_t seek(off_t off, int whence) = 0;
virtual ~channel() = default;
};