crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
crawlservpp::Data::Compression::Zlib Namespace Reference

Namespace for compressing and decompressing zlib. More...

Classes

class  Exception
 Class for zlib exceptions. More...
 

Compression and Decompression

std::string compress (const std::string &content)
 Compresses content using zlib. More...
 
std::string decompress (const std::string &compressedContent)
 Decompresses zlib-compressed content. More...
 

Constant

constexpr auto bufferSize {65536}
 The maximum buffer size for zlib compression and decompression. More...
 

Detailed Description

Namespace for compressing and decompressing zlib.

Function Documentation

◆ compress()

std::string crawlservpp::Data::Compression::Zlib::compress ( const std::string &  content)
inline

Compresses content using zlib.

Note
The string will be compressed via copying it into a string stream, therefore a string view is not feasible.
Parameters
contentA const reference to the content to be compressed.
Returns
The zlib-compressed content as copied string or an empty string if the given content is empty.
Exceptions
Zlib::Exceptionif zlib compression could not be initialized or an error occured while compressing the given content using zlib.

Referenced by crawlservpp::Main::Server::tick().

◆ decompress()

std::string crawlservpp::Data::Compression::Zlib::decompress ( const std::string &  compressedContent)
inline

Decompresses zlib-compressed content.

Note
The string will be decompressed via copying it into a string stream, therefore a string view is not feasible.
Parameters
compressedContentA const reference to the zlib-compressed content to be decompressed.
Returns
The decompressed content as copied string or an empty string if the given content is empty.
Exceptions
Zlib::Exceptionif zlib decompression could not be initialized or an error occured while decompressing the given zlib-compressed content.

Referenced by crawlservpp::Main::Server::tick().

Variable Documentation

◆ bufferSize

constexpr auto crawlservpp::Data::Compression::Zlib::bufferSize {65536}
inline

The maximum buffer size for zlib compression and decompression.