StormByte-Crypto 2.0.0
C++26 cryptography module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Crypto::Compressor::Generic Class Referenceabstract

Abstract compressor. More...

#include <StormByte/crypto/compressor/generic.hxx>

Inheritance diagram for StormByte::Crypto::Compressor::Generic:
Collaboration diagram for StormByte::Crypto::Compressor::Generic:

Public Member Functions

unsigned short Level () const noexcept
 Compression level.
 
enum Type Type () const noexcept
 Codec of this compressor.
 
Construction
 Generic (const Generic &other)=default
 Copy constructor.
 
 Generic (Generic &&other) noexcept=default
 Move constructor.
 
virtual ~Generic () noexcept
 Destructor.
 
Generic & operator= (const Generic &other)=default
 Copy assignment.
 
Generic & operator= (Generic &&other) noexcept=default
 Move assignment.
 
Compress
bool Compress (const std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
 Compress a byte span.
 
template<StormByte::Type::ByteInputRange Range>
bool Compress (const Range &input, Buffer::WriteOnly &output) const
 Compress an input range of byte-convertible values.
 
bool Compress (const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Compress a read-only buffer (copy).
 
bool Compress (Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Compress a buffer, consuming it.
 
Buffer::Consumer Compress (Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
 Compress a Consumer into another Consumer.
 
Decompress
bool Decompress (const std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
 Decompress a byte span.
 
template<StormByte::Type::ByteInputRange Range>
bool Decompress (const Range &input, Buffer::WriteOnly &output) const
 Decompress an input range of byte-convertible values.
 
bool Decompress (const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Decompress a read-only buffer (copy).
 
bool Decompress (Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Decompress a buffer, consuming it.
 
Buffer::Consumer Decompress (Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
 Decompress a Consumer into another Consumer.
 
- Public Member Functions inherited from StormByte::Safe::Clonable< Generic >
constexpr Clonable ()=default
 
constexpr Clonable (const Clonable &)=default
 
constexpr Clonable (Clonable &&) noexcept=default
 
constexpr Clonable & operator= (const Clonable &)=default
 
constexpr Clonable & operator= (Clonable &&) noexcept=default
 
virtual constexpr ~Clonable () noexcept=default
 
virtual PointerType Clone () const =0
 
virtual PointerType Move ()=0
 

Protected Member Functions

 Generic (enum Type type, unsigned short level=5)
 Construct with a codec and level.
 

Protected Attributes

enum Type m_type
 Codec.
 
unsigned short m_level = 0
 Compression level.
 

Additional Inherited Members

- Public Types inherited from StormByte::Safe::Clonable< Generic >
typedef SmartPointer PointerType
 
- Static Public Member Functions inherited from StormByte::Safe::Clonable< Generic >
static PointerType MakePointer (Args &&... args)
 

Detailed Description

Abstract compressor.

Concrete codecs derive from this.

Constructor & Destructor Documentation

◆ Generic() [1/3]

StormByte::Crypto::Compressor::Generic::Generic ( const Generic &  other)
default

Copy constructor.

Parameters
otherCompressor to copy.

◆ Generic() [2/3]

StormByte::Crypto::Compressor::Generic::Generic ( Generic &&  other)
defaultnoexcept

Move constructor.

Parameters
otherCompressor to move.

◆ ~Generic()

virtual StormByte::Crypto::Compressor::Generic::~Generic ( )
virtualnoexcept

Destructor.

◆ Generic() [3/3]

StormByte::Crypto::Compressor::Generic::Generic ( enum Type  type,
unsigned short  level = 5 
)
inlineprotected

Construct with a codec and level.

Parameters
typeCodec.
levelCompression level.

Member Function Documentation

◆ Compress() [1/5]

Buffer::Consumer StormByte::Crypto::Compressor::Generic::Compress ( Buffer::Consumer  consumer,
ReadMode  mode = ReadMode::Move 
) const
inlinenoexcept

Compress a Consumer into another Consumer.

Parameters
consumerInput consumer.
modeCopy or move.
Returns
Consumer with compressed data.

◆ Compress() [2/5]

bool StormByte::Crypto::Compressor::Generic::Compress ( Buffer::ReadOnly &  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Compress a buffer, consuming it.

Parameters
inputInput buffer.
outputDestination buffer.
Returns
true on success.

◆ Compress() [3/5]

bool StormByte::Crypto::Compressor::Generic::Compress ( const Buffer::ReadOnly &  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Compress a read-only buffer (copy).

Parameters
inputInput buffer.
outputDestination buffer.
Returns
true on success.

◆ Compress() [4/5]

bool StormByte::Crypto::Compressor::Generic::Compress ( const Range &  input,
Buffer::WriteOnly &  output 
) const
inline

Compress an input range of byte-convertible values.

Template Parameters
RangeInput range type.
Parameters
inputInput values.
outputDestination buffer.
Returns
true on success.

◆ Compress() [5/5]

bool StormByte::Crypto::Compressor::Generic::Compress ( const std::span< const std::byte >  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Compress a byte span.

Parameters
inputInput bytes.
outputDestination buffer.
Returns
true on success.

◆ Decompress() [1/5]

Buffer::Consumer StormByte::Crypto::Compressor::Generic::Decompress ( Buffer::Consumer  consumer,
ReadMode  mode = ReadMode::Move 
) const
inlinenoexcept

Decompress a Consumer into another Consumer.

Parameters
consumerInput consumer.
modeCopy or move.
Returns
Consumer with decompressed data.

◆ Decompress() [2/5]

bool StormByte::Crypto::Compressor::Generic::Decompress ( Buffer::ReadOnly &  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Decompress a buffer, consuming it.

Parameters
inputInput buffer.
outputDestination buffer.
Returns
true on success.

◆ Decompress() [3/5]

bool StormByte::Crypto::Compressor::Generic::Decompress ( const Buffer::ReadOnly &  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Decompress a read-only buffer (copy).

Parameters
inputInput buffer.
outputDestination buffer.
Returns
true on success.

◆ Decompress() [4/5]

bool StormByte::Crypto::Compressor::Generic::Decompress ( const Range &  input,
Buffer::WriteOnly &  output 
) const
inline

Decompress an input range of byte-convertible values.

Template Parameters
RangeInput range type.
Parameters
inputInput values.
outputDestination buffer.
Returns
true on success.

◆ Decompress() [5/5]

bool StormByte::Crypto::Compressor::Generic::Decompress ( const std::span< const std::byte >  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Decompress a byte span.

Parameters
inputInput bytes.
outputDestination buffer.
Returns
true on success.

◆ Level()

unsigned short StormByte::Crypto::Compressor::Generic::Level ( ) const
inlinenoexcept

Compression level.

Returns
Level.

◆ operator=() [1/2]

Copy assignment.

Parameters
otherCompressor to copy.
Returns
Reference to this compressor.

◆ operator=() [2/2]

Move assignment.

Parameters
otherCompressor to move.
Returns
Reference to this compressor.

◆ Type()

enum Type StormByte::Crypto::Compressor::Generic::Type ( ) const
inlinenoexcept

Codec of this compressor.

Returns
Compressor type.

Member Data Documentation

◆ m_level

unsigned short StormByte::Crypto::Compressor::Generic::m_level = 0
protected

Compression level.

◆ m_type

enum Type StormByte::Crypto::Compressor::Generic::m_type
protected

Codec.


The documentation for this class was generated from the following file: