ScummVM API documentation
archive.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_ARCHIVE_H
23 #define ULTIMA8_FILESYS_ARCHIVE_H
24 
25 namespace Ultima {
26 namespace Ultima8 {
27 
28 class FlexFile;
29 
30 class Archive {
31 public:
33  Archive();
34 
37  explicit Archive(Common::SeekableReadStream *rs);
38 
39  virtual ~Archive();
40 
45  bool addSource(FlexFile *af);
46 
49 
51  void cache();
52 
54  virtual void cache(uint32 index) = 0;
55 
59  void uncache();
60 
63  virtual void uncache(uint32 index) = 0;
64 
66  virtual bool isCached(uint32 index) const = 0;
67 
68  uint32 getCount() const {
69  return _count;
70  }
71 
72 protected:
73  uint32 _count;
74 
75  uint8 *getRawObject(uint32 index, uint32 *sizep = 0);
76  uint32 getRawSize(uint32 index) const;
77 
78 private:
79  Std::vector<FlexFile *> _sources;
80 
81  FlexFile *findArchiveFile(uint32 index) const;
82 };
83 
84 } // End of namespace Ultima8
85 } // End of namespace Ultima
86 
87 #endif
void cache()
Cache all objects.
Definition: flex_file.h:28
Definition: stream.h:745
Archive()
create Archive without any input sources
Definition: detection.h:27
Definition: archive.h:30
bool addSource(FlexFile *af)
virtual bool isCached(uint32 index) const =0
Check if an object is cached.
Definition: containers.h:38