#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2021 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_STORAGE_COMPRESSION_LZIP_LZMADECOMPRESSOR_H #define NUCLEX_STORAGE_COMPRESSION_LZIP_LZMADECOMPRESSOR_H #include "Nuclex/Storage/Config.h" #if defined(NUCLEX_STORAGE_HAVE_LZIP) #include "Nuclex/Storage/Compression/Decompressor.h" #ifndef NUCLEX_STORAGE_COMPRESSION_LZIP_LZLIB_H #define NUCLEX_STORAGE_COMPRESSION_LZIP_LZLIB_H #include #include #endif namespace Nuclex { namespace Storage { namespace Compression { namespace LZip { // ------------------------------------------------------------------------------------------- // /// /// Decompresses data using the LZip implementation of the LZMA algorithm /// class LzmaDecompressor : public Decompressor { /// Initializes a new LZMA decompressor public: LzmaDecompressor(); /// Frees all resources owned by the instance public: ~LzmaDecompressor() override; /// /// Decompresses the data in the input buffer and writes it to the output buffer /// /// Buffer containing the compressed data /// /// Number of compressed bytes in the compressed buffer. Will be set to /// the number of remaining bytes when the method returns /// /// Buffer in which the uncompressed data will be stored /// /// Available space in the output buffer. Will be set to the bytes actually stored /// in the output buffer when the method returns /// /// /// The reason why the method stopped processing data. This may either be because /// all available input was decompressed, or because the decompressor ran out of /// space in the output buffer. /// public: StopReason Process( const std::uint8_t *compressedBuffer, std::size_t &compressedByteCount, std::uint8_t *outputBuffer, std::size_t &outputByteCount ) override; /// Finishes decompressing and writes any remaining output bytes /// Buffer in which the decompressed data will be stored /// /// Available space in the output buffer. Will be set to the bytes actually stored /// in the output buffer when the method returns. /// /// /// The reason why the method stopped processing. This should normally be the /// value but may also be /// if the output buffer was insufficient /// to output all data (in which case you need to call Finish() another time). /// public: StopReason Finish( std::uint8_t *outputBuffer, std::size_t &outputByteCount ) override; /// Maintains the LZMA decoder's state private: ::LZ_Decoder *decoder; /// Whether we still suspect data in the decoder's output buffer private: bool decoderStillHoldsOutputData; }; // ------------------------------------------------------------------------------------------- // }}}} // namespace Nuclex::Storage::Compression::LZip #endif // defined(NUCLEX_STORAGE_HAVE_LZIP) #endif // NUCLEX_STORAGE_COMPRESSION_LZIP_LZMADECOMPRESSOR_H