summaryrefslogtreecommitdiffstats
path: root/src/CircularBufferCompressor.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2021-01-11 17:39:43 +0100
committerGitHub <noreply@github.com>2021-01-11 17:39:43 +0100
commiteeb63b8901a9c049f1bb594abb9ce9b4a9c47620 (patch)
treeb07daae788f918b83eeb0bdbd51e49292f1c8d88 /src/CircularBufferCompressor.h
parentFixed switch-ups regarding some slab and stair recipes (#5099) (diff)
downloadcuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.gz
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.bz2
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.lz
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.xz
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.tar.zst
cuberite-eeb63b8901a9c049f1bb594abb9ce9b4a9c47620.zip
Diffstat (limited to 'src/CircularBufferCompressor.h')
-rw-r--r--src/CircularBufferCompressor.h43
1 files changed, 43 insertions, 0 deletions
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<std::byte> 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<std::byte> m_ContiguousIntermediate;
+};