![]() |
Gorgon Game Engine
|
This class allows encoding and decoding data using LZMA compression algorithm. More...
Public Types | |
| typedef std::function< void(float)> | ProgressNotification |
| Callback to notify progress. The value is reported between 0 and 1. More... | |
Public Member Functions | |
| LZMA (bool useuncompressedsize=true) | |
| Default constructor. More... | |
| template<class I_ , class O_ > | |
| void | Decode (I_ &input, O_ &output, Byte *compressionproperties=nullptr, unsigned long long fsize=(unsigned long long)(long long) -1) |
| Decodes LZMA compressed data. More... | |
| template<class I_ , class O_ > | |
| void | Decode (I_ &input, O_ &output, LZMA::ProgressNotification notifier, Byte *compressionproperties=nullptr, unsigned long long fsize=(unsigned long long)(long long) -1) |
| Decodes LZMA compressed data. More... | |
| template<class I_ , class O_ > | |
| void | Encode (I_ &input, O_ &output) |
| Encodes the given data to LZMA compressed data. More... | |
| template<class I_ , class O_ > | |
| void | Encode (I_ &input, O_ &output, ProgressNotification notifier) |
| Encodes the given data to LZMA compressed data. More... | |
| int | PropertySize () |
| The size of the compression property data appended in front of the compressed data. More... | |
Public Attributes | |
| bool | UseUncompressedSize |
| Whether to encode uncompressed size with the compression properties. Default value for this variable is true. More... | |
Protected Member Functions | |
| void | decode (lzma::Reader *reader, lzma::Writer *writer, unsigned long long size, std::function< void(lzma::Reader *, long long)> seekfn, Byte *cprops, unsigned long long fsize, ProgressNotification *notifier) |
| Performs actual decompression, notifier and cprops can be nullptr. More... | |
| void | encode (lzma::Reader *reader, lzma::Writer *writer, unsigned long long size, ProgressNotification *notifier) |
| Performs actual compression, notifier can be nullptr. More... | |
This class allows encoding and decoding data using LZMA compression algorithm.
| typedef std::function<void(float)> ProgressNotification |
Callback to notify progress. The value is reported between 0 and 1.
| LZMA | ( | bool | useuncompressedsize = true | ) |
Default constructor.
| void Decode | ( | I_ & | input, |
| O_ & | output, | ||
| Byte * | compressionproperties = nullptr, |
||
| unsigned long long | fsize = (unsigned long long)(long long)-1 |
||
| ) |
Decodes LZMA compressed data.
Supports vectors, arrays, strings and streams as data source and targets.
| input | Input data |
| output | Output data |
| compressionproperties | is the compression property data. Leaving this parameter with default nullptr, causes this function to read the actual compression properties from the main data source. |
| fsize | size of the extracted data. This value is only used if UseUncompressedSize is false. Default value of -1 relies on LZMA to terminate extraction. |
| runtime_error |
References LZMA::decode().
| void Decode | ( | I_ & | input, |
| O_ & | output, | ||
| LZMA::ProgressNotification | notifier, | ||
| Byte * | compressionproperties = nullptr, |
||
| unsigned long long | fsize = (unsigned long long)(long long)-1 |
||
| ) |
Decodes LZMA compressed data.
Supports vectors, arrays, strings and streams as data source and targets. This variant allows a notification function which is called during decompression.
| input | Input data |
| output | Output data |
| notifier | is the callback to send notifications to |
| compressionproperties | is the compression property data. Leaving this parameter with default nullptr, causes this function to read the actual compression properties from the main data source. |
| fsize | size of the extracted data. This value is only used if UseUncompressedSize is false. Default value of -1 relies on LZMA to terminate extraction. Additionally, -1 will cause progress notification to report 0. |
| runtime_error |
References LZMA::decode().
|
protected |
Performs actual decompression, notifier and cprops can be nullptr.
References LZMA::UseUncompressedSize.
| void Encode | ( | I_ & | input, |
| O_ & | output | ||
| ) |
Encodes the given data to LZMA compressed data.
Supports vectors, arrays, strings and streams as data source and targets.
| runtime_error |
References LZMA::encode().
| void Encode | ( | I_ & | input, |
| O_ & | output, | ||
| ProgressNotification | notifier | ||
| ) |
Encodes the given data to LZMA compressed data.
Supports vectors, arrays, strings and streams as data source and targets. This variant allows a notification function which is called during compression.
| runtime_error |
References LZMA::encode().
|
protected |
Performs actual compression, notifier can be nullptr.
References LZMA::UseUncompressedSize.
| int PropertySize | ( | ) |
The size of the compression property data appended in front of the compressed data.
References LZMA::UseUncompressedSize.
| bool UseUncompressedSize |
Whether to encode uncompressed size with the compression properties. Default value for this variable is true.