ScummVM API documentation
hufflists.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 /*
23  * Based on
24  * WebVenture (c) 2010, Sean Kasun
25  * https://github.com/mrkite/webventure, http://seancode.com/webventure/
26  *
27  * Used with explicit permission from the author
28  */
29 
30 #ifndef MACVENTURE_HUFFLIST_H
31 #define MACVENTURE_HUFFLIST_H
32 
33 namespace MacVenture {
34 
35 // The engine uses a <= comparison instead of ==, so I can't use Common::Huffman
36 class HuffmanLists {
37 public:
38  HuffmanLists() {
39  _numEntries = 0;
40  }
41  HuffmanLists(uint32 num, uint32 *lens, uint32 *masks, uint32 *symbols) {
42  _numEntries = num;
43  _lens = Common::Array<uint32>(lens, num);
44  _masks = Common::Array<uint32>(masks, num);
45  _symbols = Common::Array<uint32>(symbols, num);
46  }
47  ~HuffmanLists() {}
48 
49 
50  uint32 getNumEntries() const { return _numEntries; }
51  uint32 getLength(uint32 index) const { return _lens[index]; }
52  uint32 getMask(uint32 index) const { return _masks[index]; }
53  uint32 getSymbol(uint32 index) const { return _symbols[index]; }
54 
55 private:
56  uint32 _numEntries;
58  Common::Array<uint32> _masks;
59  Common::Array<uint32> _symbols;
60 };
61 
62 } // End of namespace MacVenture
63 
64 #endif
Definition: hufflists.h:36
Definition: container.h:38