ScummVM API documentation
decompress.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef NANCY_DECOMPRESS_H
23 #define NANCY_DECOMPRESS_H
24 
25 #include "common/scummsys.h"
26 
27 namespace Common {
28 class ReadStream;
29 class WriteStream;
30 class MemoryWriteStream;
31 }
32 
33 namespace Nancy {
34 
35 class Decompressor {
36 public:
37  Decompressor();
38  ~Decompressor();
39 
40  // Decompresses data from input until the end of the stream
41  // The output stream must have the right size for the decompressed data
42  bool decompress(Common::SeekableReadStream &input, Common::MemoryWriteStream &output);
43 
44 private:
45  enum {
46  kBufSize = 4096,
47  kBufStart = 4078
48  };
49 
50  void init(Common::SeekableReadStream &input, Common::WriteStream &output);
51  bool readByte(byte &b);
52  bool writeByte(byte b);
53 
54  byte _buf[kBufSize];
55  uint _bufpos;
56  bool _err;
57  byte _val;
58  Common::WriteStream *_output;
59 
60  byte *_input;
61  byte *_pos;
62  byte *_end;
63 };
64 
65 } // End of namespace Nancy
66 
67 #endif // NANCY_DECOMPRESS_H
Definition: stream.h:77
Definition: stream.h:745
Definition: algorithm.h:29
Definition: decompress.h:35
Definition: memstream.h:120
Definition: actionmanager.h:32