Gzip header-only C++ library
Gzip C++ lib for gzip compression and decompression. Extracted from mapnik-vector-tile for light-weight modularity.
…// Optionally include compression level
std::size_t size; // No default value, but what happens when not passed??
int level = Z_DEFAULT_COMPRESSION; // Z_DEFAULT_COMPRESSION is the default if no arg is passed
std::string compressed_data = gzip::compress(tile->data(), size, level);// No args other than the std:string
std::string data = "hello";
std::string compressed_data = gzip::compress(data);
const char * compressed_pointer = compressed_data.data();
std::string decompressed_data = gzip::decompress(compressed_pointer, compressed_data.size());
# build test binaries
make
# run tests
make testYou can make Release test binaries as well
BUILDTYPE=Release make
BUILDTYPE=Release make testThis library is semantically versioned using the /include/gzip/version.cpp file. This defines a number of macros that can be used to check the current major, minor, or patch versions, as well as the full version string.
Here's how you can check for a particular version to use specific API methods
#if GZIP_VERSION_MAJOR > 2
// use version 2 api
#else
// use older verion apis
#endifHere's how to check the version string
std::cout version: 0.2.0And lastly, mathematically checking for a specific version:
#if GZIP_VERSION_CODE > 20001
// use feature provided in v2.0.1
#endifNo open issues yet, or sync has not completed.