ScummVM API documentation
file-manager.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 HDB_FILE_MANAGER_H
23#define HDB_FILE_MANAGER_H
24
25namespace Common {
26 class File;
27}
28
29#define MPCIterator Common::Array<MPCEntry *>::iterator
30
31namespace HDB {
32
33// Each entry in a MSD file is of the following types
34
35enum DataType {
36 TYPE_ERROR,
37 TYPE_BINARY,
38 TYPE_TILE32,
39 TYPE_FONT,
40 TYPE_ICON32,
41 TYPE_PIC,
42
43 ENDOFTYPES
44};
45
46struct MPCEntry {
47 char filename[64]; // filename
48 int32 offset; // offset in MSD file of data
49 int32 length; // compressed length of data
50 int32 ulength; // uncompressed length
51 DataType type; // type of data
52};
53
54class FileMan {
55private:
56
57 Common::File *_mpcFile;
59
60public:
61
62 FileMan();
63 ~FileMan();
64
65 struct {
66 uint32 id;
67 uint32 dirSize;
68 } _dataHeader;
69
70 void openMPC(const Common::Path &filename);
71 void closeMPC();
72 void seek(int32 offset, int flag);
73
74 Common::SeekableReadStream *findFirstData(const char *string, DataType type, int *length = nullptr);
75 int32 getLength(const char *string, DataType type);
76 int getCount(const char *subString, DataType type);
77 Common::Array<const char *> *findFiles(const char *string, DataType type);
78
79};
80
81} // End of Namespace HDB
82
83#endif // !HDB_FILE_MANAGER_H
Definition: array.h:52
Definition: file.h:47
Definition: path.h:52
Definition: stream.h:745
Definition: file-manager.h:54
Definition: algorithm.h:29
Definition: file-manager.h:46