StormByte C++ Library: Crypto module 1.0.0
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
compressor.hxx
1#pragma once
2
3#include <StormByte/buffer/consumer.hxx>
4#include <StormByte/crypto/algorithm.hxx>
5#include <StormByte/crypto/exception.hxx>
6#include <StormByte/expected.hxx>
7
8#include <string>
9
14namespace StormByte::Crypto {
21 class STORMBYTE_CRYPTO_PUBLIC Compressor final {
22 public:
27 explicit Compressor(const Algorithm::Compress& algorithm) noexcept;
28
33 Compressor(const Compressor& compressor) = default;
34
39 Compressor(Compressor&& compressor) noexcept = default;
40
44 ~Compressor() noexcept = default;
45
51 Compressor& operator=(const Compressor& compressor) = default;
52
58 Compressor& operator=(Compressor&& compressor) noexcept = default;
59
65 [[nodiscard]]
66 Expected<std::string, Exception> Compress(const std::string& input) const noexcept;
67
73 [[nodiscard]]
74 Expected<Buffer::Simple, Exception> Compress(const Buffer::Simple& buffer) const noexcept;
75
81 [[nodiscard]]
82 Buffer::Consumer Compress(const Buffer::Consumer consumer) const noexcept;
83
89 [[nodiscard]]
90 Expected<std::string, Exception> Decompress(const std::string& input) const noexcept;
91
97 [[nodiscard]]
98 Expected<Buffer::Simple, Exception> Decompress(const Buffer::Simple& buffer) const noexcept;
99
105 [[nodiscard]]
106 Buffer::Consumer Decompress(const Buffer::Consumer consumer) const noexcept;
107
108 private:
109 const Algorithm::Compress m_algorithm;
110 };
111}
A class for managing data compression and decompression.
Definition compressor.hxx:21
Compressor(const Algorithm::Compress &algorithm) noexcept
Initializes a Compressor instance with the specified compression algorithm.
Compressor(Compressor &&compressor) noexcept=default
Move constructor for the Compressor class.
Compressor(const Compressor &compressor)=default
Copy constructor for the Compressor class.
~Compressor() noexcept=default
Destructor for the Compressor class.
A class representing an exception in the crypto module.
Definition exception.hxx:15
The namespace containing cryptographic algorithms.