mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 19:54:03 +00:00
ALL: Use Path type in Archive functions
This commit is contained in:
parent
0db0b2c201
commit
7eb4841065
@ -115,7 +115,8 @@ AndroidAssetArchive::AndroidAssetArchive(jobject am) : _hasCached(false) {
|
||||
AndroidAssetArchive::~AndroidAssetArchive() {
|
||||
}
|
||||
|
||||
bool AndroidAssetArchive::hasFile(const Common::String &name) const {
|
||||
bool AndroidAssetArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
AAsset *asset = AAssetManager_open(_am, name.c_str(), AASSET_MODE_RANDOM);
|
||||
bool exists = false;
|
||||
if (asset != NULL) {
|
||||
@ -156,15 +157,17 @@ int AndroidAssetArchive::listMembers(Common::ArchiveMemberList &member_list) con
|
||||
return count;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr AndroidAssetArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr AndroidAssetArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *AndroidAssetArchive::createReadStreamForMember(const Common::String &path) const {
|
||||
if (!hasFile(path)) {
|
||||
Common::SeekableReadStream *AndroidAssetArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name)) {
|
||||
return nullptr;
|
||||
}
|
||||
return new AssetInputStream(_am, path);
|
||||
return new AssetInputStream(_am, name);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -39,10 +39,10 @@ public:
|
||||
AndroidAssetArchive(jobject am);
|
||||
virtual ~AndroidAssetArchive();
|
||||
|
||||
virtual bool hasFile(const Common::String &name) const override;
|
||||
virtual bool hasFile(const Common::Path &path) const override;
|
||||
virtual int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
virtual const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
virtual Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
AAssetManager *_am;
|
||||
|
@ -325,10 +325,10 @@ class Win32ResourceArchive final : public Common::Archive {
|
||||
public:
|
||||
Win32ResourceArchive();
|
||||
|
||||
virtual bool hasFile(const Common::String &name) const override;
|
||||
virtual bool hasFile(const Common::Path &path) const override;
|
||||
virtual int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
virtual const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
virtual Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
private:
|
||||
typedef Common::List<Common::String> FilenameList;
|
||||
|
||||
@ -349,7 +349,8 @@ Win32ResourceArchive::Win32ResourceArchive() {
|
||||
EnumResourceNames(NULL, MAKEINTRESOURCE(256), &EnumResNameProc, (LONG_PTR)this);
|
||||
}
|
||||
|
||||
bool Win32ResourceArchive::hasFile(const Common::String &name) const {
|
||||
bool Win32ResourceArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (FilenameList::const_iterator i = _files.begin(); i != _files.end(); ++i) {
|
||||
if (i->equalsIgnoreCase(name))
|
||||
return true;
|
||||
@ -367,12 +368,14 @@ int Win32ResourceArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return count;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr Win32ResourceArchive::getMember(const Common::String &name) const {
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
const Common::ArchiveMemberPtr Win32ResourceArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name.toString(), this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *Win32ResourceArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
TCHAR *tName = Win32::stringToTchar(name);
|
||||
Common::SeekableReadStream *Win32ResourceArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
TCHAR *tName = Win32::stringToTchar(name.toString());
|
||||
HRSRC resource = FindResource(NULL, tName, MAKEINTRESOURCE(256));
|
||||
free(tName);
|
||||
|
||||
|
@ -205,13 +205,13 @@ void SearchSet::setPriority(const String &name, int priority) {
|
||||
insert(node);
|
||||
}
|
||||
|
||||
bool SearchSet::hasFile(const String &name) const {
|
||||
if (name.empty())
|
||||
bool SearchSet::hasFile(const Path &path) const {
|
||||
if (path.empty())
|
||||
return false;
|
||||
|
||||
ArchiveNodeList::const_iterator it = _list.begin();
|
||||
for (; it != _list.end(); ++it) {
|
||||
if (it->_arc->hasFile(name))
|
||||
if (it->_arc->hasFile(path))
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -238,26 +238,26 @@ int SearchSet::listMembers(ArchiveMemberList &list) const {
|
||||
return matches;
|
||||
}
|
||||
|
||||
const ArchiveMemberPtr SearchSet::getMember(const String &name) const {
|
||||
if (name.empty())
|
||||
const ArchiveMemberPtr SearchSet::getMember(const Path &path) const {
|
||||
if (path.empty())
|
||||
return ArchiveMemberPtr();
|
||||
|
||||
ArchiveNodeList::const_iterator it = _list.begin();
|
||||
for (; it != _list.end(); ++it) {
|
||||
if (it->_arc->hasFile(name))
|
||||
return it->_arc->getMember(name);
|
||||
if (it->_arc->hasFile(path))
|
||||
return it->_arc->getMember(path);
|
||||
}
|
||||
|
||||
return ArchiveMemberPtr();
|
||||
}
|
||||
|
||||
SeekableReadStream *SearchSet::createReadStreamForMember(const String &name) const {
|
||||
if (name.empty())
|
||||
SeekableReadStream *SearchSet::createReadStreamForMember(const Path &path) const {
|
||||
if (path.empty())
|
||||
return nullptr;
|
||||
|
||||
ArchiveNodeList::const_iterator it = _list.begin();
|
||||
for (; it != _list.end(); ++it) {
|
||||
SeekableReadStream *stream = it->_arc->createReadStreamForMember(name);
|
||||
SeekableReadStream *stream = it->_arc->createReadStreamForMember(path);
|
||||
if (stream)
|
||||
return stream;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "common/str.h"
|
||||
#include "common/list.h"
|
||||
#include "common/path.h"
|
||||
#include "common/ptr.h"
|
||||
#include "common/singleton.h"
|
||||
|
||||
@ -107,7 +108,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
virtual bool hasFile(const String &name) const = 0;
|
||||
virtual bool hasFile(const Path &path) const = 0;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive matching the specified pattern to the list.
|
||||
@ -128,7 +129,7 @@ public:
|
||||
/**
|
||||
* Return an ArchiveMember representation of the given file.
|
||||
*/
|
||||
virtual const ArchiveMemberPtr getMember(const String &name) const = 0;
|
||||
virtual const ArchiveMemberPtr getMember(const Path &path) const = 0;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
@ -136,7 +137,7 @@ public:
|
||||
*
|
||||
* @return The newly created input stream.
|
||||
*/
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const = 0;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const Path &path) const = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -251,17 +252,17 @@ public:
|
||||
*/
|
||||
void setPriority(const String& name, int priority);
|
||||
|
||||
virtual bool hasFile(const String &name) const;
|
||||
virtual bool hasFile(const Path &path) const;
|
||||
virtual int listMatchingMembers(ArchiveMemberList &list, const String &pattern) const;
|
||||
virtual int listMembers(ArchiveMemberList &list) const;
|
||||
|
||||
virtual const ArchiveMemberPtr getMember(const String &name) const;
|
||||
virtual const ArchiveMemberPtr getMember(const Path &path) const;
|
||||
|
||||
/**
|
||||
* Implement createReadStreamForMember from the Archive base class. The current policy is
|
||||
* opening the first file encountered that matches the name.
|
||||
*/
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const Path &path) const;
|
||||
|
||||
/**
|
||||
* Ignore clashes when adding directories. For more details, see the corresponding parameter
|
||||
|
@ -35,15 +35,16 @@ FSNode::FSNode(AbstractFSNode *realNode)
|
||||
: _realNode(realNode) {
|
||||
}
|
||||
|
||||
FSNode::FSNode(const String &p) {
|
||||
FSNode::FSNode(const Path &p) {
|
||||
assert(g_system);
|
||||
FilesystemFactory *factory = g_system->getFilesystemFactory();
|
||||
AbstractFSNode *tmp = nullptr;
|
||||
String s = p.toString();
|
||||
|
||||
if (p.empty() || p == ".")
|
||||
if (s.empty() || s == ".")
|
||||
tmp = factory->makeCurrentDirectoryFileNode();
|
||||
else
|
||||
tmp = factory->makeFileNodePath(p);
|
||||
tmp = factory->makeFileNodePath(s);
|
||||
_realNode = SharedPtr<AbstractFSNode>(tmp);
|
||||
}
|
||||
|
||||
@ -175,25 +176,25 @@ FSDirectory::FSDirectory(const FSNode &node, int depth, bool flat, bool ignoreCl
|
||||
_includeDirectories(includeDirectories) {
|
||||
}
|
||||
|
||||
FSDirectory::FSDirectory(const String &prefix, const FSNode &node, int depth, bool flat,
|
||||
FSDirectory::FSDirectory(const Path &prefix, const FSNode &node, int depth, bool flat,
|
||||
bool ignoreClashes, bool includeDirectories)
|
||||
: _node(node), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes),
|
||||
_includeDirectories(includeDirectories) {
|
||||
|
||||
setPrefix(prefix);
|
||||
setPrefix(prefix.rawString());
|
||||
}
|
||||
|
||||
FSDirectory::FSDirectory(const String &name, int depth, bool flat, bool ignoreClashes, bool includeDirectories)
|
||||
FSDirectory::FSDirectory(const Path &name, int depth, bool flat, bool ignoreClashes, bool includeDirectories)
|
||||
: _node(name), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes),
|
||||
_includeDirectories(includeDirectories) {
|
||||
}
|
||||
|
||||
FSDirectory::FSDirectory(const String &prefix, const String &name, int depth, bool flat,
|
||||
FSDirectory::FSDirectory(const Path &prefix, const Path &name, int depth, bool flat,
|
||||
bool ignoreClashes, bool includeDirectories)
|
||||
: _node(name), _cached(false), _depth(depth), _flat(flat), _ignoreClashes(ignoreClashes),
|
||||
_includeDirectories(includeDirectories) {
|
||||
|
||||
setPrefix(prefix);
|
||||
setPrefix(prefix.rawString());
|
||||
}
|
||||
|
||||
FSDirectory::~FSDirectory() {
|
||||
@ -202,8 +203,8 @@ FSDirectory::~FSDirectory() {
|
||||
void FSDirectory::setPrefix(const String &prefix) {
|
||||
_prefix = prefix;
|
||||
|
||||
if (!_prefix.empty() && !_prefix.hasSuffix("/"))
|
||||
_prefix += "/";
|
||||
if (!_prefix.empty() && _prefix.lastChar() != DIR_SEPARATOR)
|
||||
_prefix += DIR_SEPARATOR;
|
||||
}
|
||||
|
||||
FSNode FSDirectory::getFSNode() const {
|
||||
@ -222,7 +223,8 @@ FSNode *FSDirectory::lookupCache(NodeCache &cache, const String &name) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool FSDirectory::hasFile(const String &name) const {
|
||||
bool FSDirectory::hasFile(const Path &path) const {
|
||||
String name = path.rawString();
|
||||
if (name.empty() || !_node.isDirectory())
|
||||
return false;
|
||||
|
||||
@ -230,7 +232,8 @@ bool FSDirectory::hasFile(const String &name) const {
|
||||
return node && node->exists();
|
||||
}
|
||||
|
||||
const ArchiveMemberPtr FSDirectory::getMember(const String &name) const {
|
||||
const ArchiveMemberPtr FSDirectory::getMember(const Path &path) const {
|
||||
String name = path.rawString();
|
||||
if (name.empty() || !_node.isDirectory())
|
||||
return ArchiveMemberPtr();
|
||||
|
||||
@ -247,7 +250,8 @@ const ArchiveMemberPtr FSDirectory::getMember(const String &name) const {
|
||||
return ArchiveMemberPtr(new FSNode(*node));
|
||||
}
|
||||
|
||||
SeekableReadStream *FSDirectory::createReadStreamForMember(const String &name) const {
|
||||
SeekableReadStream *FSDirectory::createReadStreamForMember(const Path &path) const {
|
||||
String name = path.rawString();
|
||||
if (name.empty() || !_node.isDirectory())
|
||||
return nullptr;
|
||||
|
||||
@ -261,23 +265,24 @@ SeekableReadStream *FSDirectory::createReadStreamForMember(const String &name) c
|
||||
return stream;
|
||||
}
|
||||
|
||||
FSDirectory *FSDirectory::getSubDirectory(const String &name, int depth, bool flat, bool ignoreClashes) {
|
||||
return getSubDirectory(String(), name, depth, flat, ignoreClashes);
|
||||
FSDirectory *FSDirectory::getSubDirectory(const Path &name, int depth, bool flat, bool ignoreClashes) {
|
||||
return getSubDirectory(Path(), name, depth, flat, ignoreClashes);
|
||||
}
|
||||
|
||||
FSDirectory *FSDirectory::getSubDirectory(const String &prefix, const String &name, int depth,
|
||||
FSDirectory *FSDirectory::getSubDirectory(const Path &prefix, const Path &name, int depth,
|
||||
bool flat, bool ignoreClashes) {
|
||||
if (name.empty() || !_node.isDirectory())
|
||||
String rawName = name.rawString();
|
||||
if (rawName.empty() || !_node.isDirectory())
|
||||
return nullptr;
|
||||
|
||||
FSNode *node = lookupCache(_subDirCache, name);
|
||||
FSNode *node = lookupCache(_subDirCache, rawName);
|
||||
if (!node)
|
||||
return nullptr;
|
||||
|
||||
return new FSDirectory(prefix, *node, depth, flat, ignoreClashes);
|
||||
}
|
||||
|
||||
void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const String& prefix) const {
|
||||
void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const Path& prefix) const {
|
||||
if (depth <= 0)
|
||||
return;
|
||||
|
||||
@ -286,7 +291,7 @@ void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const String&
|
||||
|
||||
FSList::iterator it = list.begin();
|
||||
for ( ; it != list.end(); ++it) {
|
||||
String name = prefix + it->getName();
|
||||
String name = prefix.rawString() + it->getName();
|
||||
|
||||
// don't touch name as it might be used for warning messages
|
||||
String lowercaseName = name;
|
||||
@ -306,7 +311,7 @@ void FSDirectory::cacheDirectoryRecursive(FSNode node, int depth, const String&
|
||||
name.c_str());
|
||||
}
|
||||
}
|
||||
cacheDirectoryRecursive(*it, depth - 1, _flat ? prefix : lowercaseName + "/");
|
||||
cacheDirectoryRecursive(*it, depth - 1, _flat ? prefix : lowercaseName + DIR_SEPARATOR);
|
||||
_subDirCache[lowercaseName] = *it;
|
||||
}
|
||||
} else {
|
||||
|
20
common/fs.h
20
common/fs.h
@ -102,7 +102,7 @@ public:
|
||||
* operating system does not support the concept), some other directory is
|
||||
* used (usually the root directory).
|
||||
*/
|
||||
explicit FSNode(const String &path);
|
||||
explicit FSNode(const Path &path);
|
||||
|
||||
virtual ~FSNode() {}
|
||||
|
||||
@ -313,7 +313,7 @@ class FSDirectory : public Archive {
|
||||
FSNode *lookupCache(NodeCache &cache, const String &name) const;
|
||||
|
||||
// cache management
|
||||
void cacheDirectoryRecursive(FSNode node, int depth, const String& prefix) const;
|
||||
void cacheDirectoryRecursive(FSNode node, int depth, const Path& prefix) const;
|
||||
|
||||
// fill cache if not already cached
|
||||
void ensureCached() const;
|
||||
@ -324,7 +324,7 @@ public:
|
||||
* unbound FSDirectory if name is not found in the file system or if the node is not a
|
||||
* valid directory.
|
||||
*/
|
||||
FSDirectory(const String &name, int depth = 1, bool flat = false,
|
||||
FSDirectory(const Path &name, int depth = 1, bool flat = false,
|
||||
bool ignoreClashes = false, bool includeDirectories = false);
|
||||
/**
|
||||
* @overload
|
||||
@ -336,12 +336,12 @@ public:
|
||||
* Create a FSDirectory representing a tree with the specified depth. The parameter
|
||||
* prefix is prepended to the keys in the cache. See @ref FSDirectory.
|
||||
*/
|
||||
FSDirectory(const String &prefix, const String &name, int depth = 1,
|
||||
FSDirectory(const Path &prefix, const Path &name, int depth = 1,
|
||||
bool flat = false, bool ignoreClashes = false, bool includeDirectories = false);
|
||||
/**
|
||||
* @overload
|
||||
*/
|
||||
FSDirectory(const String &prefix, const FSNode &node, int depth = 1,
|
||||
FSDirectory(const Path &prefix, const FSNode &node, int depth = 1,
|
||||
bool flat = false, bool ignoreClashes = false, bool includeDirectories = false);
|
||||
|
||||
virtual ~FSDirectory();
|
||||
@ -355,21 +355,21 @@ public:
|
||||
* Create a new FSDirectory pointing to a subdirectory of the instance.
|
||||
* @return A new FSDirectory instance.
|
||||
*/
|
||||
FSDirectory *getSubDirectory(const String &name, int depth = 1, bool flat = false,
|
||||
FSDirectory *getSubDirectory(const Path &name, int depth = 1, bool flat = false,
|
||||
bool ignoreClashes = false);
|
||||
/**
|
||||
* Create a new FSDirectory pointing to a subdirectory of the instance. See FSDirectory
|
||||
* for an explanation of the prefix parameter.
|
||||
* @return A new FSDirectory instance.
|
||||
*/
|
||||
FSDirectory *getSubDirectory(const String &prefix, const String &name, int depth = 1,
|
||||
FSDirectory *getSubDirectory(const Path &prefix, const Path &name, int depth = 1,
|
||||
bool flat = false, bool ignoreClashes = false);
|
||||
|
||||
/**
|
||||
* Check for the existence of a file in the cache. A full match of relative path and file name
|
||||
* is needed for success.
|
||||
*/
|
||||
virtual bool hasFile(const String &name) const;
|
||||
virtual bool hasFile(const Path &path) const;
|
||||
|
||||
/**
|
||||
* Return a list of matching file names. Pattern can use GLOB wildcards.
|
||||
@ -385,13 +385,13 @@ public:
|
||||
* Get an ArchiveMember representation of the specified file. A full match of relative
|
||||
* path and file name is needed for success.
|
||||
*/
|
||||
virtual const ArchiveMemberPtr getMember(const String &name) const;
|
||||
virtual const ArchiveMemberPtr getMember(const Path &path) const;
|
||||
|
||||
/**
|
||||
* Open the specified file. A full match of relative path and file name is needed
|
||||
* for success.
|
||||
*/
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const Path &path) const;
|
||||
};
|
||||
|
||||
/** @} */
|
||||
|
@ -64,10 +64,10 @@ public:
|
||||
void close();
|
||||
|
||||
// Archive API implementation
|
||||
virtual bool hasFile(const String &name) const;
|
||||
virtual bool hasFile(const Path &path) const;
|
||||
virtual int listMembers(ArchiveMemberList &list) const;
|
||||
virtual const ArchiveMemberPtr getMember(const String &name) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
|
||||
virtual const ArchiveMemberPtr getMember(const Path &path) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const Path &path) const;
|
||||
|
||||
private:
|
||||
struct FileEntry {
|
||||
@ -217,7 +217,8 @@ void InstallShieldCabinet::close() {
|
||||
_version = 0;
|
||||
}
|
||||
|
||||
bool InstallShieldCabinet::hasFile(const String &name) const {
|
||||
bool InstallShieldCabinet::hasFile(const Path &path) const {
|
||||
String name = path.toString();
|
||||
return _map.contains(name);
|
||||
}
|
||||
|
||||
@ -228,11 +229,13 @@ int InstallShieldCabinet::listMembers(ArchiveMemberList &list) const {
|
||||
return _map.size();
|
||||
}
|
||||
|
||||
const ArchiveMemberPtr InstallShieldCabinet::getMember(const String &name) const {
|
||||
const ArchiveMemberPtr InstallShieldCabinet::getMember(const Path &path) const {
|
||||
String name = path.toString();
|
||||
return ArchiveMemberPtr(new GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
SeekableReadStream *InstallShieldCabinet::createReadStreamForMember(const String &name) const {
|
||||
SeekableReadStream *InstallShieldCabinet::createReadStreamForMember(const Path &path) const {
|
||||
String name = path.toString();
|
||||
if (!_map.contains(name))
|
||||
return nullptr;
|
||||
|
||||
|
@ -107,7 +107,8 @@ void InstallShieldV3::close() {
|
||||
_map.clear();
|
||||
}
|
||||
|
||||
bool InstallShieldV3::hasFile(const Common::String &name) const {
|
||||
bool InstallShieldV3::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return _map.contains(name);
|
||||
}
|
||||
|
||||
@ -118,11 +119,13 @@ int InstallShieldV3::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return _map.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr InstallShieldV3::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr InstallShieldV3::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *InstallShieldV3::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *InstallShieldV3::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_stream || !_map.contains(name))
|
||||
return nullptr;
|
||||
|
||||
|
@ -43,10 +43,10 @@ public:
|
||||
bool isOpen() const { return _stream != nullptr; }
|
||||
|
||||
// Common::Archive API implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
struct FileEntry {
|
||||
|
@ -47,10 +47,10 @@ public:
|
||||
bool isOpen() const { return _stream != 0; }
|
||||
|
||||
// Common::Archive API implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
struct FileEntry {
|
||||
@ -199,7 +199,8 @@ void StuffItArchive::close() {
|
||||
_map.clear();
|
||||
}
|
||||
|
||||
bool StuffItArchive::hasFile(const Common::String &name) const {
|
||||
bool StuffItArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return _map.contains(name);
|
||||
}
|
||||
|
||||
@ -210,11 +211,13 @@ int StuffItArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return _map.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr StuffItArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr StuffItArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *StuffItArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *StuffItArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_stream || !_map.contains(name))
|
||||
return nullptr;
|
||||
|
||||
|
@ -702,10 +702,10 @@ public:
|
||||
virtual ~ArjArchive();
|
||||
|
||||
// Archive implementation
|
||||
virtual bool hasFile(const String &name) const;
|
||||
virtual bool hasFile(const Path &path) const;
|
||||
virtual int listMembers(ArchiveMemberList &list) const;
|
||||
virtual const ArchiveMemberPtr getMember(const String &name) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
|
||||
virtual const ArchiveMemberPtr getMember(const Path &path) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const Path &path) const;
|
||||
};
|
||||
|
||||
ArjArchive::ArjArchive(const String &filename) : _arjFilename(filename) {
|
||||
@ -746,7 +746,8 @@ ArjArchive::~ArjArchive() {
|
||||
}
|
||||
}
|
||||
|
||||
bool ArjArchive::hasFile(const String &name) const {
|
||||
bool ArjArchive::hasFile(const Path &path) const {
|
||||
String name = path.toString();
|
||||
return _headers.contains(name);
|
||||
}
|
||||
|
||||
@ -762,14 +763,16 @@ int ArjArchive::listMembers(ArchiveMemberList &list) const {
|
||||
return matches;
|
||||
}
|
||||
|
||||
const ArchiveMemberPtr ArjArchive::getMember(const String &name) const {
|
||||
const ArchiveMemberPtr ArjArchive::getMember(const Path &path) const {
|
||||
String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return ArchiveMemberPtr();
|
||||
|
||||
return ArchiveMemberPtr(new GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
SeekableReadStream *ArjArchive::createReadStreamForMember(const String &name) const {
|
||||
SeekableReadStream *ArjArchive::createReadStreamForMember(const Path &path) const {
|
||||
String name = path.toString();
|
||||
if (!_headers.contains(name)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1429,10 +1429,10 @@ public:
|
||||
|
||||
~ZipArchive();
|
||||
|
||||
virtual bool hasFile(const String &name) const;
|
||||
virtual bool hasFile(const Path &path) const;
|
||||
virtual int listMembers(ArchiveMemberList &list) const;
|
||||
virtual const ArchiveMemberPtr getMember(const String &name) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const String &name) const;
|
||||
virtual const ArchiveMemberPtr getMember(const Path &path) const;
|
||||
virtual SeekableReadStream *createReadStreamForMember(const Path &path) const;
|
||||
};
|
||||
|
||||
/*
|
||||
@ -1461,7 +1461,8 @@ ZipArchive::~ZipArchive() {
|
||||
unzClose(_zipFile);
|
||||
}
|
||||
|
||||
bool ZipArchive::hasFile(const String &name) const {
|
||||
bool ZipArchive::hasFile(const Path &path) const {
|
||||
String name = path.toString();
|
||||
return (unzLocateFile(_zipFile, name.c_str(), 2) == UNZ_OK);
|
||||
}
|
||||
|
||||
@ -1478,14 +1479,16 @@ int ZipArchive::listMembers(ArchiveMemberList &list) const {
|
||||
return members;
|
||||
}
|
||||
|
||||
const ArchiveMemberPtr ZipArchive::getMember(const String &name) const {
|
||||
const ArchiveMemberPtr ZipArchive::getMember(const Path &path) const {
|
||||
String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return ArchiveMemberPtr();
|
||||
|
||||
return ArchiveMemberPtr(new GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
SeekableReadStream *ZipArchive::createReadStreamForMember(const String &name) const {
|
||||
SeekableReadStream *ZipArchive::createReadStreamForMember(const Path &path) const {
|
||||
String name = path.toString();
|
||||
if (unzLocateFile(_zipFile, name.c_str(), 2) != UNZ_OK)
|
||||
return nullptr;
|
||||
|
||||
|
@ -43,7 +43,8 @@ class FileMapArchive : public Common::Archive {
|
||||
public:
|
||||
FileMapArchive(const AdvancedMetaEngineDetection::FileMap &fileMap) : _fileMap(fileMap) {}
|
||||
|
||||
bool hasFile(const Common::String &name) const override {
|
||||
bool hasFile(const Common::Path &path) const override {
|
||||
Common::String name = path.toString();
|
||||
return _fileMap.contains(name);
|
||||
}
|
||||
|
||||
@ -57,7 +58,8 @@ public:
|
||||
return files;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override {
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override {
|
||||
Common::String name = path.toString();
|
||||
AdvancedMetaEngineDetection::FileMap::const_iterator it = _fileMap.find(name);
|
||||
if (it == _fileMap.end()) {
|
||||
return Common::ArchiveMemberPtr();
|
||||
@ -66,7 +68,8 @@ public:
|
||||
return Common::ArchiveMemberPtr(new Common::FSNode(it->_value));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override {
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override {
|
||||
Common::String name = path.toString();
|
||||
Common::FSNode fsNode = _fileMap.getValOrDefault(name);
|
||||
return fsNode.createReadStream();
|
||||
}
|
||||
|
@ -39,7 +39,8 @@ Blorb::Blorb(const Common::FSNode &fileNode, InterpreterType interpType) :
|
||||
error("Could not parse blorb file");
|
||||
}
|
||||
|
||||
bool Blorb::hasFile(const Common::String &name) const {
|
||||
bool Blorb::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (uint idx = 0; idx < _chunks.size(); ++idx) {
|
||||
if (_chunks[idx]._filename.equalsIgnoreCase(name))
|
||||
return true;
|
||||
@ -56,14 +57,16 @@ int Blorb::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return (int)_chunks.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr Blorb::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr Blorb::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *Blorb::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *Blorb::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (uint idx = 0; idx < _chunks.size(); ++idx) {
|
||||
const ChunkEntry &ce = _chunks[idx];
|
||||
|
||||
|
@ -112,7 +112,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -125,14 +125,14 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
* archive. If no member with this name exists, 0 is returned.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Read the RIdx section from the stream.
|
||||
|
@ -360,7 +360,8 @@ int Pics::getPictureNumber(const Common::String &filename) const {
|
||||
return atoi(num.c_str());
|
||||
}
|
||||
|
||||
bool Pics::hasFile(const Common::String &name) const {
|
||||
bool Pics::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
int num = getPictureNumber(name);
|
||||
if (num == -1)
|
||||
return false;
|
||||
@ -379,14 +380,16 @@ int Pics::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr Pics::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr Pics::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *Pics::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *Pics::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
// Get the picture number
|
||||
int num = getPictureNumber(name);
|
||||
if (num == -1 || !hasFile(name))
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -135,14 +135,14 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
* archive. If no member with this name exists, 0 is returned.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
} // namespace Comprehend
|
||||
|
@ -48,7 +48,8 @@ bool ResourceArchive::splitName(const Common::String &name,
|
||||
}
|
||||
|
||||
|
||||
bool ResourceArchive::hasFile(const Common::String &name) const {
|
||||
bool ResourceArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
Common::String filename, resName;
|
||||
|
||||
if (!splitName(name, filename, resName))
|
||||
@ -59,14 +60,16 @@ bool ResourceArchive::hasFile(const Common::String &name) const {
|
||||
return resLength != 0;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr ResourceArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr ResourceArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *ResourceArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *ResourceArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
Common::String filename, resName;
|
||||
|
||||
// Split up the file and resource entry; return if it's not one
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -62,14 +62,14 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
* archive. If no member with this name exists, 0 is returned.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
@ -113,7 +113,8 @@ bool Pics::exists() {
|
||||
return Common::File::exists(getFilename());
|
||||
}
|
||||
|
||||
bool Pics::hasFile(const Common::String &name) const {
|
||||
bool Pics::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (uint idx = 0; idx < _index.size(); ++idx) {
|
||||
if (_index[idx]._filename.equalsIgnoreCase(name))
|
||||
return true;
|
||||
@ -130,14 +131,16 @@ int Pics::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return (int)_index.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr Pics::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr Pics::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *Pics::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *Pics::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
PictureDecoder decoder;
|
||||
|
||||
for (uint idx = 0; idx < _index.size(); ++idx) {
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -121,14 +121,14 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
* archive. If no member with this name exists, 0 is returned.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
} // End of namespace ZCode
|
||||
|
@ -48,7 +48,8 @@ SoundSubfolder::SoundSubfolder(const Common::FSNode &folder) : _folder(folder) {
|
||||
}
|
||||
}
|
||||
|
||||
bool SoundSubfolder::hasFile(const Common::String &name) const {
|
||||
bool SoundSubfolder::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return _filenames.contains(name);
|
||||
}
|
||||
|
||||
@ -62,14 +63,16 @@ int SoundSubfolder::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return total;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr SoundSubfolder::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr SoundSubfolder::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *SoundSubfolder::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *SoundSubfolder::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
Common::File *f = new Common::File();
|
||||
if (_filenames.contains(name) && f->open(_folder.getChild(_filenames[name])))
|
||||
return f;
|
||||
@ -112,7 +115,8 @@ SoundZip::~SoundZip() {
|
||||
delete _zip;
|
||||
}
|
||||
|
||||
bool SoundZip::hasFile(const Common::String &name) const {
|
||||
bool SoundZip::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return _filenames.contains(name);
|
||||
}
|
||||
|
||||
@ -127,7 +131,8 @@ int SoundZip::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return total;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr SoundZip::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr SoundZip::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
@ -135,7 +140,8 @@ const Common::ArchiveMemberPtr SoundZip::getMember(const Common::String &name) c
|
||||
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *SoundZip::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *SoundZip::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_filenames.contains(name))
|
||||
return nullptr;
|
||||
|
||||
|
@ -56,7 +56,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -69,14 +69,14 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
* archive. If no member with this name exists, 0 is returned.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -109,7 +109,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -122,14 +122,14 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
* archive. If no member with this name exists, 0 is returned.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
} // End of namespace ZCode
|
||||
|
@ -146,8 +146,8 @@ void Lab::parseMonkey4FileTable(Common::File *file) {
|
||||
delete[] stringTable;
|
||||
}
|
||||
|
||||
bool Lab::hasFile(const Common::String &filename) const {
|
||||
Common::String fname(filename);
|
||||
bool Lab::hasFile(const Common::Path &filename) const {
|
||||
Common::String fname(filename.toString());
|
||||
fname.toLowercase();
|
||||
return _entries.contains(fname);
|
||||
}
|
||||
@ -163,7 +163,8 @@ int Lab::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return count;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr Lab::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr Lab::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
@ -172,7 +173,8 @@ const Common::ArchiveMemberPtr Lab::getMember(const Common::String &name) const
|
||||
return _entries[fname];
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *Lab::createReadStreamForMember(const Common::String &filename) const {
|
||||
Common::SeekableReadStream *Lab::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String filename = path.toString();
|
||||
if (!hasFile(filename))
|
||||
return nullptr;
|
||||
|
||||
|
@ -50,10 +50,10 @@ public:
|
||||
Lab();
|
||||
virtual ~Lab();
|
||||
// Common::Archive implementation
|
||||
virtual bool hasFile(const Common::String &name) const override;
|
||||
virtual bool hasFile(const Common::Path &path) const override;
|
||||
virtual int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
virtual const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
virtual Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
virtual const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
virtual Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
void parseGrimFileTable(Common::File *_f);
|
||||
|
@ -66,7 +66,8 @@ LangFilter::~LangFilter() {
|
||||
delete _arc;
|
||||
}
|
||||
|
||||
bool LangFilter::hasFile(const Common::String &name) const {
|
||||
bool LangFilter::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_arc)
|
||||
return false;
|
||||
|
||||
@ -109,11 +110,13 @@ int LangFilter::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return num;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr LangFilter::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr LangFilter::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *LangFilter::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *LangFilter::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_arc)
|
||||
return nullptr;
|
||||
|
||||
|
@ -34,10 +34,10 @@ public:
|
||||
~LangFilter();
|
||||
|
||||
// Common::Archive API implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
private:
|
||||
Common::Archive *_arc;
|
||||
|
||||
|
@ -146,7 +146,8 @@ Common::String MsCabinet::readString(Common::ReadStream *stream) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool MsCabinet::hasFile(const Common::String &name) const {
|
||||
bool MsCabinet::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return _fileMap.contains(name);
|
||||
}
|
||||
|
||||
@ -157,11 +158,13 @@ int MsCabinet::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return _fileMap.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr MsCabinet::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr MsCabinet::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *MsCabinet::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *MsCabinet::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
byte *fileBuf;
|
||||
|
||||
if (!hasFile(name))
|
||||
|
@ -38,10 +38,10 @@ public:
|
||||
~MsCabinet();
|
||||
|
||||
// Common::Archive API implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
Common::SeekableReadStream *_data;
|
||||
|
@ -37,7 +37,8 @@ PlainArchive::PlainArchive(Common::ArchiveMemberPtr file)
|
||||
: _file(file), _files() {
|
||||
}
|
||||
|
||||
bool PlainArchive::hasFile(const Common::String &name) const {
|
||||
bool PlainArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return (_files.find(name) != _files.end());
|
||||
}
|
||||
|
||||
@ -52,14 +53,16 @@ int PlainArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return count;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr PlainArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr PlainArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *PlainArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *PlainArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
FileMap::const_iterator fDesc = _files.find(name);
|
||||
if (fDesc == _files.end())
|
||||
return 0;
|
||||
@ -92,7 +95,8 @@ TlkArchive::~TlkArchive() {
|
||||
delete[] _fileEntries;
|
||||
}
|
||||
|
||||
bool TlkArchive::hasFile(const Common::String &name) const {
|
||||
bool TlkArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return (findFile(name) != 0);
|
||||
}
|
||||
|
||||
@ -107,14 +111,16 @@ int TlkArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return count;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr TlkArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr TlkArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *TlkArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *TlkArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
const uint32 *fileDesc = findFile(name);
|
||||
if (!fileDesc)
|
||||
return 0;
|
||||
@ -186,7 +192,8 @@ CachedArchive::~CachedArchive() {
|
||||
_files.clear();
|
||||
}
|
||||
|
||||
bool CachedArchive::hasFile(const Common::String &name) const {
|
||||
bool CachedArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return (_files.find(name) != _files.end());
|
||||
}
|
||||
|
||||
@ -201,14 +208,16 @@ int CachedArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return count;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr CachedArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr CachedArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *CachedArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *CachedArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
FileMap::const_iterator fDesc = _files.find(name);
|
||||
if (fDesc == _files.end())
|
||||
return 0;
|
||||
|
@ -50,10 +50,10 @@ public:
|
||||
Entry getFileEntry(const Common::String &name) const;
|
||||
|
||||
// Common::Archive API implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
private:
|
||||
typedef Common::HashMap<Common::String, Entry, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> FileMap;
|
||||
|
||||
@ -66,10 +66,10 @@ public:
|
||||
TlkArchive(Common::ArchiveMemberPtr file, uint16 entryCount, const uint32 *fileEntries);
|
||||
~TlkArchive() override;
|
||||
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
private:
|
||||
Common::ArchiveMemberPtr _file;
|
||||
|
||||
@ -93,10 +93,10 @@ public:
|
||||
CachedArchive(const FileInputList &files);
|
||||
~CachedArchive() override;
|
||||
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
private:
|
||||
struct Entry {
|
||||
byte *data;
|
||||
|
@ -74,7 +74,8 @@ HPFArchive::HPFArchive(const Common::String &path) {
|
||||
delete archive;
|
||||
}
|
||||
|
||||
bool HPFArchive::hasFile(const Common::String &name) const {
|
||||
bool HPFArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return (_files.find(name) != _files.end());
|
||||
}
|
||||
|
||||
@ -89,14 +90,16 @@ int HPFArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return numMembers;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr HPFArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr HPFArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *HPFArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *HPFArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
FileMap::const_iterator fDesc = _files.find(name);
|
||||
if (fDesc == _files.end())
|
||||
return NULL;
|
||||
|
@ -46,10 +46,10 @@ class HPFArchive : public Common::Archive {
|
||||
public:
|
||||
HPFArchive(const Common::String &path);
|
||||
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
int count() { return _files.size(); }
|
||||
|
||||
|
@ -144,7 +144,8 @@ Common::SeekableReadStream *ResourceManager::getFileStream(const Common::String
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Archive functions
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool ResourceManager::hasFile(const Common::String &name) const {
|
||||
bool ResourceManager::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (Common::Array<HPFArchive *>::const_iterator it = _archives.begin(); it != _archives.end(); ++it) {
|
||||
if ((*it)->hasFile(name))
|
||||
return true;
|
||||
@ -167,14 +168,16 @@ int ResourceManager::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return count;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr ResourceManager::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr ResourceManager::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *ResourceManager::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *ResourceManager::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (Common::Array<HPFArchive *>::const_iterator it = _archives.begin(); it != _archives.end(); ++it) {
|
||||
|
||||
Common::SeekableReadStream *stream = (*it)->createReadStreamForMember(name);
|
||||
|
@ -45,10 +45,10 @@ public:
|
||||
Common::SeekableReadStream *getFileStream(const Common::String &name) const;
|
||||
|
||||
// Archive functions
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
// Resource loading
|
||||
Background *loadBackground(const Common::String &name) const;
|
||||
|
@ -83,10 +83,10 @@ public:
|
||||
~HagArchive() override;
|
||||
|
||||
// Archive implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
const char *const MADSCONCAT_STRING = "MADSCONCAT";
|
||||
@ -99,7 +99,8 @@ HagArchive::~HagArchive() {
|
||||
}
|
||||
|
||||
// Archive implementation
|
||||
bool HagArchive::hasFile(const Common::String &name) const {
|
||||
bool HagArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
HagIndex hagIndex;
|
||||
HagEntry hagEntry;
|
||||
return getHeaderEntry(name, hagIndex, hagEntry);
|
||||
@ -122,14 +123,16 @@ int HagArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return members;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr HagArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr HagArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *HagArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *HagArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
HagIndex hagIndex;
|
||||
HagEntry hagEntry;
|
||||
|
||||
|
@ -107,7 +107,8 @@ void InstallerArchive::close() {
|
||||
_map.clear();
|
||||
}
|
||||
|
||||
bool InstallerArchive::hasFile(const Common::String &name) const {
|
||||
bool InstallerArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return _map.contains(name);
|
||||
}
|
||||
|
||||
@ -118,11 +119,13 @@ int InstallerArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return _map.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr InstallerArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *InstallerArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *InstallerArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_stream || !_map.contains(name))
|
||||
return nullptr;
|
||||
|
||||
|
@ -43,10 +43,10 @@ public:
|
||||
bool isOpen() const { return _stream != nullptr; }
|
||||
|
||||
// Common::Archive API implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
struct FileEntry {
|
||||
|
@ -100,7 +100,8 @@ NGIArchive::~NGIArchive() {
|
||||
g_nmi->_currArchive = nullptr;
|
||||
}
|
||||
|
||||
bool NGIArchive::hasFile(const Common::String &name) const {
|
||||
bool NGIArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return _headers.contains(name);
|
||||
}
|
||||
|
||||
@ -116,14 +117,16 @@ int NGIArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return matches;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr NGIArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr NGIArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *NGIArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *NGIArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_headers.contains(name)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ public:
|
||||
~NGIArchive() override;
|
||||
|
||||
// Archive implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -74,10 +74,10 @@ public:
|
||||
NSArchive(Common::SeekableReadStream *stream, Common::Platform platform, uint32 features);
|
||||
~NSArchive() override;
|
||||
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
|
||||
@ -123,7 +123,8 @@ uint32 NSArchive::lookup(const char *name) const {
|
||||
return i;
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *NSArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *NSArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
debugC(3, kDebugDisk, "NSArchive::createReadStreamForMember(%s)", name.c_str());
|
||||
|
||||
if (name.empty())
|
||||
@ -139,7 +140,8 @@ Common::SeekableReadStream *NSArchive::createReadStreamForMember(const Common::S
|
||||
return new Common::SeekableSubReadStream(_stream, offset, endOffset, DisposeAfterUse::NO);
|
||||
}
|
||||
|
||||
bool NSArchive::hasFile(const Common::String &name) const {
|
||||
bool NSArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (name.empty())
|
||||
return false;
|
||||
return lookup(name.c_str()) != _numFiles;
|
||||
@ -152,7 +154,8 @@ int NSArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return _numFiles;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr NSArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr NSArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
uint32 index = lookup(name.c_str());
|
||||
|
||||
const char *item = 0;
|
||||
|
@ -130,7 +130,8 @@ void PtcArchive::close() {
|
||||
_items.clear();
|
||||
}
|
||||
|
||||
bool PtcArchive::hasFile(const Common::String &name) const {
|
||||
bool PtcArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
// TODO: check if path matching should be added
|
||||
return _items.contains(name);
|
||||
}
|
||||
@ -146,14 +147,16 @@ int PtcArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return matches;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr PtcArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr PtcArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_items.contains(name)) {
|
||||
Common::ArchiveMemberPtr();
|
||||
}
|
||||
return Common::ArchiveMemberList::value_type(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *PtcArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *PtcArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_items.contains(name)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -40,10 +40,10 @@ public:
|
||||
bool isOpen() const { return _stream != 0; }
|
||||
|
||||
// Common::Archive API implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
struct FileEntry {
|
||||
|
@ -134,7 +134,8 @@ Common::String XARCArchive::getFilename() const {
|
||||
return _filename;
|
||||
}
|
||||
|
||||
bool XARCArchive::hasFile(const Common::String &name) const {
|
||||
bool XARCArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
|
||||
if ((*it)->getName() == name) {
|
||||
// Found it
|
||||
@ -170,7 +171,8 @@ int XARCArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return files;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr XARCArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr XARCArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
|
||||
if ((*it)->getName() == name) {
|
||||
// Found it
|
||||
@ -182,7 +184,8 @@ const Common::ArchiveMemberPtr XARCArchive::getMember(const Common::String &name
|
||||
return Common::ArchiveMemberPtr();
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *XARCArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *XARCArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (Common::ArchiveMemberList::const_iterator it = _members.begin(); it != _members.end(); ++it) {
|
||||
if ((*it)->getName() == name) {
|
||||
// Found it
|
||||
|
@ -37,11 +37,11 @@ public:
|
||||
Common::String getFilename() const;
|
||||
|
||||
// Archive API
|
||||
bool hasFile(const Common::String &name) const;
|
||||
bool hasFile(const Common::Path &path) const;
|
||||
int listMatchingMembers(Common::ArchiveMemberList &list, const Common::String &pattern) const;
|
||||
int listMembers(Common::ArchiveMemberList &list) const;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const;
|
||||
|
||||
Common::SeekableReadStream *createReadStreamForMember(const XARCMember *member) const;
|
||||
|
||||
|
@ -74,7 +74,8 @@ void FastFile::close() {
|
||||
_fileEntries.clear();
|
||||
}
|
||||
|
||||
bool FastFile::hasFile(const Common::String &name) const {
|
||||
bool FastFile::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
const FileEntry *entry = getEntry(name);
|
||||
return entry != nullptr;
|
||||
}
|
||||
@ -87,11 +88,13 @@ int FastFile::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return list.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr FastFile::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr FastFile::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *FastFile::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *FastFile::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_stream)
|
||||
return nullptr;
|
||||
|
||||
|
@ -47,10 +47,10 @@ public:
|
||||
Common::SeekableReadStream *createReadStreamForCompressedMember(const Common::String &name);
|
||||
|
||||
// Common::Archive API implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
Common::SeekableReadStreamEndian *_stream;
|
||||
|
@ -116,7 +116,8 @@ bool UltimaDataArchive::load(const Common::String &subfolder,
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
|
||||
bool UltimaDataArchive::hasFile(const Common::String &name) const {
|
||||
bool UltimaDataArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!name.hasPrefixIgnoreCase(_publicFolder))
|
||||
return false;
|
||||
|
||||
@ -159,14 +160,16 @@ int UltimaDataArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return result;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr UltimaDataArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr UltimaDataArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *UltimaDataArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *UltimaDataArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (hasFile(name)) {
|
||||
Common::String filename = innerToPublic(name);
|
||||
return _zip->createReadStreamForMember(filename);
|
||||
@ -179,14 +182,16 @@ Common::SeekableReadStream *UltimaDataArchive::createReadStreamForMember(const C
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
|
||||
const Common::ArchiveMemberPtr UltimaDataArchiveProxy::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr UltimaDataArchiveProxy::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *UltimaDataArchiveProxy::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *UltimaDataArchiveProxy::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (hasFile(name))
|
||||
return getNode(name).createReadStream();
|
||||
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive matching the specified pattern to list.
|
||||
@ -94,7 +94,7 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name)
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path)
|
||||
const override;
|
||||
|
||||
/**
|
||||
@ -103,7 +103,7 @@ public:
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(
|
||||
const Common::String &name) const override;
|
||||
const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
@ -136,7 +136,8 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override {
|
||||
bool hasFile(const Common::Path &path) const override {
|
||||
Common::String name = path.toString();
|
||||
return name.hasPrefixIgnoreCase(_publicFolder) && getNode(name).exists();
|
||||
}
|
||||
|
||||
@ -164,7 +165,7 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name)
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path)
|
||||
const override;
|
||||
|
||||
/**
|
||||
@ -173,7 +174,7 @@ public:
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(
|
||||
const Common::String &name) const override;
|
||||
const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -55,7 +55,8 @@ void Resources::addResource(const Common::String &name, const byte *data, size_t
|
||||
Common::copy(data, data + size, &lr._data[0]);
|
||||
}
|
||||
|
||||
bool Resources::hasFile(const Common::String &name) const {
|
||||
bool Resources::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (uint idx = 0; idx < _localResources.size(); ++idx)
|
||||
if (!_localResources[idx]._name.compareToIgnoreCase(name))
|
||||
return true;
|
||||
@ -71,14 +72,16 @@ int Resources::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return _localResources.size();
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr Resources::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr Resources::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *Resources::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *Resources::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
for (uint idx = 0; idx < _localResources.size(); ++idx) {
|
||||
const LocalResource &lr = _localResources[idx];
|
||||
if (!lr._name.compareToIgnoreCase(name))
|
||||
|
@ -168,7 +168,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -181,14 +181,14 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
* archive. If no member with this name exists, 0 is returned.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
} // End of namespace Shared
|
||||
|
@ -247,7 +247,8 @@ PackageSet::~PackageSet() {
|
||||
_packages.clear();
|
||||
}
|
||||
|
||||
bool PackageSet::hasFile(const Common::String &name) const {
|
||||
bool PackageSet::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
Common::String upcName = name;
|
||||
upcName.toUppercase();
|
||||
Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it;
|
||||
@ -267,7 +268,8 @@ int PackageSet::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return count;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr PackageSet::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr PackageSet::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
Common::String upcName = name;
|
||||
upcName.toUppercase();
|
||||
Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it;
|
||||
@ -275,7 +277,8 @@ const Common::ArchiveMemberPtr PackageSet::getMember(const Common::String &name)
|
||||
return Common::ArchiveMemberPtr(it->_value);
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *PackageSet::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *PackageSet::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
Common::String upcName = name;
|
||||
upcName.toUppercase();
|
||||
Common::HashMap<Common::String, Common::ArchiveMemberPtr>::const_iterator it;
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -68,14 +68,14 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
* archive. If no member with this name exists, 0 is returned.
|
||||
* @return the newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
int getPriority() const { return _priority; }
|
||||
uint32 getVersion() const { return _version; }
|
||||
|
@ -121,7 +121,8 @@ void BaseCCArchive::saveIndex(Common::WriteStream &stream) {
|
||||
delete[] rawIndex;
|
||||
}
|
||||
|
||||
bool BaseCCArchive::hasFile(const Common::String &name) const {
|
||||
bool BaseCCArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
CCEntry ccEntry;
|
||||
return getHeaderEntry(name, ccEntry);
|
||||
}
|
||||
@ -143,7 +144,8 @@ bool BaseCCArchive::getHeaderEntry(uint16 id, CCEntry &ccEntry) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr BaseCCArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr BaseCCArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
@ -193,7 +195,8 @@ bool CCArchive::getHeaderEntry(const Common::String &resourceName, CCEntry &ccEn
|
||||
return BaseCCArchive::getHeaderEntry(resName, ccEntry);
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *CCArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *CCArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
CCEntry ccEntry;
|
||||
|
||||
if (getHeaderEntry(name, ccEntry)) {
|
||||
@ -465,7 +468,8 @@ SaveArchive::~SaveArchive() {
|
||||
delete[] _data;
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *SaveArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *SaveArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
|
||||
// If the given resource has already been perviously "written" to the
|
||||
// save manager, then return that new resource
|
||||
|
@ -295,9 +295,9 @@ public:
|
||||
BaseCCArchive() {}
|
||||
|
||||
// Archive implementation
|
||||
bool hasFile(const Common::String &name) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
int listMembers(Common::ArchiveMemberList &list) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -316,7 +316,7 @@ public:
|
||||
~CCArchive() override;
|
||||
|
||||
// Archive implementation
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
};
|
||||
|
||||
class SaveArchive : public BaseCCArchive {
|
||||
@ -338,7 +338,7 @@ public:
|
||||
/**
|
||||
* Archive implementation
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Archive implementation
|
||||
|
@ -104,7 +104,8 @@ Common::String ZfsArchive::readEntryName(Common::SeekableReadStream *stream) con
|
||||
return Common::String(buffer);
|
||||
}
|
||||
|
||||
bool ZfsArchive::hasFile(const Common::String &name) const {
|
||||
bool ZfsArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
return _entryHeaders.contains(name);
|
||||
}
|
||||
|
||||
@ -119,14 +120,16 @@ int ZfsArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
return matches;
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr ZfsArchive::getMember(const Common::String &name) const {
|
||||
const Common::ArchiveMemberPtr ZfsArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_entryHeaders.contains(name))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common::String &name) const {
|
||||
Common::SeekableReadStream *ZfsArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!_entryHeaders.contains(name)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
* Patterns are not allowed, as this is meant to be a quick File::exists()
|
||||
* replacement.
|
||||
*/
|
||||
bool hasFile(const Common::String &fileName) const override;
|
||||
bool hasFile(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Add all members of the Archive to list.
|
||||
@ -78,7 +78,7 @@ public:
|
||||
/**
|
||||
* Returns a ArchiveMember representation of the given file.
|
||||
*/
|
||||
const Common::ArchiveMemberPtr getMember(const Common::String &name) const override;
|
||||
const Common::ArchiveMemberPtr getMember(const Common::Path &path) const override;
|
||||
|
||||
/**
|
||||
* Create a stream bound to a member with the specified name in the
|
||||
@ -86,7 +86,7 @@ public:
|
||||
*
|
||||
* @return The newly created input stream
|
||||
*/
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::String &name) const override;
|
||||
Common::SeekableReadStream *createReadStreamForMember(const Common::Path &path) const override;
|
||||
|
||||
private:
|
||||
const Common::String _fileName;
|
||||
|
Loading…
Reference in New Issue
Block a user