ScummVM API documentation
flex_file.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 ULTIMA8_FILESYS_FLEXFILE_H
23#define ULTIMA8_FILESYS_FLEXFILE_H
24
25namespace Ultima {
26namespace Ultima8 {
27
28class FlexFile {
29public:
33 ~FlexFile();
34
36 bool isValid() const {
37 return _valid;
38 }
39
42 bool exists(uint32 index) {
43 return getSize(index) > 0;
44 }
45
48 Common::SeekableReadStream *getDataSource(uint32 index, bool is_text = false);
49
55 uint8 *getObject(uint32 index, uint32 *size = nullptr);
56
60 uint32 getSize(uint32 index) const;
61
65 uint32 getCount() const {
66 return _entries.size();
67 }
68
69 static bool isFlexFile(Common::SeekableReadStream *rs);
70
71protected:
73 bool _valid;
74
75 struct FileEntry {
76 uint32 _offset;
77 uint32 _size;
78 FileEntry() : _offset(0), _size(0) {}
79 };
80
82
83private:
84 bool readMetadata();
85};
86
87} // End of namespace Ultima8
88} // End of namespace Ultima
89
90#endif
size_type size() const
Definition: array.h:316
Definition: stream.h:745
Definition: flex_file.h:28
bool exists(uint32 index)
Definition: flex_file.h:42
bool isValid() const
Check if constructed object is indeed a valid archive.
Definition: flex_file.h:36
FlexFile(Common::SeekableReadStream *rs)
uint32 getCount() const
Definition: flex_file.h:65
uint8 * getObject(uint32 index, uint32 *size=nullptr)
uint32 getSize(uint32 index) const
Common::SeekableReadStream * getDataSource(uint32 index, bool is_text=false)
Definition: flex_file.h:75