ScummVM API documentation
rnca_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 DREAMWEB_RNCA_ARCHIVE_H
23#define DREAMWEB_RNCA_ARCHIVE_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
31namespace DreamWeb {
33public:
34 bool hasFile(const Common::Path &path) const override;
36 const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
37 Common::SharedArchiveContents readContentsForPath(const Common::Path &translated) const override;
38
39 static RNCAArchive* open(Common::SeekableReadStream *stream, DisposeAfterUse::Flag dispose = DisposeAfterUse::NO);
40
41private:
42 class RNCAFileDescriptor {
43 private:
44 Common::String _fileName;
45
46 // Offset of the file contents relative to the beginning of RNCA stream
47 uint32 _fileDataOffset;
48
49 RNCAFileDescriptor(const Common::String& filename, uint32 off) : _fileName(filename), _fileDataOffset(off) {}
50 friend class RNCAArchive;
51 public:
52 // It's public for hashmap
53 RNCAFileDescriptor() : _fileDataOffset(0) {}
54 };
55
57
58 RNCAArchive(FileMap files, Common::SeekableReadStream *stream, DisposeAfterUse::Flag dispose)
59 : _files(files), _stream(stream, dispose) {
60 }
61
62 FileMap _files;
64};
65}
66#endif
Definition: list.h:44
Definition: path.h:52
Definition: stream.h:745
Definition: archive.h:242
Definition: str.h:59
Definition: rnca_archive.h:32
int listMembers(Common::ArchiveMemberList &) const override
bool hasFile(const Common::Path &path) const override
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override