compat.gzip-hpp
#includegzip-hpp — header-only gzip/deflate compression wrappers over zlib
#include <gzip/compress.hpp>
mcpp add compat.gzip-hpp@0.1.0
Usage
From this repository's own test project — built and run by CI, not written for the website.
// Behavioral test — compat.gzip-hpp compresses and decompresses through zlib.
//
// Round-trip alone would pass on a library that did nothing, so the test also
// asserts the gzip MAGIC on the compressed bytes and that a compressible
// payload actually shrinks. Both are answers only real deflate can give.
//
// It is also the link-time proof for the package's zlib dependency: every
// function called here bottoms out in `deflate`/`inflate`.
#include <gzip/compress.hpp>
#include <gzip/decompress.hpp>
#include <gzip/utils.hpp>
#include <cstdio>
#include <string>
int main() {
std::string original;
for (int i = 0; i < 200; ++i) original += "mcpp-index gzip round trip ";
const std::string compressed = gzip::compress(original.data(), original.size());
if (!gzip::is_compressed(compressed.data(), compressed.size())) {
// …
tests/examples/gzip-hpp/tests/roundtrip.cpp · project tests/examples/gzip-hpp
openkal
| target | result | environment | test project | first diagnostic |
|---|---|---|---|---|
| x86_64-linux-gnu | runs | posix | gzip-hpp | |
| x86_64-windows-musl | runs | posix | gzip-hpp |
How this was measured
Measured 2026-09-23 by tests/openkal/compat.py with openkal-llvm-runtime 0.15.1, llvm@22.1.8, mcpp 2026.9.21.3. The test project selects no platform dependency of its own. The badge above is a summary of the strictest measured target -- the table above states each target's own environment.
Build
- targets
gzip_hpp (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
mcpp_generated, */include
Sources (1)
mcpp_generated/gzip_hpp_anchor.c
Generated files
mcpp_generated/gzip/utils.hppmcpp_generated/gzip/config.hppmcpp_generated/gzip_hpp_anchor.c