1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
3 | #pragma once |
4 | |
5 | #include "Prerequisites/BsPrerequisitesUtil.h" |
6 | |
7 | namespace bs |
8 | { |
9 | /** @addtogroup General |
10 | * @{ |
11 | */ |
12 | |
13 | /** Performs generic compression and decompression on raw data. */ |
14 | class BS_UTILITY_EXPORT Compression |
15 | { |
16 | public: |
17 | /** |
18 | * Compresses the data from the provided data stream and outputs the new stream with compressed data. Accepts |
19 | * an optional callback to be triggered during the process to report progress in range [0, 1]. |
20 | */ |
21 | static SPtr<MemoryDataStream> compress(SPtr<DataStream>& input, |
22 | std::function<void(float)> reportProgress = nullptr); |
23 | |
24 | /** |
25 | * Decompresses the data from the provided data stream and outputs the new stream with decompressed data. Accepts |
26 | * an optional callback to be triggered during the process to report progress in range [0, 1]. |
27 | */ |
28 | static SPtr<MemoryDataStream> decompress(SPtr<DataStream>& input, |
29 | std::function<void(float)> reportProgress = nullptr); |
30 | }; |
31 | |
32 | /** @} */ |
33 | } |