aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Corna2011-12-13 17:20:25 +0100
committerJohannes Schickel2011-12-13 17:55:57 +0100
commita6ec4f70da120a1ce406ed4dd9e149e081542f59 (patch)
tree36d09611f523974f570318e6e579b89b30e886a9
parent77959acd51982d9fedec94ac07241b1702681c6a (diff)
downloadscummvm-rg350-a6ec4f70da120a1ce406ed4dd9e149e081542f59.tar.gz
scummvm-rg350-a6ec4f70da120a1ce406ed4dd9e149e081542f59.tar.bz2
scummvm-rg350-a6ec4f70da120a1ce406ed4dd9e149e081542f59.zip
COMMON: Make more members of Archive constant.
-rw-r--r--common/archive.cpp22
-rw-r--r--common/archive.h22
-rw-r--r--common/fs.cpp12
-rw-r--r--common/fs.h8
-rw-r--r--common/unarj.cpp14
-rw-r--r--common/unzip.cpp12
-rw-r--r--engines/agos/installshield_cab.cpp12
-rw-r--r--engines/kyra/resource_intern.cpp18
-rw-r--r--engines/kyra/resource_intern.h18
-rw-r--r--engines/lastexpress/data/archive.cpp6
-rw-r--r--engines/lastexpress/data/archive.h6
-rw-r--r--engines/lastexpress/resource.cpp10
-rw-r--r--engines/lastexpress/resource.h6
-rw-r--r--engines/mohawk/installer_archive.cpp6
-rw-r--r--engines/mohawk/installer_archive.h6
-rw-r--r--engines/parallaction/disk_ns.cpp14
16 files changed, 96 insertions, 96 deletions
diff --git a/common/archive.cpp b/common/archive.cpp
index 954de8bcaa..1323f14805 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -27,7 +27,7 @@
namespace Common {
-GenericArchiveMember::GenericArchiveMember(String name, Archive *parent)
+GenericArchiveMember::GenericArchiveMember(const String &name, const Archive *parent)
: _parent(parent), _name(name) {
}
@@ -40,14 +40,14 @@ SeekableReadStream *GenericArchiveMember::createReadStream() const {
}
-int Archive::listMatchingMembers(ArchiveMemberList &list, const String &pattern) {
+int Archive::listMatchingMembers(ArchiveMemberList &list, const String &pattern) const {
// Get all "names" (TODO: "files" ?)
ArchiveMemberList allNames;
listMembers(allNames);
int matches = 0;
- ArchiveMemberList::iterator it = allNames.begin();
+ ArchiveMemberList::const_iterator it = allNames.begin();
for ( ; it != allNames.end(); ++it) {
// TODO: We match case-insenstivie for now, our API does not define whether that's ok or not though...
// For our use case case-insensitive is probably what we want to have though.
@@ -206,11 +206,11 @@ void SearchSet::setPriority(const String &name, int priority) {
insert(node);
}
-bool SearchSet::hasFile(const String &name) {
+bool SearchSet::hasFile(const String &name) const {
if (name.empty())
return false;
- ArchiveNodeList::iterator it = _list.begin();
+ ArchiveNodeList::const_iterator it = _list.begin();
for ( ; it != _list.end(); ++it) {
if (it->_arc->hasFile(name))
return true;
@@ -219,31 +219,31 @@ bool SearchSet::hasFile(const String &name) {
return false;
}
-int SearchSet::listMatchingMembers(ArchiveMemberList &list, const String &pattern) {
+int SearchSet::listMatchingMembers(ArchiveMemberList &list, const String &pattern) const {
int matches = 0;
- ArchiveNodeList::iterator it = _list.begin();
+ ArchiveNodeList::const_iterator it = _list.begin();
for ( ; it != _list.end(); ++it)
matches += it->_arc->listMatchingMembers(list, pattern);
return matches;
}
-int SearchSet::listMembers(ArchiveMemberList &list) {
+int SearchSet::listMembers(ArchiveMemberList &list) const {
int matches = 0;
- ArchiveNodeList::iterator it = _list.begin();
+ ArchiveNodeList::const_iterator it = _list.begin();
for ( ; it != _list.end(); ++it)
matches += it->_arc->listMembers(list);
return matches;
}
-ArchiveMemberPtr SearchSet::getMember(const String &name) {
+const ArchiveMemberPtr SearchSet::getMember(const String &name) const {
if (name.empty())
return ArchiveMemberPtr();
- ArchiveNodeList::iterator it = _list.begin();
+ ArchiveNodeList::const_iterator it = _list.begin();
for ( ; it != _list.end(); ++it) {
if (it->_arc->hasFile(name))
return it->_arc->getMember(name);
diff --git a/common/archive.h b/common/archive.h
index c8e78f9bc8..ffd86d786d 100644
--- a/common/archive.h
+++ b/common/archive.h
@@ -65,10 +65,10 @@ class Archive;
* is destroyed.
*/
class GenericArchiveMember : public ArchiveMember {
- Archive *_parent;
- String _name;
+ const Archive *_parent;
+ const String _name;
public:
- GenericArchiveMember(String name, Archive *parent);
+ GenericArchiveMember(const String &name, const Archive *parent);
String getName() const;
SeekableReadStream *createReadStream() const;
};
@@ -88,7 +88,7 @@ public:
* Patterns are not allowed, as this is meant to be a quick File::exists()
* replacement.
*/
- virtual bool hasFile(const String &name) = 0;
+ virtual bool hasFile(const String &name) const = 0;
/**
* Add all members of the Archive matching the specified pattern to list.
@@ -96,7 +96,7 @@ public:
*
* @return the number of members added to list
*/
- virtual int listMatchingMembers(ArchiveMemberList &list, const String &pattern);
+ virtual int listMatchingMembers(ArchiveMemberList &list, const String &pattern) const;
/**
* Add all members of the Archive to list.
@@ -104,12 +104,12 @@ public:
*
* @return the number of names added to list
*/
- virtual int listMembers(ArchiveMemberList &list) = 0;
+ virtual int listMembers(ArchiveMemberList &list) const = 0;
/**
* Returns a ArchiveMember representation of the given file.
*/
- virtual ArchiveMemberPtr getMember(const String &name) = 0;
+ virtual const ArchiveMemberPtr getMember(const String &name) const = 0;
/**
* Create a stream bound to a member with the specified name in the
@@ -230,11 +230,11 @@ public:
*/
void setPriority(const String& name, int priority);
- virtual bool hasFile(const String &name);
- virtual int listMatchingMembers(ArchiveMemberList &list, const String &pattern);
- virtual int listMembers(ArchiveMemberList &list);
+ virtual bool hasFile(const String &name) const;
+ virtual int listMatchingMembers(ArchiveMemberList &list, const String &pattern) const;
+ virtual int listMembers(ArchiveMemberList &list) const;
- virtual ArchiveMemberPtr getMember(const String &name);
+ virtual const ArchiveMemberPtr getMember(const String &name) const;
/**
* Implements createReadStreamForMember from Archive base class. The current policy is
diff --git a/common/fs.cpp b/common/fs.cpp
index 4b56cc4594..8ea96e458a 100644
--- a/common/fs.cpp
+++ b/common/fs.cpp
@@ -197,7 +197,7 @@ FSNode *FSDirectory::lookupCache(NodeCache &cache, const String &name) const {
return 0;
}
-bool FSDirectory::hasFile(const String &name) {
+bool FSDirectory::hasFile(const String &name) const {
if (name.empty() || !_node.isDirectory())
return false;
@@ -205,7 +205,7 @@ bool FSDirectory::hasFile(const String &name) {
return node && node->exists();
}
-ArchiveMemberPtr FSDirectory::getMember(const String &name) {
+const ArchiveMemberPtr FSDirectory::getMember(const String &name) const {
if (name.empty() || !_node.isDirectory())
return ArchiveMemberPtr();
@@ -295,7 +295,7 @@ void FSDirectory::ensureCached() const {
_cached = true;
}
-int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &pattern) {
+int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &pattern) const {
if (!_node.isDirectory())
return 0;
@@ -308,7 +308,7 @@ int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &patt
lowercasePattern.toLowercase();
int matches = 0;
- NodeCache::iterator it = _fileCache.begin();
+ NodeCache::const_iterator it = _fileCache.begin();
for ( ; it != _fileCache.end(); ++it) {
if (it->_key.matchString(lowercasePattern, false, true)) {
list.push_back(ArchiveMemberPtr(new FSNode(it->_value)));
@@ -318,7 +318,7 @@ int FSDirectory::listMatchingMembers(ArchiveMemberList &list, const String &patt
return matches;
}
-int FSDirectory::listMembers(ArchiveMemberList &list) {
+int FSDirectory::listMembers(ArchiveMemberList &list) const {
if (!_node.isDirectory())
return 0;
@@ -326,7 +326,7 @@ int FSDirectory::listMembers(ArchiveMemberList &list) {
ensureCached();
int files = 0;
- for (NodeCache::iterator it = _fileCache.begin(); it != _fileCache.end(); ++it) {
+ for (NodeCache::const_iterator it = _fileCache.begin(); it != _fileCache.end(); ++it) {
list.push_back(ArchiveMemberPtr(new FSNode(it->_value)));
++files;
}
diff --git a/common/fs.h b/common/fs.h
index aeaa14718e..fadd672bb1 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -318,23 +318,23 @@ public:
* Checks for existence in the cache. A full match of relative path and filename is needed
* for success.
*/
- virtual bool hasFile(const String &name);
+ virtual bool hasFile(const String &name) const;
/**
* Returns a list of matching file names. Pattern can use GLOB wildcards.
*/
- virtual int listMatchingMembers(ArchiveMemberList &list, const String &pattern);
+ virtual int listMatchingMembers(ArchiveMemberList &list, const String &pattern) const;
/**
* Returns a list of all the files in the cache.
*/
- virtual int listMembers(ArchiveMemberList &list);
+ virtual int listMembers(ArchiveMemberList &list) const;
/**
* Get a ArchiveMember representation of the specified file. A full match of relative
* path and filename is needed for success.
*/
- virtual ArchiveMemberPtr getMember(const String &name);
+ virtual const ArchiveMemberPtr getMember(const String &name) const;
/**
* Open the specified file. A full match of relative path and filename is needed
diff --git a/common/unarj.cpp b/common/unarj.cpp
index cccc330bb5..fe3c17a2ac 100644
--- a/common/unarj.cpp
+++ b/common/unarj.cpp
@@ -701,9 +701,9 @@ public:
virtual ~ArjArchive();
// Archive implementation
- virtual bool hasFile(const String &name);
- virtual int listMembers(ArchiveMemberList &list);
- virtual ArchiveMemberPtr getMember(const String &name);
+ virtual bool hasFile(const String &name) const;
+ virtual int listMembers(ArchiveMemberList &list) const;
+ virtual const ArchiveMemberPtr getMember(const String &name) const;
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
};
@@ -745,14 +745,14 @@ ArjArchive::~ArjArchive() {
}
}
-bool ArjArchive::hasFile(const String &name) {
+bool ArjArchive::hasFile(const String &name) const {
return _headers.contains(name);
}
-int ArjArchive::listMembers(ArchiveMemberList &list) {
+int ArjArchive::listMembers(ArchiveMemberList &list) const {
int matches = 0;
- ArjHeadersMap::iterator it = _headers.begin();
+ ArjHeadersMap::const_iterator it = _headers.begin();
for ( ; it != _headers.end(); ++it) {
list.push_back(ArchiveMemberList::value_type(new GenericArchiveMember(it->_value->filename, this)));
matches++;
@@ -761,7 +761,7 @@ int ArjArchive::listMembers(ArchiveMemberList &list) {
return matches;
}
-ArchiveMemberPtr ArjArchive::getMember(const String &name) {
+const ArchiveMemberPtr ArjArchive::getMember(const String &name) const {
if (!hasFile(name))
return ArchiveMemberPtr();
diff --git a/common/unzip.cpp b/common/unzip.cpp
index 8650c91866..8061f712d4 100644
--- a/common/unzip.cpp
+++ b/common/unzip.cpp
@@ -1426,9 +1426,9 @@ public:
~ZipArchive();
- virtual bool hasFile(const String &name);
- virtual int listMembers(ArchiveMemberList &list);
- virtual ArchiveMemberPtr getMember(const String &name);
+ virtual bool hasFile(const String &name) const;
+ virtual int listMembers(ArchiveMemberList &list) const;
+ virtual const ArchiveMemberPtr getMember(const String &name) const;
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
};
@@ -1458,11 +1458,11 @@ ZipArchive::~ZipArchive() {
unzClose(_zipFile);
}
-bool ZipArchive::hasFile(const String &name) {
+bool ZipArchive::hasFile(const String &name) const {
return (unzLocateFile(_zipFile, name.c_str(), 2) == UNZ_OK);
}
-int ZipArchive::listMembers(ArchiveMemberList &list) {
+int ZipArchive::listMembers(ArchiveMemberList &list) const {
int matches = 0;
int err = unzGoToFirstFile(_zipFile);
@@ -1481,7 +1481,7 @@ int ZipArchive::listMembers(ArchiveMemberList &list) {
return matches;
}
-ArchiveMemberPtr ZipArchive::getMember(const String &name) {
+const ArchiveMemberPtr ZipArchive::getMember(const String &name) const {
if (!hasFile(name))
return ArchiveMemberPtr();
diff --git a/engines/agos/installshield_cab.cpp b/engines/agos/installshield_cab.cpp
index ac4e40d1d1..d4e636f7b3 100644
--- a/engines/agos/installshield_cab.cpp
+++ b/engines/agos/installshield_cab.cpp
@@ -60,9 +60,9 @@ public:
~InstallShieldCabinet();
// Common::Archive API implementation
- bool hasFile(const Common::String &name);
- int listMembers(Common::ArchiveMemberList &list);
- Common::ArchiveMemberPtr getMember(const Common::String &name);
+ bool hasFile(const Common::String &name) const;
+ int listMembers(Common::ArchiveMemberList &list) const;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
private:
@@ -161,18 +161,18 @@ InstallShieldCabinet::InstallShieldCabinet(const Common::String &filename) : _in
delete[] fileTableOffsets;
}
-bool InstallShieldCabinet::hasFile(const Common::String &name) {
+bool InstallShieldCabinet::hasFile(const Common::String &name) const {
return _map.contains(name);
}
-int InstallShieldCabinet::listMembers(Common::ArchiveMemberList &list) {
+int InstallShieldCabinet::listMembers(Common::ArchiveMemberList &list) const {
for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++)
list.push_back(getMember(it->_key));
return _map.size();
}
-Common::ArchiveMemberPtr InstallShieldCabinet::getMember(const Common::String &name) {
+const Common::ArchiveMemberPtr InstallShieldCabinet::getMember(const Common::String &name) const {
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
}
diff --git a/engines/kyra/resource_intern.cpp b/engines/kyra/resource_intern.cpp
index 482bd1a5d6..f9aae2c550 100644
--- a/engines/kyra/resource_intern.cpp
+++ b/engines/kyra/resource_intern.cpp
@@ -37,11 +37,11 @@ PlainArchive::PlainArchive(Common::ArchiveMemberPtr file)
: _file(file), _files() {
}
-bool PlainArchive::hasFile(const Common::String &name) {
+bool PlainArchive::hasFile(const Common::String &name) const {
return (_files.find(name) != _files.end());
}
-int PlainArchive::listMembers(Common::ArchiveMemberList &list) {
+int PlainArchive::listMembers(Common::ArchiveMemberList &list) const {
int count = 0;
for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) {
@@ -52,7 +52,7 @@ int PlainArchive::listMembers(Common::ArchiveMemberList &list) {
return count;
}
-Common::ArchiveMemberPtr PlainArchive::getMember(const Common::String &name) {
+const Common::ArchiveMemberPtr PlainArchive::getMember(const Common::String &name) const {
if (!hasFile(name))
return Common::ArchiveMemberPtr();
@@ -92,11 +92,11 @@ TlkArchive::~TlkArchive() {
delete[] _fileEntries;
}
-bool TlkArchive::hasFile(const Common::String &name) {
+bool TlkArchive::hasFile(const Common::String &name) const {
return (findFile(name) != 0);
}
-int TlkArchive::listMembers(Common::ArchiveMemberList &list) {
+int TlkArchive::listMembers(Common::ArchiveMemberList &list) const {
uint count = 0;
for (; count < _entryCount; ++count) {
@@ -107,7 +107,7 @@ int TlkArchive::listMembers(Common::ArchiveMemberList &list) {
return count;
}
-Common::ArchiveMemberPtr TlkArchive::getMember(const Common::String &name) {
+const Common::ArchiveMemberPtr TlkArchive::getMember(const Common::String &name) const {
if (!hasFile(name))
return Common::ArchiveMemberPtr();
@@ -186,11 +186,11 @@ CachedArchive::~CachedArchive() {
_files.clear();
}
-bool CachedArchive::hasFile(const Common::String &name) {
+bool CachedArchive::hasFile(const Common::String &name) const {
return (_files.find(name) != _files.end());
}
-int CachedArchive::listMembers(Common::ArchiveMemberList &list) {
+int CachedArchive::listMembers(Common::ArchiveMemberList &list) const {
int count = 0;
for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) {
@@ -201,7 +201,7 @@ int CachedArchive::listMembers(Common::ArchiveMemberList &list) {
return count;
}
-Common::ArchiveMemberPtr CachedArchive::getMember(const Common::String &name) {
+const Common::ArchiveMemberPtr CachedArchive::getMember(const Common::String &name) const {
if (!hasFile(name))
return Common::ArchiveMemberPtr();
diff --git a/engines/kyra/resource_intern.h b/engines/kyra/resource_intern.h
index 03c9d871e8..9d9574d823 100644
--- a/engines/kyra/resource_intern.h
+++ b/engines/kyra/resource_intern.h
@@ -49,9 +49,9 @@ public:
Entry getFileEntry(const Common::String &name) const;
// Common::Archive API implementation
- bool hasFile(const Common::String &name);
- int listMembers(Common::ArchiveMemberList &list);
- Common::ArchiveMemberPtr getMember(const Common::String &name);
+ bool hasFile(const Common::String &name) const;
+ int listMembers(Common::ArchiveMemberList &list) const;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
private:
typedef Common::HashMap<Common::String, Entry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap;
@@ -65,9 +65,9 @@ public:
TlkArchive(Common::ArchiveMemberPtr file, uint16 entryCount, const uint32 *fileEntries);
~TlkArchive();
- bool hasFile(const Common::String &name);
- int listMembers(Common::ArchiveMemberList &list);
- Common::ArchiveMemberPtr getMember(const Common::String &name);
+ bool hasFile(const Common::String &name) const;
+ int listMembers(Common::ArchiveMemberList &list) const;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
private:
Common::ArchiveMemberPtr _file;
@@ -92,9 +92,9 @@ public:
CachedArchive(const FileInputList &files);
~CachedArchive();
- bool hasFile(const Common::String &name);
- int listMembers(Common::ArchiveMemberList &list);
- Common::ArchiveMemberPtr getMember(const Common::String &name);
+ bool hasFile(const Common::String &name) const;
+ int listMembers(Common::ArchiveMemberList &list) const;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
private:
struct Entry {
diff --git a/engines/lastexpress/data/archive.cpp b/engines/lastexpress/data/archive.cpp
index 3aa5584ca4..908d58254a 100644
--- a/engines/lastexpress/data/archive.cpp
+++ b/engines/lastexpress/data/archive.cpp
@@ -74,11 +74,11 @@ HPFArchive::HPFArchive(const Common::String &path) {
delete archive;
}
-bool HPFArchive::hasFile(const Common::String &name) {
+bool HPFArchive::hasFile(const Common::String &name) const {
return (_files.find(name) != _files.end());
}
-int HPFArchive::listMembers(Common::ArchiveMemberList &list) {
+int HPFArchive::listMembers(Common::ArchiveMemberList &list) const {
int numMembers = 0;
for (FileMap::const_iterator i = _files.begin(); i != _files.end(); ++i) {
@@ -89,7 +89,7 @@ int HPFArchive::listMembers(Common::ArchiveMemberList &list) {
return numMembers;
}
-Common::ArchiveMemberPtr HPFArchive::getMember(const Common::String &name) {
+const Common::ArchiveMemberPtr HPFArchive::getMember(const Common::String &name) const {
if (!hasFile(name))
return Common::ArchiveMemberPtr();
diff --git a/engines/lastexpress/data/archive.h b/engines/lastexpress/data/archive.h
index 8e0c46f183..011c830668 100644
--- a/engines/lastexpress/data/archive.h
+++ b/engines/lastexpress/data/archive.h
@@ -46,9 +46,9 @@ class HPFArchive : public Common::Archive {
public:
HPFArchive(const Common::String &path);
- bool hasFile(const Common::String &name);
- int listMembers(Common::ArchiveMemberList &list);
- Common::ArchiveMemberPtr getMember(const Common::String &name);
+ bool hasFile(const Common::String &name) const;
+ int listMembers(Common::ArchiveMemberList &list) const;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
int count() { return _files.size(); }
diff --git a/engines/lastexpress/resource.cpp b/engines/lastexpress/resource.cpp
index 3910aaa010..ee4885e34e 100644
--- a/engines/lastexpress/resource.cpp
+++ b/engines/lastexpress/resource.cpp
@@ -148,8 +148,8 @@ Common::SeekableReadStream *ResourceManager::getFileStream(const Common::String
//////////////////////////////////////////////////////////////////////////
// Archive functions
//////////////////////////////////////////////////////////////////////////
-bool ResourceManager::hasFile(const Common::String &name) {
- for (Common::Array<HPFArchive *>::iterator it = _archives.begin(); it != _archives.end(); ++it) {
+bool ResourceManager::hasFile(const Common::String &name) const {
+ for (Common::Array<HPFArchive *>::const_iterator it = _archives.begin(); it != _archives.end(); ++it) {
if ((*it)->hasFile(name))
return true;
}
@@ -157,10 +157,10 @@ bool ResourceManager::hasFile(const Common::String &name) {
return false;
}
-int ResourceManager::listMembers(Common::ArchiveMemberList &list) {
+int ResourceManager::listMembers(Common::ArchiveMemberList &list) const {
int count = 0;
- for (Common::Array<HPFArchive *>::iterator it = _archives.begin(); it != _archives.end(); ++it) {
+ for (Common::Array<HPFArchive *>::const_iterator it = _archives.begin(); it != _archives.end(); ++it) {
Common::ArchiveMemberList members;
count += (*it)->listMembers(members);
@@ -171,7 +171,7 @@ int ResourceManager::listMembers(Common::ArchiveMemberList &list) {
return count;
}
-Common::ArchiveMemberPtr ResourceManager::getMember(const Common::String &name) {
+const Common::ArchiveMemberPtr ResourceManager::getMember(const Common::String &name) const {
if (!hasFile(name))
return Common::ArchiveMemberPtr();
diff --git a/engines/lastexpress/resource.h b/engines/lastexpress/resource.h
index 9e05a90399..f2f5d63bce 100644
--- a/engines/lastexpress/resource.h
+++ b/engines/lastexpress/resource.h
@@ -45,9 +45,9 @@ public:
Common::SeekableReadStream *getFileStream(const Common::String &name);
// Archive functions
- bool hasFile(const Common::String &name);
- int listMembers(Common::ArchiveMemberList &list);
- Common::ArchiveMemberPtr getMember(const Common::String &name);
+ bool hasFile(const Common::String &name) const;
+ int listMembers(Common::ArchiveMemberList &list) const;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
// Resource loading
diff --git a/engines/mohawk/installer_archive.cpp b/engines/mohawk/installer_archive.cpp
index 83796158a6..636b7ae476 100644
--- a/engines/mohawk/installer_archive.cpp
+++ b/engines/mohawk/installer_archive.cpp
@@ -107,18 +107,18 @@ void InstallerArchive::close() {
_map.clear();
}
-bool InstallerArchive::hasFile(const Common::String &name) {
+bool InstallerArchive::hasFile(const Common::String &name) const {
return _map.contains(name);
}
-int InstallerArchive::listMembers(Common::ArchiveMemberList &list) {
+int InstallerArchive::listMembers(Common::ArchiveMemberList &list) const {
for (FileMap::const_iterator it = _map.begin(); it != _map.end(); it++)
list.push_back(getMember(it->_key));
return _map.size();
}
-Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::String &name) {
+const Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::String &name) const {
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
}
diff --git a/engines/mohawk/installer_archive.h b/engines/mohawk/installer_archive.h
index 27877d69f9..89d2d85f8d 100644
--- a/engines/mohawk/installer_archive.h
+++ b/engines/mohawk/installer_archive.h
@@ -43,9 +43,9 @@ public:
bool isOpen() const { return _stream != 0; }
// Common::Archive API implementation
- bool hasFile(const Common::String &name);
- int listMembers(Common::ArchiveMemberList &list);
- Common::ArchiveMemberPtr getMember(const Common::String &name);
+ bool hasFile(const Common::String &name) const;
+ int listMembers(Common::ArchiveMemberList &list) const;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
private:
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index 05ea60f510..e145743f09 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -73,9 +73,9 @@ public:
~NSArchive();
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
- bool hasFile(const Common::String &name);
- int listMembers(Common::ArchiveMemberList &list);
- Common::ArchiveMemberPtr getMember(const Common::String &name);
+ bool hasFile(const Common::String &name) const;
+ int listMembers(Common::ArchiveMemberList &list) const;
+ const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
};
@@ -137,23 +137,23 @@ Common::SeekableReadStream *NSArchive::createReadStreamForMember(const Common::S
return new Common::SeekableSubReadStream(_stream, offset, endOffset, DisposeAfterUse::NO);
}
-bool NSArchive::hasFile(const Common::String &name) {
+bool NSArchive::hasFile(const Common::String &name) const {
if (name.empty())
return false;
return lookup(name.c_str()) != _numFiles;
}
-int NSArchive::listMembers(Common::ArchiveMemberList &list) {
+int NSArchive::listMembers(Common::ArchiveMemberList &list) const {
for (uint32 i = 0; i < _numFiles; i++) {
list.push_back(Common::SharedPtr<Common::GenericArchiveMember>(new Common::GenericArchiveMember(_archiveDir[i], this)));
}
return _numFiles;
}
-Common::ArchiveMemberPtr NSArchive::getMember(const Common::String &name) {
+const Common::ArchiveMemberPtr NSArchive::getMember(const Common::String &name) const {
uint32 index = lookup(name.c_str());
- char *item = 0;
+ const char *item = 0;
if (index < _numFiles) {
item = _archiveDir[index];
}