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 #include "common/scummsys.h"
26 #include "ultima/shared/std/containers.h"
27 
28 namespace Common {
29  class SeekableReadStream;
30 }
31 
32 namespace Ultima {
33 namespace Ultima8 {
34 
35 class FlexFile;
36 
37 class Archive {
38 public:
40  Archive();
41 
44  explicit Archive(Common::SeekableReadStream *rs);
45 
46  virtual ~Archive();
47 
52  bool addSource(FlexFile *af);
53 
55  bool addSource(Common::SeekableReadStream *rs);
56 
58  void cache();
59 
61  virtual void cache(uint32 index) = 0;
62 
66  void uncache();
67 
70  virtual void uncache(uint32 index) = 0;
71 
73  virtual bool isCached(uint32 index) const = 0;
74 
75  uint32 getCount() const {
76  return _count;
77  }
78 
79 protected:
80  uint32 _count;
81 
82  uint8 *getRawObject(uint32 index, uint32 *sizep = 0);
83  uint32 getRawSize(uint32 index) const;
84 
85 private:
86  Std::vector<FlexFile *> _sources;
87 
88  FlexFile *findArchiveFile(uint32 index) const;
89 };
90 
91 } // End of namespace Ultima8
92 } // End of namespace Ultima
93 
94 #endif
Definition: flex_file.h:28
Definition: stream.h:745
Definition: detection.h:27
Definition: archive.h:37
Definition: algorithm.h:29
Definition: containers.h:38