mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 08:52:06 +00:00
1c845185c1
Correctly use AbortMultipleUpload request. Support std::ios_base::end StdStreamBufFromReadBuffer::seekpos().
40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <streambuf>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
class ReadBuffer;
|
|
class SeekableReadBuffer;
|
|
|
|
/// `std::streambuf`-compatible wrapper around a ReadBuffer.
|
|
class StdStreamBufFromReadBuffer : public std::streambuf
|
|
{
|
|
public:
|
|
using Base = std::streambuf;
|
|
|
|
explicit StdStreamBufFromReadBuffer(std::unique_ptr<ReadBuffer> read_buffer_, size_t size_);
|
|
explicit StdStreamBufFromReadBuffer(ReadBuffer & read_buffer_, size_t size_);
|
|
~StdStreamBufFromReadBuffer() override;
|
|
|
|
private:
|
|
int underflow() override;
|
|
std::streamsize showmanyc() override;
|
|
std::streamsize xsgetn(char* s, std::streamsize count) override;
|
|
std::streampos seekoff(std::streamoff off, std::ios_base::seekdir dir, std::ios_base::openmode which) override;
|
|
std::streampos seekpos(std::streampos pos, std::ios_base::openmode which) override;
|
|
|
|
std::streamsize xsputn(const char* s, std::streamsize n) override;
|
|
int overflow(int c) override;
|
|
|
|
std::streampos getCurrentPosition() const;
|
|
|
|
std::unique_ptr<ReadBuffer> read_buffer;
|
|
SeekableReadBuffer * seekable_read_buffer = nullptr;
|
|
size_t size;
|
|
};
|
|
|
|
}
|