[Scummvm-cvs-logs] SF.net SVN: scummvm:[48009] scummvm/trunk
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Mon Feb 8 22:46:50 CET 2010
Revision: 48009
http://scummvm.svn.sourceforge.net/scummvm/?rev=48009&view=rev
Author: fingolfin
Date: 2010-02-08 21:46:50 +0000 (Mon, 08 Feb 2010)
Log Message:
-----------
Introduce factory function makeArjArchive, hide ArjArchive class implementation
Modified Paths:
--------------
scummvm/trunk/common/unarj.cpp
scummvm/trunk/common/unarj.h
scummvm/trunk/engines/drascula/resource.cpp
Modified: scummvm/trunk/common/unarj.cpp
===================================================================
--- scummvm/trunk/common/unarj.cpp 2010-02-08 21:25:10 UTC (rev 48008)
+++ scummvm/trunk/common/unarj.cpp 2010-02-08 21:46:50 UTC (rev 48009)
@@ -712,6 +712,26 @@
#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 @@
return new Common::MemoryReadStream(uncompressedData, hdr->origSize, DisposeAfterUse::YES);
}
+Archive *makeArjArchive(const String &name) {
+ return new ArjArchive(name);
+}
+
} // End of namespace Common
Modified: scummvm/trunk/common/unarj.h
===================================================================
--- scummvm/trunk/common/unarj.h 2010-02-08 21:25:10 UTC (rev 48008)
+++ scummvm/trunk/common/unarj.h 2010-02-08 21:46:50 UTC (rev 48009)
@@ -32,28 +32,12 @@
namespace Common {
-struct ArjHeader;
+/**
+ * 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);
-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;
-};
-
} // End of namespace Common
#endif
Modified: scummvm/trunk/engines/drascula/resource.cpp
===================================================================
--- scummvm/trunk/engines/drascula/resource.cpp 2010-02-08 21:25:10 UTC (rev 48008)
+++ scummvm/trunk/engines/drascula/resource.cpp 2010-02-08 21:46:50 UTC (rev 48009)
@@ -35,7 +35,7 @@
}
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) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list