Tkrzw
Public Member Functions | List of all members
tkrzw::Compressor Class Referenceabstract

Interfrace of data compression and decompression. More...

#include <tkrzw_compress.h>

Public Member Functions

virtual ~Compressor ()=default
 Destructor. More...
 
virtual bool IsSupported () const =0
 Checks whether the implementation is actually supported. More...
 
virtual char * Compress (const void *buf, size_t size, size_t *sp) const =0
 Compresses a serial data. More...
 
virtual char * Decompress (const void *buf, size_t size, size_t *sp) const =0
 Decompresses a serial data. More...
 
virtual std::unique_ptr< CompressorMakeCompressor () const =0
 Makes a new Compressor object of the same concrete class. More...
 
const std::type_info & GetType () const
 Gets the type information of the actual class. More...
 

Detailed Description

Interfrace of data compression and decompression.

Constructor & Destructor Documentation

◆ ~Compressor()

virtual tkrzw::Compressor::~Compressor ( )
virtualdefault

Destructor.

Member Function Documentation

◆ IsSupported()

virtual bool tkrzw::Compressor::IsSupported ( ) const
pure virtual

Checks whether the implementation is actually supported.

Returns
True if the implementation is actually supported.

Implemented in tkrzw::AESCompressor, tkrzw::RC4Compressor, tkrzw::LZMACompressor, tkrzw::LZ4Compressor, tkrzw::ZStdCompressor, tkrzw::ZLibCompressor, and tkrzw::DummyCompressor.

◆ Compress()

virtual char* tkrzw::Compressor::Compress ( const void *  buf,
size_t  size,
size_t *  sp 
) const
pure virtual

Compresses a serial data.

Parameters
bufthe input buffer.
sizethe size of the input buffer.
spthe pointer to the variable into which the size of the region of the return value is assigned.
Returns
The pointer to the result data, or nullptr on failure.

Because the region of the return value is allocated with the xmalloc function, it should be released with the xfree function.

Implemented in tkrzw::AESCompressor, tkrzw::RC4Compressor, tkrzw::LZMACompressor, tkrzw::LZ4Compressor, tkrzw::ZStdCompressor, tkrzw::ZLibCompressor, and tkrzw::DummyCompressor.

◆ Decompress()

virtual char* tkrzw::Compressor::Decompress ( const void *  buf,
size_t  size,
size_t *  sp 
) const
pure virtual

Decompresses a serial data.

Parameters
bufthe input buffer.
sizethe size of the input buffer.
spthe pointer to the variable into which the size of the region of the return value is assigned.
Returns
The pointer to the result data, or nullptr on failure.

Because the region of the return value is allocated with the xmalloc function, it should be released with the xfree function.

Implemented in tkrzw::AESCompressor, tkrzw::RC4Compressor, tkrzw::LZMACompressor, tkrzw::LZ4Compressor, tkrzw::ZStdCompressor, tkrzw::ZLibCompressor, and tkrzw::DummyCompressor.

◆ MakeCompressor()

virtual std::unique_ptr<Compressor> tkrzw::Compressor::MakeCompressor ( ) const
pure virtual

◆ GetType()

const std::type_info& tkrzw::Compressor::GetType ( ) const

Gets the type information of the actual class.

Returns
The type information of the actual class.