From eeb63b8901a9c049f1bb594abb9ce9b4a9c47620 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Mon, 11 Jan 2021 16:39:43 +0000 Subject: zlib -> libdeflate (#5085) + Use libdeflate + Use std::byte * Fix passing temporary to string_view + Emulate make_unique_for_overwrite --- src/CircularBufferCompressor.h | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/CircularBufferCompressor.h (limited to 'src/CircularBufferCompressor.h') diff --git a/src/CircularBufferCompressor.h b/src/CircularBufferCompressor.h new file mode 100644 index 000000000..12c708baf --- /dev/null +++ b/src/CircularBufferCompressor.h @@ -0,0 +1,43 @@ + +#pragma once + +#include "StringCompression.h" + + + + + +class CircularBufferCompressor +{ +public: + + ContiguousByteBufferView GetView() const; + + Compression::Result Compress(); + void ReadFrom(cByteBuffer & Buffer); + void ReadFrom(cByteBuffer & Buffer, size_t Size); + +private: + + Compression::Compressor m_Compressor; + std::basic_string m_ContiguousIntermediate; +}; + + + + + +class CircularBufferExtractor +{ +public: + + ContiguousByteBufferView GetView() const; + + Compression::Result Extract(size_t UncompressedSize); + void ReadFrom(cByteBuffer & Buffer, size_t Size); + +private: + + Compression::Extractor m_Extractor; + std::basic_string m_ContiguousIntermediate; +}; -- cgit v1.2.3