D++ (DPP)
C++ Discord API Bot Library
|
This is an opaque class containing zlib library specific structures. This wraps the C pointers needed for zlib with unique_ptr and gives us a nice buffer abstraction so we don't need to wrestle with raw pointers. More...
#include <zlibcontext.h>
Public Member Functions | |
zlibcontext () | |
Initialise zlib struct via inflateInit() and size the buffer. More... | |
~zlibcontext () | |
Destroy zlib struct via inflateEnd() More... | |
exception_error_code | decompress (const std::string &buffer, std::string &decompressed) |
Decompress zlib deflated buffer. More... | |
Public Attributes | |
z_stream * | d_stream {} |
Zlib stream struct. The actual type is defined in zlib.h so is only defined in the implementation file. More... | |
std::vector< unsigned char > | decomp_buffer {} |
ZLib decompression buffer. This is automatically set to DECOMP_BUFFER_SIZE bytes when the class is constructed. More... | |
uint64_t | decompressed_total {} |
Total decompressed received bytes counter. More... | |
This is an opaque class containing zlib library specific structures. This wraps the C pointers needed for zlib with unique_ptr and gives us a nice buffer abstraction so we don't need to wrestle with raw pointers.
dpp::zlibcontext::zlibcontext | ( | ) |
Initialise zlib struct via inflateInit() and size the buffer.
dpp::zlibcontext::~zlibcontext | ( | ) |
Destroy zlib struct via inflateEnd()
exception_error_code dpp::zlibcontext::decompress | ( | const std::string & | buffer, |
std::string & | decompressed | ||
) |
Decompress zlib deflated buffer.
buffer | input compressed stream |
decompressed | output decompressed content |
z_stream* dpp::zlibcontext::d_stream {} |
Zlib stream struct. The actual type is defined in zlib.h so is only defined in the implementation file.
std::vector<unsigned char> dpp::zlibcontext::decomp_buffer {} |
ZLib decompression buffer. This is automatically set to DECOMP_BUFFER_SIZE bytes when the class is constructed.
uint64_t dpp::zlibcontext::decompressed_total {} |
Total decompressed received bytes counter.