GREM 3.12.0
Game/Rendering Engine Modules for C++
Loading...
Searching...
No Matches
grem::deflate Namespace Reference

Classes

struct  CompressionOptions
 Deflate compression options. More...
struct  DecompressionOptions
 Deflate decompression options. More...

Functions

void compress (Writer writer, Span< const byte > data, const CompressionOptions &options={})
 Compress arbitrary data into a deflate-compressed data set.
Buffer< byte > compress (Span< const byte > data, const CompressionOptions &options={})
 Compress arbitrary data into a deflate-compressed data set.
void decompress (Buffer< byte > &output, SpanReader reader, const DecompressionOptions &options={})
 Decompress the original data from a deflate-compressed data set.
Buffer< byte > decompress (SpanReader reader, const DecompressionOptions &options={})
 Decompress the original data from a deflate-compressed data set.
void decompress (Buffer< byte > &output, Span< const byte > &&compressedData, const DecompressionOptions &options={})
 Decompress the original data from a deflate-compressed data set.
Buffer< byte > decompress (Span< const byte > &&compressedData, const DecompressionOptions &options={})
 Decompress the original data from a deflate-compressed data set.

Function Documentation

◆ compress() [1/2]

void grem::deflate::compress ( Writer writer,
Span< const byte > data,
const CompressionOptions & options = {} )

Compress arbitrary data into a deflate-compressed data set.

Parameters
writerwriter to write the compressed data to.
datainput data to compress.
optionscompression options, see CompressionOptions.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.
anyexception thrown by the writer implementation.

◆ compress() [2/2]

Buffer< byte > grem::deflate::compress ( Span< const byte > data,
const CompressionOptions & options = {} )
nodiscard

Compress arbitrary data into a deflate-compressed data set.

Parameters
datainput data to compress.
optionscompression options, see CompressionOptions.
Returns
a buffer containing the deflate-compressed data set.
Exceptions
std::length_errorif an internal size limit was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ decompress() [1/4]

void grem::deflate::decompress ( Buffer< byte > & output,
SpanReader reader,
const DecompressionOptions & options = {} )

Decompress the original data from a deflate-compressed data set.

Parameters
outputbuffer to write the data decompressed from the deflate-compressed data set to.
readerreader over the deflate-compressed data set to decompress. After successful decompression, the reader's next read position will be the next full byte after the compressed data.
optionsdeompression options, see DecompressionOptions.
Exceptions
std::invalid_argumentif the read data is not a valid deflate-compressed data set.
std::length_errorif an internal size limit was exceeded, if the end of the reader was reached unexpectedly, or if the specified maximum decompressed size was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ decompress() [2/4]

Buffer< byte > grem::deflate::decompress ( SpanReader reader,
const DecompressionOptions & options = {} )
inlinenodiscard

Decompress the original data from a deflate-compressed data set.

Parameters
readerreader over the deflate-compressed data set to decompress. After successful decompression, the reader's next read position will be the next full byte after the compressed data.
optionsdeompression options, see DecompressionOptions.
Returns
a buffer containing the data decompressed from the deflate-compressed data set.
Exceptions
std::invalid_argumentif the read data is not a valid deflate-compressed data set.
std::length_errorif an internal size limit was exceeded, if the end of the reader was reached unexpectedly, or if the specified maximum decompressed size was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ decompress() [3/4]

void grem::deflate::decompress ( Buffer< byte > & output,
Span< const byte > && compressedData,
const DecompressionOptions & options = {} )
inline

Decompress the original data from a deflate-compressed data set.

Parameters
outputbuffer to write the data decompressed from the deflate-compressed data set to.
compressedDatadeflate-compressed data set to decompress.
optionsdecompression options, see DecompressionOptions.
Exceptions
std::invalid_argumentif the given data is not a valid deflate-compressed data set, or contains data after the end of the compressed data set.
std::length_errorif an internal size limit was exceeded, if the end of the compressed data was reached unexpectedly, or if the specified maximum decompressed size was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.

◆ decompress() [4/4]

Buffer< byte > grem::deflate::decompress ( Span< const byte > && compressedData,
const DecompressionOptions & options = {} )
inlinenodiscard

Decompress the original data from a deflate-compressed data set.

Parameters
compressedDatadeflate-compressed data set to decompress.
optionsdecompression options, see DecompressionOptions.
Returns
a buffer containing the data decompressed from the deflate-compressed data set.
Exceptions
std::invalid_argumentif the given data is not a valid deflate-compressed data set, or contains data after the end of the compressed data set.
std::length_errorif an internal size limit was exceeded, if the end of the compressed data was reached unexpectedly, or if the specified maximum decompressed size was exceeded.
std::bad_array_new_lengthif an internal size limit was exceeded.
std::bad_allocon allocation failure.