From 093431e88d7e886c9b08f024d79a7de386e982f0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 6 Sep 2008 22:09:34 +0000 Subject: [PATCH] Added hasArchive to SearchSet. svn-id: r34397 --- common/archive.cpp | 4 ++++ common/archive.h | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/common/archive.cpp b/common/archive.cpp index 91ed49c5c22..44e3e701be1 100644 --- a/common/archive.cpp +++ b/common/archive.cpp @@ -225,6 +225,10 @@ void SearchSet::remove(const String& name) { } } +bool SearchSet::hasArchive(const String &name) const { + return (find(name) != _list.end()); +} + void SearchSet::clear() { _list.clear(); } diff --git a/common/archive.h b/common/archive.h index e5434623322..ac68a7f33d8 100644 --- a/common/archive.h +++ b/common/archive.h @@ -165,15 +165,20 @@ class SearchSet : public Archive { public: /** - * Add a new Archive to the searchable set. + * Add a new archive to the searchable set. */ void add(const String& name, ArchivePtr archive, uint priority = 0); /** - * Remove an Archive from the searchable set. + * Remove an archive from the searchable set. */ void remove(const String& name); + /** + * Check if a given archive name is already present. + */ + bool hasArchive(const String &name) const; + /** * Empties the searchable set. */