aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-09-17 18:59:09 +0000
committerMax Horn2008-09-17 18:59:09 +0000
commit3178fad0a44d8b528019cf9914e32b701338dcdc (patch)
treefbb98e20425b291b94fd9e13532a66e999c168e5
parenta28646784dc0c90f86959accadceff1a6bc9be51 (diff)
downloadscummvm-rg350-3178fad0a44d8b528019cf9914e32b701338dcdc.tar.gz
scummvm-rg350-3178fad0a44d8b528019cf9914e32b701338dcdc.tar.bz2
scummvm-rg350-3178fad0a44d8b528019cf9914e32b701338dcdc.zip
Simplified & fixed SearchManager
svn-id: r34598
-rw-r--r--common/archive.cpp20
-rw-r--r--common/archive.h36
2 files changed, 7 insertions, 49 deletions
diff --git a/common/archive.cpp b/common/archive.cpp
index 6b8357d576..2c6e10ec01 100644
--- a/common/archive.cpp
+++ b/common/archive.cpp
@@ -299,7 +299,7 @@ SeekableReadStream *SearchSet::openFile(const String &name) {
DECLARE_SINGLETON(SearchManager);
void SearchManager::addArchive(const String &name, ArchivePtr archive) {
- _searchSet.add(name, archive);
+ add(name, archive);
}
void SearchManager::addDirectory(const String &name, const String &directory) {
@@ -307,23 +307,7 @@ void SearchManager::addDirectory(const String &name, const String &directory) {
}
void SearchManager::addDirectoryRecursive(const String &name, const String &directory, int depth) {
- _searchSet.add(name, SharedPtr<FSDirectory>(new FSDirectory(directory, depth)));
-}
-
-void SearchManager::remove(const String &name) {
- _searchSet.remove(name);
-}
-
-void SearchManager::clear() {
- _searchSet.clear();
-}
-
-bool SearchManager::hasFile(const String &name) {
- return _searchSet.hasFile(name);
-}
-
-SeekableReadStream *SearchManager::openFile(const String &name) {
- return _searchSet.openFile(name);
+ add(name, SharedPtr<FSDirectory>(new FSDirectory(directory, depth)));
}
diff --git a/common/archive.h b/common/archive.h
index c418eae063..f3f121e717 100644
--- a/common/archive.h
+++ b/common/archive.h
@@ -204,50 +204,24 @@ public:
};
-
-
-class SearchManager : public Singleton<SearchManager>, public Archive {
-
- SearchSet _searchSet;
-
+class SearchManager : public Singleton<SearchManager>, public SearchSet {
public:
/**
- * Add an existing Archive. This is meant to support searching in system-specific
- * archives, namely the MACOSX/IPHONE bundles.
+ * Add an existing Archive. This is meant to support searching in system-specific
+ * archives, namely the MACOSX/IPHONE bundles.
*/
void addArchive(const String &name, ArchivePtr archive);
/**
- * Create and add a FSDirectory by name
+ * Create and add a FSDirectory by name
*/
void addDirectory(const String &name, const String &directory);
/**
- * Create and add a FSDirectory and its subdirectories by name
+ * Create and add a FSDirectory and its subdirectories by name
*/
void addDirectoryRecursive(const String &name, const String &directory, int depth = 4);
- /**
- * Remove an archive from the pool.
- */
- void remove(const String &name);
-
- /**
- * Clears the archive
- */
- void clear();
-
-
- virtual bool hasFile(const String &name);
- virtual int getAllNames(StringList &list) {
- return matchPattern(list, "*");
- }
-
- /**
- * Implements openFile from Archive base class. The current policy is
- * opening the first file encountered that matches the name.
- */
- virtual SeekableReadStream *openFile(const String &name);
};
/** Shortcut for accessing the search manager. */