ScummVM API documentation
mps_installer.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 MADS_NEBULAR_MPS_INSTALLER_H
23 #define MADS_NEBULAR_MPS_INSTALLER_H
24 
25 #include "common/archive.h"
26 #include "common/ptr.h"
27 #include "common/stream.h"
28 #include "common/hashmap.h"
29 #include "common/hash-str.h"
30 
31 namespace MADS {
32 namespace RexNebular {
33 
35 public:
36  bool hasFile(const Common::Path &path) const override;
37  int listMembers(Common::ArchiveMemberList &) const override;
38  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
39  Common::SharedArchiveContents readContentsForPath(const Common::Path &translatedPath) const override;
40 
41  static MpsInstaller *open(const Common::Path &baseName);
42 
43 private:
44  // Similar to FileDescriptionBin but in native-endian and native strings.
45  class FileDescriptor {
46  public:
47  // Public for hashmap
48  FileDescriptor() : _compressedSize(0),
49  _uncompressedSize(),
50  _compressionAlgo(0),
51  _offsetInVolume(0),
52  _volumeNumber(0) {
53  }
54  protected:
55  FileDescriptor(const Common::Path &name,
56  uint16 compression,
57  uint16 volumeNumber,
58  uint32 offsetInVolume,
59  uint32 compressedSize,
60  uint32 uncompressedSize) :
61  _fileName(name),
62  _compressionAlgo(compression),
63  _volumeNumber(volumeNumber),
64  _offsetInVolume(offsetInVolume),
65  _compressedSize(compressedSize),
66  _uncompressedSize(uncompressedSize) {
67  }
68 
69  Common::Path _fileName;
70  uint _compressionAlgo;
71  uint _volumeNumber;
72  uint32 _offsetInVolume;
73  uint32 _compressedSize;
74  uint32 _uncompressedSize;
75 
76  friend class MpsInstaller;
77  };
78 
80 
81  MpsInstaller(const FileMap &files,
82  const Common::Path &baseName) : _files(files), _baseName(baseName) {
83  }
84 
85  FileMap _files;
86  Common::Path _baseName;
87 };
88 
89 } // namespace RexNebular
90 } // namespace MADS
91 
92 #endif
int listMembers(Common::ArchiveMemberList &) const override
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
Definition: list.h:44
Definition: path.h:52
bool hasFile(const Common::Path &path) const override
Definition: anim_timer.h:27
Definition: mps_installer.h:34
Definition: archive.h:242