xoreos  0.0.5
deflate.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef COMMON_DEFLATE_H
26 #define COMMON_DEFLATE_H
27 
28 #include "src/common/types.h"
29 
30 namespace Common {
31 
32 /* TODO (should be need it):
33  * - Compression
34  * - Decompress dynamically, without needing to know the size
35  * of the decompressed data beforehand
36  */
37 
38 class ReadStream;
39 class SeekableReadStream;
40 
41 static const int kWindowBitsMax = 15;
42 static const int kWindowBitsMaxRaw = -kWindowBitsMax;
43 
57 byte *decompressDeflate(const byte *data, size_t inputSize,
58  size_t outputSize, int windowBits);
59 
71 byte *decompressDeflateWithoutOutputSize(const byte *data, size_t inputSize, size_t &outputSize,
72  int windowBits, unsigned int frameSize = 4096);
73 
87 SeekableReadStream *decompressDeflate(ReadStream &input, size_t inputSize,
88  size_t outputSize, int windowBits);
89 
101  int windowBits, unsigned int frameSize = 4096);
102 
117 size_t decompressDeflateChunk(SeekableReadStream &input, int windowBits, byte *output, size_t outputSize,
118  unsigned int frameSize = 4096);
119 
120 } // End of namespace Common
121 
122 #endif // COMMON_DEFLATE_H
Generic interface for a readable data stream.
Definition: readstream.h:64
Definition: 2dafile.h:39
byte * decompressDeflate(const byte *data, size_t inputSize, size_t outputSize, int windowBits)
Decompress (inflate) using zlib&#39;s DEFLATE algorithm.
Definition: deflate.cpp:63
size_t decompressDeflateChunk(SeekableReadStream &input, int windowBits, byte *output, size_t outputSize, unsigned int frameSize)
Decompress (inflate) using zlib&#39;s DEFLATE algorithm, until a stream end marker was reached...
Definition: deflate.cpp:154
static const int kWindowBitsMaxRaw
Definition: deflate.h:42
Low-level type definitions to handle fixed width types portably.
byte * decompressDeflateWithoutOutputSize(const byte *data, size_t inputSize, size_t &outputSize, int windowBits, unsigned int frameSize)
Decompress (inflate) using zlib&#39;s DEFLATE algorithm without knowing the output size.
Definition: deflate.cpp:96
static const int kWindowBitsMax
Definition: deflate.h:41
Interface for a seekable & readable data stream.
Definition: readstream.h:265
uint8 byte
Definition: types.h:209