aboutsummaryrefslogtreecommitdiff
path: root/common/archive.h
diff options
context:
space:
mode:
authorNicola Mettifogo2008-09-11 13:24:01 +0000
committerNicola Mettifogo2008-09-11 13:24:01 +0000
commit166386b581195acbac82ac984264fa9e9de5ada1 (patch)
tree0f0004b0cc42e94c1faf0a9b5dcdd9aeedf6a87f /common/archive.h
parent224f95537b578bb2e3ccbf031b236bdcf7febf9f (diff)
downloadscummvm-rg350-166386b581195acbac82ac984264fa9e9de5ada1.tar.gz
scummvm-rg350-166386b581195acbac82ac984264fa9e9de5ada1.tar.bz2
scummvm-rg350-166386b581195acbac82ac984264fa9e9de5ada1.zip
Added first version of the SearchManager, as it is presented in patch tracker item 2093502.
svn-id: r34492
Diffstat (limited to 'common/archive.h')
-rw-r--r--common/archive.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/common/archive.h b/common/archive.h
index ac68a7f33d..c418eae063 100644
--- a/common/archive.h
+++ b/common/archive.h
@@ -31,6 +31,7 @@
#include "common/hash-str.h"
#include "common/list.h"
#include "common/ptr.h"
+#include "common/singleton.h"
#include "common/stream.h"
namespace Common {
@@ -202,6 +203,56 @@ public:
virtual SeekableReadStream *openFile(const String &name);
};
+
+
+
+class SearchManager : public Singleton<SearchManager>, public Archive {
+
+ SearchSet _searchSet;
+
+public:
+ /**
+ * 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
+ */
+ void addDirectory(const String &name, const String &directory);
+
+ /**
+ * 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. */
+#define SearchMan Common::SearchManager::instance()
+
} // namespace Common
#endif