aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-02-08 21:46:50 +0000
committerMax Horn2010-02-08 21:46:50 +0000
commitb3da11ba8afc3925de551ae7cc51ccc73e721211 (patch)
treeebe258d2c5e72783ada95e727bce23bc32cc815c
parent4e86741d9ae9eb468d7b352dc6d17482d394fa1f (diff)
downloadscummvm-rg350-b3da11ba8afc3925de551ae7cc51ccc73e721211.tar.gz
scummvm-rg350-b3da11ba8afc3925de551ae7cc51ccc73e721211.tar.bz2
scummvm-rg350-b3da11ba8afc3925de551ae7cc51ccc73e721211.zip
Introduce factory function makeArjArchive, hide ArjArchive class implementation
svn-id: r48009
-rw-r--r--common/unarj.cpp24
-rw-r--r--common/unarj.h26
-rw-r--r--engines/drascula/resource.cpp2
3 files changed, 30 insertions, 22 deletions
diff --git a/common/unarj.cpp b/common/unarj.cpp
index 57f55f2c1e..895b0928b3 100644
--- a/common/unarj.cpp
+++ b/common/unarj.cpp
@@ -712,6 +712,26 @@ void ArjDecoder::decode_f(int32 origsize) {
#pragma mark ArjArchive implementation
+typedef HashMap<String, int, IgnoreCase_Hash, IgnoreCase_EqualTo> ArjFilesMap;
+
+class ArjArchive : public Common::Archive {
+
+ Common::Array<ArjHeader *> _headers;
+ ArjFilesMap _fileMap;
+
+ Common::String _arjFilename;
+
+public:
+ ArjArchive(const String &name);
+ virtual ~ArjArchive();
+
+ // Common::Archive implementation
+ virtual bool hasFile(const String &name);
+ virtual int listMembers(ArchiveMemberList &list);
+ virtual ArchiveMemberPtr getMember(const String &name);
+ virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
+};
+
ArjArchive::ArjArchive(const String &filename) : _arjFilename(filename) {
Common::File arjFile;
@@ -813,4 +833,8 @@ SeekableReadStream *ArjArchive::createReadStreamForMember(const String &name) co
return new Common::MemoryReadStream(uncompressedData, hdr->origSize, DisposeAfterUse::YES);
}
+Archive *makeArjArchive(const String &name) {
+ return new ArjArchive(name);
+}
+
} // End of namespace Common
diff --git a/common/unarj.h b/common/unarj.h
index f44828baca..831c8aeb90 100644
--- a/common/unarj.h
+++ b/common/unarj.h
@@ -32,27 +32,11 @@
namespace Common {
-struct ArjHeader;
-
-typedef HashMap<String, int, IgnoreCase_Hash, IgnoreCase_EqualTo> ArjFilesMap;
-
-class ArjArchive : public Common::Archive {
-
- Common::Array<ArjHeader *> _headers;
- ArjFilesMap _fileMap;
-
- Common::String _arjFilename;
-
-public:
- ArjArchive(const String &name);
- virtual ~ArjArchive();
-
- // Common::Archive implementation
- virtual bool hasFile(const String &name);
- virtual int listMembers(ArchiveMemberList &list);
- virtual ArchiveMemberPtr getMember(const String &name);
- virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
-};
+/**
+ * This factory method creates an Archive instance corresponding to the content
+ * of the ARJ compressed file with the given name.
+ */
+Archive *makeArjArchive(const String &name);
} // End of namespace Common
diff --git a/engines/drascula/resource.cpp b/engines/drascula/resource.cpp
index cfa8ab9af3..b26c4605fb 100644
--- a/engines/drascula/resource.cpp
+++ b/engines/drascula/resource.cpp
@@ -35,7 +35,7 @@ ArchiveMan::~ArchiveMan() {
}
void ArchiveMan::registerArchive(const Common::String &filename) {
- add(filename, new Common::ArjArchive(filename));
+ add(filename, Common::makeArjArchive(filename));
}
Common::SeekableReadStream *ArchiveMan::open(const Common::String &filename) {