Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

Consumer.h

Go to the documentation of this file.
00001 #ifndef DEBTAGS_CONSUMER_H
00002 #define DEBTAGS_CONSUMER_H
00003 
00004 /*
00005  * Package stream consumer and filter interfaces
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 <tagcoll/TagConsumer.h>
00027 #include <string>
00028 
00029 namespace Tagcoll
00030 {
00031 class Facet;
00032 class Tag;
00033 class TagSet;
00034 };
00035 
00036 namespace Debtags
00037 {
00038 using namespace Tagcoll;
00039 
00040 class Package;
00041 class Maintainer;
00042 
00043 typedef Consumer<Package> PackageConsumer;
00044 typedef Consumer<Maintainer> MaintainerConsumer;
00045 
00046 class PackageMatcher : public Matcher<Package>
00047 {
00048 public:
00049     // Compute values useful in deciding search strategies
00050     virtual bool hasDebtags() const throw () = 0;
00051     virtual bool hasOnlyName() const throw () = 0;
00052     virtual bool hasOnlyMaintainer() const throw () = 0;
00053     virtual bool isMaintainerSignificant() const throw () = 0;
00054     virtual bool hasOnlyDebtags() const throw () = 0;
00055     virtual bool hasNonDebtags() const throw () = 0;
00056 
00057     // Partial matches useful in optimized searches
00058     virtual bool matchName(const std::string& text) const throw () = 0;
00059     virtual bool matchMaintainer(const std::string& text) const throw () = 0;
00060     virtual const TagSet& debtagsTagset() const throw () = 0;
00061 };
00062 
00063 class MaintainerMatcher : public Matcher<Maintainer> {};
00064 
00065 
00066 class PackageFilter : public Filter<Package>
00067 {
00068     PackageFilter(PackageConsumer& next) throw () : Filter<Package>(next) {}
00069 };
00070 
00071 class MaintainerFilter : public Filter<Maintainer>
00072 {
00073 public:
00074     MaintainerFilter(MaintainerConsumer& next) throw () : Filter<Maintainer>(next) {}
00075 };
00076 
00077 
00078 class PackageMatcherFilter : public MatcherFilter<Package>
00079 {
00080 public:
00081     PackageMatcherFilter(PackageMatcher& matcher, PackageConsumer& next) throw ()
00082         : MatcherFilter<Package>(matcher, next) {}
00083 };
00084 
00085 class MaintainerMatcherFilter : public MatcherFilter<Maintainer>
00086 {
00087 public:
00088     MaintainerMatcherFilter(MaintainerMatcher& matcher, MaintainerConsumer& next) throw ()
00089         : MatcherFilter<Maintainer>(matcher, next) {}
00090 };
00091 
00092 };
00093 
00094 // vim:set ts=4 sw=4:
00095 #endif

Generated on Sat Mar 19 11:31:46 2005 for libdebtags by  doxygen 1.4.1