00001 #ifndef DEBTAGS_PACKAGE_SET_H 00002 #define DEBTAGS_PACKAGE_SET_H 00003 00004 /* 00005 * Central class to perform package searches 00006 * 00007 * Copyright (C) 2003 Enrico Zini <enrico@debian.org> 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 */ 00023 00024 #pragma interface 00025 00026 #include <debtags/Package.h> 00027 #include <debtags/Consumer.h> 00028 00029 #include <tagcoll/OpSet.h> 00030 00031 namespace Tagcoll 00032 { 00033 class FacetSet; 00034 class TagSet; 00035 }; 00036 00037 namespace Debtags 00038 { 00039 using namespace Tagcoll; 00040 class Maintainer; 00041 class MaintainerSet; 00042 00043 class PackageSet : public OpSet<Debtags::Package>, public PackageConsumer 00044 { 00045 public: 00046 using OpSet<Debtags::Package>::find; 00047 00048 PackageSet() throw (); 00049 PackageSet(const OpSet<Debtags::Package>&) throw (); 00050 virtual ~PackageSet() throw (); 00051 00052 virtual void consume(const Package& pkg) throw (); 00053 00054 // Get a list of all facets in these packages 00055 FacetSet getFacets() const throw (); 00056 00057 // Get a list of all tags in these packages 00058 TagSet getTags() const throw (); 00059 00060 // Get a list of all the maintainers of these packages 00061 MaintainerSet getMaintainers() const throw (); 00062 00063 // Get the set of all tags in this collection that appear in tagsets 00064 // containing `ts' 00065 Debtags::TagSet getCompanionTags(const Debtags::TagSet& ts) const throw (); 00066 00067 // Get the Package object given the package name 00068 Package find(const std::string& name) const throw (); 00069 00070 // Get the Maintainer object given the maintainers's e-mail 00071 Maintainer findMaintainer(const std::string& email) const throw (); 00072 00073 // Output the whole package list to `cons' 00074 void output(PackageConsumer& cons) const throw (); 00075 00076 // Output the filtered package list to `cons' 00077 void output(PackageConsumer& cons, PackageMatcher& filter) const throw (); 00078 00079 // Get the packages that are matched by `filter' 00080 PackageSet getFiltered(PackageMatcher& filter) const throw (); 00081 00082 // Get the PackageSet of packages related to `pivot' 00083 PackageSet getRelated(const Package& pivot, int distance = 1) const throw (); 00084 00085 // Get the PackageSet of packages related to the specific tagset 00086 PackageSet getRelated(const Debtags::TagSet& ts, int distance = 1) const throw (); 00087 00088 // Output list of packages related to `pivot' to `cons' 00089 void outputRelated(PackageConsumer& cons, const Package& pivot, int distance = 1) const throw (); 00090 00091 // Output list of packages related to the specific tagset to `cons' 00092 void outputRelated(PackageConsumer& cons, const Debtags::TagSet& ts, int distance = 1) const throw (); 00093 }; 00094 00095 }; 00096 00097 // vim:set ts=4 sw=4: 00098 #endif