RPNX Compress is a portable C++20 compression library with STL-style iterator algorithms, deterministic encoders, bounded decompression, and validated ZIP archive handling.
| Format | Compression | Decompression | Concatenated members |
|---|---|---|---|
| Raw DEFLATE | Yes | Yes | Optional |
| zlib | Yes | Yes | Optional |
| gzip | Yes | Yes | Optional |
| bzip2 | Yes | Yes | Optional |
| xz/LZMA2 | Yes | Yes | Optional |
| Zstandard | Yes | Yes | Optional |
| LZ4 frame | Yes | Yes | Optional |
| ZIP32 archives | Yes | Yes | Not applicable |
ZIP supports stored and DEFLATE members, including validated data descriptors. ZIP64, encryption, and multi-disk archives are rejected explicitly rather than processed partially. The xz decoder supports the common single LZMA2 filter chain; optional BCJ and delta filter chains are rejected. Zstandard and LZ4 frames that require an external dictionary are likewise rejected because this API has no dictionary parameter.
For fixed input, options, and library version, each encoder produces byte-identical output. gzip timestamps and ZIP timestamps and host metadata are normalized. Applications requiring reproducible artifacts across build environments should pin the RPNX Compress version as part of their build workspace.
Input ranges may contain std::byte or one-byte integral values. Output iterators may accept std::byte or std::uint8_t. Both algorithms return the advanced output iterator. decompression_options::maximum_output_size limits the number of bytes written by decompression.
Compile-time format selection instantiates header-native codec paths directly. Runtime-format iterator overloads remain available when the format is selected dynamically.
Consumers that prefer shorter compile times can use the compiled overloads:
Both allocating and caller-owned span forms are non-template functions. The compiled functions adapt their spans to the iterator algorithms; they do not provide a second codec implementation. The caller-owned form reports error_code::insufficient_output_space when its destination is exhausted.
ZIP uses the corresponding create_zip and extract_zip iterator algorithms from <rpnx/compression/zip.hpp>. Extracted paths are validated as relative, forward-slash-separated archive paths; absolute paths, drive paths, backslashes, and .. components are rejected.
The codec implementations consume single-pass input iterators and write each completed byte through the supplied output iterator. They do not materialize a complete source or result. Storage retained by an algorithm is bounded or required by its transform: DEFLATE history and match-search blocks, LZ4 and Zstandard blocks and histories, bzip2 BWT blocks, and xz LZMA2 chunks and dictionaries. ZIP creation retains only central-directory metadata. ZIP extraction materializes the archive because the trailing central directory points backward to member headers.
Raw DEFLATE, zlib, gzip, bzip2, xz/LZMA2, Zstandard, LZ4 frame, CRC-32, Adler-32, XXH32, XXH64, and ZIP are self-contained. The library contains no vendored third-party codec sources and links no system compression packages. Third-party implementations may be used externally for interoperability verification only. CMake never downloads dependencies. The installed package exports the target RPNX::compression.
The development workspace is intentionally separate from the source tree:
The workspace selects C++20; the root CMake project does not set a global C++ standard or compiler flags. A consuming CMake project can link the build-tree or installed package as follows: