aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMax Horn2010-02-08 21:46:50 +0000
committerMax Horn2010-02-08 21:46:50 +0000
commitb3da11ba8afc3925de551ae7cc51ccc73e721211 (patch)
treeebe258d2c5e72783ada95e727bce23bc32cc815c /common
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
Diffstat (limited to 'common')
-rw-r--r--common/unarj.cpp24
-rw-r--r--common/unarj.h26
2 files changed, 29 insertions, 21 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