aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-22 08:58:14 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-01-22 08:58:14 +0000
commitbe5e1cc9efe01c9648ada47f2aaa5dcbd9ca8434 (patch)
tree834b52a18135eddedf11d602e77990f282c73e4e
parentf14f6c8017dbcb53c8596623ae3581e3aa058b30 (diff)
downloadpaludis-be5e1cc9efe01c9648ada47f2aaa5dcbd9ca8434.tar.gz
paludis-be5e1cc9efe01c9648ada47f2aaa5dcbd9ca8434.tar.xz
Move all the package database classes into the main package_database files.
-rw-r--r--paludis/ambiguous_package_name_error.cc23
-rw-r--r--paludis/ambiguous_package_name_error.hh62
-rw-r--r--paludis/duplicate_repository_error.cc28
-rw-r--r--paludis/duplicate_repository_error.hh45
-rw-r--r--paludis/environment.hh3
-rw-r--r--paludis/files.m49
-rw-r--r--paludis/no_such_package_error.cc28
-rw-r--r--paludis/no_such_package_error.hh45
-rw-r--r--paludis/no_such_repository_error.cc28
-rw-r--r--paludis/no_such_repository_error.hh45
-rw-r--r--paludis/no_such_version_error.cc30
-rw-r--r--paludis/no_such_version_error.hh47
-rw-r--r--paludis/package_database.cc43
-rw-r--r--paludis/package_database.hh160
-rw-r--r--paludis/package_database_entry.cc30
-rw-r--r--paludis/package_database_entry.hh74
-rw-r--r--paludis/package_database_entry_collection.cc21
-rw-r--r--paludis/package_database_entry_collection.hh50
-rw-r--r--paludis/package_database_error.cc28
-rw-r--r--paludis/package_database_error.hh41
-rw-r--r--paludis/package_database_lookup_error.cc28
-rw-r--r--paludis/package_database_lookup_error.hh41
22 files changed, 192 insertions, 717 deletions
diff --git a/paludis/ambiguous_package_name_error.cc b/paludis/ambiguous_package_name_error.cc
deleted file mode 100644
index 8610645..0000000
--- a/paludis/ambiguous_package_name_error.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "ambiguous_package_name_error.hh"
-
-using namespace paludis;
-
diff --git a/paludis/ambiguous_package_name_error.hh b/paludis/ambiguous_package_name_error.hh
deleted file mode 100644
index 4b4c4f4..0000000
--- a/paludis/ambiguous_package_name_error.hh
+++ /dev/null
@@ -1,62 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_AMBIGUOUS_PACKAGE_NAME_ERROR_HH
-#define PALUDIS_GUARD_PALUDIS_AMBIGUOUS_PACKAGE_NAME_ERROR_HH 1
-
-#include <paludis/package_database_lookup_error.hh>
-#include <paludis/join.hh>
-
-/** \file
- * Declarations for AmbiguousPackageNameError.
- *
- * \ingroup Exception
- * \ingroup Database
- */
-
-namespace paludis
-{
- /**
- * Thrown if a PackageDatabase query results in more than one matching
- * Package.
- *
- * \ingroup Exception
- * \ingroup Database
- */
- class AmbiguousPackageNameError : public PackageDatabaseLookupError
- {
- public:
- /**
- * Constructor.
- */
- template <typename I_>
- AmbiguousPackageNameError(const std::string & name,
- I_ begin, const I_ end) throw ();
- };
-
- template <typename I_>
- AmbiguousPackageNameError::AmbiguousPackageNameError(const std::string & name,
- I_ begin, const I_ end) throw () :
- PackageDatabaseLookupError("Ambiguous package name '" + name + "' (candidates are " +
- join(begin, end, ", ") + ")")
- {
- }
-}
-
-#endif
diff --git a/paludis/duplicate_repository_error.cc b/paludis/duplicate_repository_error.cc
deleted file mode 100644
index ee379af..0000000
--- a/paludis/duplicate_repository_error.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "duplicate_repository_error.hh"
-
-using namespace paludis;
-
-DuplicateRepositoryError::DuplicateRepositoryError(const std::string & name) throw () :
- PackageDatabaseError("A repository named '" + name + "' already exists")
-{
-}
-
diff --git a/paludis/duplicate_repository_error.hh b/paludis/duplicate_repository_error.hh
deleted file mode 100644
index 8776a4f..0000000
--- a/paludis/duplicate_repository_error.hh
+++ /dev/null
@@ -1,45 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_DUPLICATE_REPOSITORY_ERROR_HH
-#define PALUDIS_GUARD_PALUDIS_DUPLICATE_REPOSITORY_ERROR_HH 1
-
-#include <paludis/package_database_error.hh>
-
-/** \file
- * Declarations for the DuplicateRepositoryError class.
- */
-
-namespace paludis
-{
- /**
- * Thrown if a Repository with the same name as an existing member is added
- * to a PackageDatabase.
- */
- class DuplicateRepositoryError : public PackageDatabaseError
- {
- public:
- /**
- * Constructor.
- */
- DuplicateRepositoryError(const std::string & name) throw ();
- };
-}
-
-#endif
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 57a2aa8..a004000 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -20,7 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_ENVIRONMENT_HH
#define PALUDIS_GUARD_PALUDIS_ENVIRONMENT_HH 1
-#include <paludis/package_database_entry.hh>
#include <paludis/package_database.hh>
#include <paludis/use_flag_name.hh>
#include <paludis/keyword_name.hh>
@@ -36,8 +35,6 @@
namespace paludis
{
- class PackageDatabase;
-
/**
* Represents a working environment, which contains an available packages
* database and an installed packages database and provides various methods
diff --git a/paludis/files.m4 b/paludis/files.m4
index 19f1bc6..e466d31 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -10,7 +10,6 @@ dnl on this file at present...
add(`about', `hh', `test')
add(`all_dep_atom', `hh', `cc')
-add(`ambiguous_package_name_error', `hh', `cc')
add(`any_dep_atom', `hh', `cc')
add(`attributes', `hh', `cc')
add(`bad_version_spec_error', `hh', `cc')
@@ -43,7 +42,6 @@ add(`dep_string_nesting_error', `hh', `cc')
add(`dep_string_parse_error', `hh', `cc')
add(`dir_iterator', `hh', `cc')
add(`dir_open_error', `hh', `cc')
-add(`duplicate_repository_error', `hh', `cc')
add(`environment', `hh', `cc')
add(`exception', `hh', `cc')
add(`fake_repository', `hh', `cc')
@@ -62,14 +60,7 @@ add(`keyword_name', `hh', `cc')
add(`line_config_file', `hh', `cc', `test')
add(`mask_reasons', `hh', `cc')
add(`name_error', `hh', `cc')
-add(`no_such_package_error', `hh', `cc')
-add(`no_such_repository_error', `hh', `cc')
-add(`no_such_version_error', `hh', `cc')
add(`package_database', `hh', `cc', `test')
-add(`package_database_entry', `hh', `cc')
-add(`package_database_entry_collection', `hh', `cc')
-add(`package_database_error', `hh', `cc')
-add(`package_database_lookup_error', `hh', `cc')
add(`package_dep_atom', `hh', `cc')
add(`package_name_part', `hh', `cc', `test')
add(`package_name_part_collection', `hh', `cc')
diff --git a/paludis/no_such_package_error.cc b/paludis/no_such_package_error.cc
deleted file mode 100644
index b43cd0c..0000000
--- a/paludis/no_such_package_error.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "no_such_package_error.hh"
-
-using namespace paludis;
-
-NoSuchPackageError::NoSuchPackageError(const std::string & name) throw () :
- PackageDatabaseLookupError("Could not find '" + name + "'")
-{
-}
-
diff --git a/paludis/no_such_package_error.hh b/paludis/no_such_package_error.hh
deleted file mode 100644
index ca9d26e..0000000
--- a/paludis/no_such_package_error.hh
+++ /dev/null
@@ -1,45 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_NO_SUCH_PACKAGE_ERROR_HH
-#define PALUDIS_GUARD_PALUDIS_NO_SUCH_PACKAGE_ERROR_HH 1
-
-#include <paludis/package_database_lookup_error.hh>
-
-/** \file
- * Declaration for the NoSuchPackageError exception class.
- */
-
-namespace paludis
-{
- /**
- * Thrown if there is no Package in a PackageDatabase with the given
- * name.
- */
- class NoSuchPackageError : public PackageDatabaseLookupError
- {
- public:
- /**
- * Constructor.
- */
- NoSuchPackageError(const std::string & name) throw ();
- };
-}
-
-#endif
diff --git a/paludis/no_such_repository_error.cc b/paludis/no_such_repository_error.cc
deleted file mode 100644
index a3cf719..0000000
--- a/paludis/no_such_repository_error.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "no_such_repository_error.hh"
-
-using namespace paludis;
-
-NoSuchRepositoryError::NoSuchRepositoryError(const std::string & name) throw () :
- PackageDatabaseLookupError("Could not find repository '" + name + "'")
-{
-}
-
diff --git a/paludis/no_such_repository_error.hh b/paludis/no_such_repository_error.hh
deleted file mode 100644
index acd3256..0000000
--- a/paludis/no_such_repository_error.hh
+++ /dev/null
@@ -1,45 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_NO_SUCH_REPOSITORY_ERROR_HH
-#define PALUDIS_GUARD_PALUDIS_NO_SUCH_REPOSITORY_ERROR_HH 1
-
-#include <paludis/package_database_lookup_error.hh>
-
-/** \file
- * Declaration for the NoSuchRepositoryError exception class.
- */
-
-namespace paludis
-{
- /**
- * Thrown if there is no Repository in a RepositoryDatabase with the given
- * name.
- */
- class NoSuchRepositoryError : public PackageDatabaseLookupError
- {
- public:
- /**
- * Constructor.
- */
- NoSuchRepositoryError(const std::string & name) throw ();
- };
-}
-
-#endif
diff --git a/paludis/no_such_version_error.cc b/paludis/no_such_version_error.cc
deleted file mode 100644
index bb81d75..0000000
--- a/paludis/no_such_version_error.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "no_such_version_error.hh"
-#include "stringify.hh"
-
-using namespace paludis;
-
-NoSuchVersionError::NoSuchVersionError(const std::string & name,
- const VersionSpec & version) throw () :
- PackageDatabaseLookupError("No version of '" + name + "' named '" + stringify(version) + "'")
-{
-}
-
diff --git a/paludis/no_such_version_error.hh b/paludis/no_such_version_error.hh
deleted file mode 100644
index 7b99b16..0000000
--- a/paludis/no_such_version_error.hh
+++ /dev/null
@@ -1,47 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_NO_SUCH_VERSION_ERROR_HH
-#define PALUDIS_GUARD_PALUDIS_NO_SUCH_VERSION_ERROR_HH 1
-
-#include <paludis/package_database_lookup_error.hh>
-#include <paludis/version_spec.hh>
-
-/** \file
- * Declaration for the NoSuchVersionError exception class.
- */
-
-namespace paludis
-{
- /**
- * Thrown if there is no Version in a PackageDatabase with the given
- * name.
- */
- class NoSuchVersionError : public PackageDatabaseLookupError
- {
- public:
- /**
- * Constructor.
- */
- NoSuchVersionError(const std::string & pkg_name,
- const VersionSpec & version) throw ();
- };
-}
-
-#endif
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index a40c74a..39887b4 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -18,11 +18,6 @@
*/
#include "package_database.hh"
-#include "no_such_package_error.hh"
-#include "no_such_repository_error.hh"
-#include "no_such_version_error.hh"
-#include "duplicate_repository_error.hh"
-#include "ambiguous_package_name_error.hh"
#include "package_dep_atom.hh"
#include "indirect_iterator.hh"
#include "stringify.hh"
@@ -33,6 +28,44 @@
using namespace paludis;
+std::ostream &
+paludis::operator<< (std::ostream & s, const PackageDatabaseEntry & v)
+{
+ s << v.get<pde_package>() << "-" << v.get<pde_version>() << "::" << v.get<pde_repository>();
+ return s;
+}
+
+PackageDatabaseError::PackageDatabaseError(const std::string & message) throw () :
+ Exception(message)
+{
+}
+
+PackageDatabaseLookupError::PackageDatabaseLookupError(const std::string & message) throw () :
+ PackageDatabaseError(message)
+{
+}
+
+DuplicateRepositoryError::DuplicateRepositoryError(const std::string & name) throw () :
+ PackageDatabaseError("A repository named '" + name + "' already exists")
+{
+}
+
+NoSuchPackageError::NoSuchPackageError(const std::string & name) throw () :
+ PackageDatabaseLookupError("Could not find '" + name + "'")
+{
+}
+
+NoSuchRepositoryError::NoSuchRepositoryError(const std::string & name) throw () :
+ PackageDatabaseLookupError("Could not find repository '" + name + "'")
+{
+}
+
+NoSuchVersionError::NoSuchVersionError(const std::string & name,
+ const VersionSpec & version) throw () :
+ PackageDatabaseLookupError("No version of '" + name + "' named '" + stringify(version) + "'")
+{
+}
+
namespace paludis
{
/**
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index 7fcdad2..b7634c5 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -20,20 +20,168 @@
#ifndef PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_HH
#define PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_HH 1
+#include <paludis/counted_ptr.hh>
+#include <paludis/exception.hh>
#include <paludis/instantiation_policy.hh>
+#include <paludis/package_dep_atom.hh>
#include <paludis/private_implementation_pattern.hh>
-#include <paludis/counted_ptr.hh>
+#include <paludis/qualified_package_name.hh>
#include <paludis/repository.hh>
+#include <paludis/smart_record.hh>
+#include <paludis/sorted_collection.hh>
#include <paludis/version_metadata.hh>
-#include <paludis/package_database_entry.hh>
-#include <paludis/package_database_entry_collection.hh>
-#include <paludis/package_dep_atom.hh>
-#include <paludis/repository.hh>
+#include <paludis/version_spec.hh>
+#include <paludis/join.hh>
+
+#include <ostream>
namespace paludis
{
class PackageDepAtom;
- class PackageDatabase;
+
+ /**
+ * Keys in a PackageDatabaseEntry.
+ */
+ enum PackageDatabaseEntryKeys
+ {
+ pde_package, ///< Our package
+ pde_version, ///< Our version
+ pde_repository, ///< Our repository
+ last_pde ///< Number of items
+ };
+
+ /**
+ * Tag for a PackageDatabaseEntry.
+ */
+ struct PackageDatabaseEntryTag :
+ SmartRecordTag<comparison_mode::FullComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
+ SmartRecordKeys<PackageDatabaseEntryKeys, last_pde>,
+ SmartRecordKey<pde_package, QualifiedPackageName>,
+ SmartRecordKey<pde_version, VersionSpec>,
+ SmartRecordKey<pde_repository, RepositoryName>
+ {
+ };
+
+ /**
+ * A PackageDatabaseEntry holds a QualifiedPackageName, a VersionSpec and a
+ * RepositoryName, and is fully comparable.
+ */
+ typedef MakeSmartRecord<PackageDatabaseEntryTag>::Type PackageDatabaseEntry;
+
+ /**
+ * A collection of PackageDatabaseEntry instances.
+ */
+ typedef SortedCollection<PackageDatabaseEntry> PackageDatabaseEntryCollection;
+
+ /**
+ * A PackageDatabaseEntry can be written to a stream.
+ */
+ std::ostream & operator<< (std::ostream &, const PackageDatabaseEntry &);
+
+ /**
+ * A PackageDatabaseError is an error that occurs when performing some
+ * operation upon a PackageDatabase.
+ */
+ class PackageDatabaseError : public Exception
+ {
+ protected:
+ /**
+ * Constructor.
+ */
+ PackageDatabaseError(const std::string & message) throw ();
+ };
+
+ /**
+ * A PackageDatabaseLookupError descendent is thrown if an error occurs
+ * when looking for something in a PackageDatabase.
+ */
+ class PackageDatabaseLookupError : public PackageDatabaseError
+ {
+ protected:
+ /**
+ * Constructor.
+ */
+ PackageDatabaseLookupError(const std::string & message) throw ();
+ };
+
+ /**
+ * Thrown if a PackageDatabase query results in more than one matching
+ * Package.
+ *
+ * \ingroup Exception
+ * \ingroup Database
+ */
+ class AmbiguousPackageNameError : public PackageDatabaseLookupError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ template <typename I_>
+ AmbiguousPackageNameError(const std::string & name,
+ I_ begin, const I_ end) throw ();
+ };
+
+ template <typename I_>
+ AmbiguousPackageNameError::AmbiguousPackageNameError(const std::string & name,
+ I_ begin, const I_ end) throw () :
+ PackageDatabaseLookupError("Ambiguous package name '" + name + "' (candidates are " +
+ join(begin, end, ", ") + ")")
+ {
+ }
+
+ /**
+ * Thrown if a Repository with the same name as an existing member is added
+ * to a PackageDatabase.
+ */
+ class DuplicateRepositoryError : public PackageDatabaseError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ DuplicateRepositoryError(const std::string & name) throw ();
+ };
+
+ /**
+ * Thrown if there is no Package in a PackageDatabase with the given
+ * name.
+ */
+ class NoSuchPackageError : public PackageDatabaseLookupError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ NoSuchPackageError(const std::string & name) throw ();
+ };
+
+ /**
+ * Thrown if there is no Repository in a RepositoryDatabase with the given
+ * name.
+ */
+ class NoSuchRepositoryError : public PackageDatabaseLookupError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ NoSuchRepositoryError(const std::string & name) throw ();
+ };
+
+ /**
+ * Thrown if there is no Version in a PackageDatabase with the given
+ * name.
+ */
+ class NoSuchVersionError : public PackageDatabaseLookupError
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ NoSuchVersionError(const std::string & pkg_name,
+ const VersionSpec & version) throw ();
+ };
/**
* A PackageDatabase can be queried for Package instances.
diff --git a/paludis/package_database_entry.cc b/paludis/package_database_entry.cc
deleted file mode 100644
index 32155f5..0000000
--- a/paludis/package_database_entry.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "package_database_entry.hh"
-#include "package_database.hh"
-
-using namespace paludis;
-
-std::ostream &
-paludis::operator<< (std::ostream & s, const PackageDatabaseEntry & v)
-{
- s << v.get<pde_package>() << "-" << v.get<pde_version>() << "::" << v.get<pde_repository>();
- return s;
-}
diff --git a/paludis/package_database_entry.hh b/paludis/package_database_entry.hh
deleted file mode 100644
index b01bdb7..0000000
--- a/paludis/package_database_entry.hh
+++ /dev/null
@@ -1,74 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_ENTRY_HH
-#define PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_ENTRY_HH 1
-
-#include <paludis/qualified_package_name.hh>
-#include <paludis/version_spec.hh>
-#include <paludis/repository.hh>
-#include <paludis/smart_record.hh>
-#include <ostream>
-
-/** \file
- * Declarations for the PackageDatabaseEntry class.
- *
- * \ingroup Database
- */
-
-namespace paludis
-{
- class PackageDatabase;
-
- /**
- * Keys in a PackageDatabaseEntry.
- */
- enum PackageDatabaseEntryKeys
- {
- pde_package, ///< Our package
- pde_version, ///< Our version
- pde_repository, ///< Our repository
- last_pde ///< Number of items
- };
-
- /**
- * Tag for a PackageDatabaseEntry.
- */
- struct PackageDatabaseEntryTag :
- SmartRecordTag<comparison_mode::FullComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
- SmartRecordKeys<PackageDatabaseEntryKeys, last_pde>,
- SmartRecordKey<pde_package, QualifiedPackageName>,
- SmartRecordKey<pde_version, VersionSpec>,
- SmartRecordKey<pde_repository, RepositoryName>
- {
- };
-
- /**
- * A PackageDatabaseEntry holds a QualifiedPackageName, a VersionSpec and a
- * RepositoryName, and is fully comparable.
- */
- typedef MakeSmartRecord<PackageDatabaseEntryTag>::Type PackageDatabaseEntry;
-
- /**
- * A PackageDatabaseEntry can be written to a stream.
- */
- std::ostream & operator<< (std::ostream &, const PackageDatabaseEntry &);
-}
-
-#endif
diff --git a/paludis/package_database_entry_collection.cc b/paludis/package_database_entry_collection.cc
deleted file mode 100644
index 485c7eb..0000000
--- a/paludis/package_database_entry_collection.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "package_database_entry_collection.hh"
-
diff --git a/paludis/package_database_entry_collection.hh b/paludis/package_database_entry_collection.hh
deleted file mode 100644
index eff093d..0000000
--- a/paludis/package_database_entry_collection.hh
+++ /dev/null
@@ -1,50 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_ENTRY_COLLECTION_HH
-#define PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_ENTRY_COLLECTION_HH 1
-
-#include <paludis/package_database_entry.hh>
-#include <paludis/sorted_collection.hh>
-
-namespace paludis
-{
- /**
- * A collection of PackageDatabaseEntry instances.
- */
- class PackageDatabaseEntryCollection : public SortedCollection<PackageDatabaseEntry>
- {
- public:
- /**
- * Constructor.
- */
- PackageDatabaseEntryCollection()
- {
- }
-
- /**
- * Destructor.
- */
- virtual ~PackageDatabaseEntryCollection()
- {
- }
- };
-}
-
-#endif
diff --git a/paludis/package_database_error.cc b/paludis/package_database_error.cc
deleted file mode 100644
index e3b338d..0000000
--- a/paludis/package_database_error.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "package_database_error.hh"
-
-using namespace paludis;
-
-PackageDatabaseError::PackageDatabaseError(const std::string & message) throw () :
- Exception(message)
-{
-}
-
diff --git a/paludis/package_database_error.hh b/paludis/package_database_error.hh
deleted file mode 100644
index 5d919e4..0000000
--- a/paludis/package_database_error.hh
+++ /dev/null
@@ -1,41 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_ERROR_HH
-#define PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_ERROR_HH 1
-
-#include <paludis/exception.hh>
-
-namespace paludis
-{
- /**
- * A PackageDatabaseError is an error that occurs when performing some
- * operation upon a PackageDatabase.
- */
- class PackageDatabaseError : public Exception
- {
- protected:
- /**
- * Constructor.
- */
- PackageDatabaseError(const std::string & message) throw ();
- };
-}
-
-#endif
diff --git a/paludis/package_database_lookup_error.cc b/paludis/package_database_lookup_error.cc
deleted file mode 100644
index 190a9e4..0000000
--- a/paludis/package_database_lookup_error.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "package_database_lookup_error.hh"
-
-using namespace paludis;
-
-PackageDatabaseLookupError::PackageDatabaseLookupError(const std::string & message) throw () :
- PackageDatabaseError(message)
-{
-}
-
diff --git a/paludis/package_database_lookup_error.hh b/paludis/package_database_lookup_error.hh
deleted file mode 100644
index 94a7c6d..0000000
--- a/paludis/package_database_lookup_error.hh
+++ /dev/null
@@ -1,41 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_LOOKUP_ERROR_HH
-#define PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_LOOKUP_ERROR_HH 1
-
-#include <paludis/package_database_error.hh>
-
-namespace paludis
-{
- /**
- * A PackageDatabaseLookupError descendent is thrown if an error occurs
- * when looking for something in a PackageDatabase.
- */
- class PackageDatabaseLookupError : public PackageDatabaseError
- {
- protected:
- /**
- * Constructor.
- */
- PackageDatabaseLookupError(const std::string & message) throw ();
- };
-}
-
-#endif