43#include <StormByte/buffer/consumer.hxx>
46#include <StormByte/safe/binary.hxx>
47#include <StormByte/safe/clonable.hxx>
48#include <StormByte/type_traits.hxx>
49#include <StormByte/type_traits/safe.hxx>
137 return DoCompress(input, output);
147 template<StormByte::Type::ByteInputRange Range>
150 return Compress(std::span<const std::byte>{data.
span()}, output);
180 return DoCompress(consumer, mode);
195 return DoDecompress(input, output);
205 template<StormByte::Type::ByteInputRange Range>
208 return Decompress(std::span<const std::byte>{data.
span()}, output);
238 return DoDecompress(consumer, mode);
246 unsigned short Level() const noexcept {
277 virtual bool DoCompress(std::span<const std::byte> input,
Buffer::WriteOnly& output)
const noexcept = 0;
302 virtual bool DoDecompress(std::span<const std::byte> input,
Buffer::WriteOnly& output)
const noexcept = 0;
bzip2 compressor.
Definition bzip2.hxx:66
Abstract compressor.
Definition generic.hxx:88
bool Compress(const Range &input, Buffer::WriteOnly &output) const
Compress an input range of byte-convertible values.
Definition generic.hxx:148
enum Type Type() const noexcept
Codec of this compressor.
Definition generic.hxx:254
bool Decompress(const Range &input, Buffer::WriteOnly &output) const
Decompress an input range of byte-convertible values.
Definition generic.hxx:206
bool Decompress(Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Decompress a buffer, consuming it.
Definition generic.hxx:227
Buffer::Consumer Compress(Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
Compress a Consumer into another Consumer.
Definition generic.hxx:179
Buffer::Consumer Decompress(Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
Decompress a Consumer into another Consumer.
Definition generic.hxx:237
bool Decompress(const std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
Decompress a byte span.
Definition generic.hxx:194
Generic(Generic &&other) noexcept=default
Move constructor.
Generic(const Generic &other)=default
Copy constructor.
unsigned short Level() const noexcept
Compression level.
Definition generic.hxx:246
virtual ~Generic() noexcept
Destructor.
bool Compress(const std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
Compress a byte span.
Definition generic.hxx:136
bool Compress(const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Compress a read-only buffer (copy).
Definition generic.hxx:159
bool Decompress(const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Decompress a read-only buffer (copy).
Definition generic.hxx:217
unsigned short m_level
Compression level.
Definition generic.hxx:260
enum Type m_type
Codec.
Definition generic.hxx:259
Generic(enum Type type, unsigned short level=5)
Construct with a codec and level.
Definition generic.hxx:267
bool Compress(Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
Compress a buffer, consuming it.
Definition generic.hxx:169
zlib compressor.
Definition zlib.hxx:66
STORMBYTE_FORCE_INLINE std::span< std::byte > span() noexcept
STORMBYTE_DECLARE_MAYBE_SAFE(class StormByte::System::Device::Access)
Compressors of the Crypto module.
Generic::PointerType Create(Type type, unsigned short level) noexcept
Factory for a compressor.
Crypto module of the StormByte suite.
Definition aead.hxx:53
ReadMode
How a source buffer is consumed.
Definition typedefs.hxx:57
@ Copy
Copy the input.
Definition typedefs.hxx:58
@ Move
Consume the input.
Definition typedefs.hxx:59
Root namespace of the StormByte suite.
#define STORMBYTE_CRYPTO_PUBLIC
Definition visibility.h:53