ClickHouse/src/IO/HexWriteBuffer.h

29 lines
611 B
C++
Raw Normal View History

#pragma once
#include <IO/WriteBuffer.h>
2017-05-28 14:29:40 +00:00
/// Since HexWriteBuffer is often created in the inner loop, we'll make its buffer size small.
2011-11-29 17:23:30 +00:00
#define DBMS_HEX_WRITE_BUFFER_SIZE 32
namespace DB
{
2017-05-28 14:29:40 +00:00
/** Everything that is written into it, translates to HEX (in capital letters) and writes to another WriteBuffer.
*/
2017-06-01 13:41:58 +00:00
class HexWriteBuffer final : public WriteBuffer
{
protected:
2019-04-22 16:07:09 +00:00
char buf[DBMS_HEX_WRITE_BUFFER_SIZE]; //-V730
WriteBuffer & out;
2017-06-01 13:41:58 +00:00
void nextImpl() override;
public:
HexWriteBuffer(WriteBuffer & out_) : WriteBuffer(buf, sizeof(buf)), out(out_) {}
2017-06-01 13:41:58 +00:00
~HexWriteBuffer() override;
};
}