aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-01 15:22:17 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-04-01 15:22:17 +0000
commitbe08b57e7a0692752dd0bec2b6ae529a1ff57b63 (patch)
tree2ef0c299794b76aa0ae1f106c080a156beddaf72
parent59518fcf2a053c9440c93a51c9a99f1983c4fa86 (diff)
downloadpaludis-be08b57e7a0692752dd0bec2b6ae529a1ff57b63.tar.gz
paludis-be08b57e7a0692752dd0bec2b6ae529a1ff57b63.tar.xz
Add PackageDatabase::has_repository_named
-rw-r--r--paludis/package_database.cc11
-rw-r--r--paludis/package_database.hh6
2 files changed, 17 insertions, 0 deletions
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 9cc033c..92ada0c 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -354,6 +354,17 @@ PackageDatabase::fetch_repository(const RepositoryName & n)
throw NoSuchRepositoryError(stringify(n));
}
+bool
+PackageDatabase::has_repository_named(const RepositoryName & n) const
+{
+ for (RepositoryIterator r(begin_repositories()), r_end(end_repositories()) ;
+ r != r_end ; ++r)
+ if ((*r)->name() == n)
+ return true;
+
+ return false;
+}
+
RepositoryName
PackageDatabase::favourite_repository() const
{
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index 53ed548..5eab072 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -270,6 +270,12 @@ namespace paludis
PALUDIS_ATTRIBUTE((warn_unused_result));
/**
+ * Do we have a named repository?
+ */
+ bool has_repository_named(const RepositoryName &) const
+ PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ /**
* Fetch the name of our 'favourite' repository (if a repository's
* name matches this when doing a graphical display, the repository
* name part may be omitted).