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_MPS_INSTALLER_H
23 #define MADS_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 
34 public:
35  bool hasFile(const Common::Path &path) const override;
36  int listMembers(Common::ArchiveMemberList &) const override;
37  const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
38  Common::SharedArchiveContents readContentsForPath(const Common::Path &translatedPath) const override;
39 
40  static MpsInstaller* open(const Common::Path &baseName);
41 
42 private:
43  // Similar to FileDescriptionBin but in native-endian and native strings.
44  class FileDescriptor {
45  public:
46  // Public for hashmap
47  FileDescriptor() : _compressedSize(0),
48  _uncompressedSize(),
49  _compressionAlgo(0),
50  _offsetInVolume(0),
51  _volumeNumber(0) {}
52  protected:
53  FileDescriptor(const Common::Path &name,
54  uint16 compression,
55  uint16 volumeNumber,
56  uint32 offsetInVolume,
57  uint32 compressedSize,
58  uint32 uncompressedSize) :
59  _fileName(name),
60  _compressionAlgo(compression),
61  _volumeNumber(volumeNumber),
62  _offsetInVolume(offsetInVolume),
63  _compressedSize(compressedSize),
64  _uncompressedSize(uncompressedSize) {}
65 
66  Common::Path _fileName;
67  uint _compressionAlgo;
68  uint _volumeNumber;
69  uint32 _offsetInVolume;
70  uint32 _compressedSize;
71  uint32 _uncompressedSize;
72 
73  friend class MpsInstaller;
74  };
75 
77 
78  MpsInstaller(const FileMap& files,
79  const Common::Path& baseName) : _files(files), _baseName(baseName) {}
80 
81  FileMap _files;
82  Common::Path _baseName;
83 };
84 }
85 
86 #endif
Definition: list.h:44
Definition: mps_installer.h:33
Definition: path.h:52
bool hasFile(const Common::Path &path) const override
int listMembers(Common::ArchiveMemberList &) const override
Definition: action.h:28
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override
Definition: archive.h:224