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

Specials.h

Go to the documentation of this file.
00001 #ifndef DEBTAGS_TODO_H
00002 #define DEBTAGS_TODO_H
00003 
00004 /*
00005  * Various classes that can be used to find areas of Debtags that still need
00006  * work
00007  *
00008  * Copyright (C) 2003,2004,2005  Enrico Zini <enrico@debian.org>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023  */
00024 
00025 #include <debtags/Tag.h>
00026 #include <debtags/Filters.h>
00027 #include <debtags/Status.h>
00028 #include <tagcoll/CardinalityStore.h>
00029 #include <map>
00030 
00031 
00032 namespace Debtags
00033 {
00034 
00044 template <class ITEM>
00045 class Specials : public Tagcoll::Consumer<ITEM, Tag>
00046 {
00047 protected:
00048     Tagcoll::CardinalityStore<ITEM, Facet> coll;
00049     TagToFacet<ITEM> tagStripper;
00050     unsigned int maxPerGroup;
00051     bool computed;
00052 
00053     virtual void consumeItemUntagged(const ITEM& item)
00054     {
00055         tagStripper.consume(item);
00056     }
00057     virtual void consumeItem(const ITEM& item, const Tagcoll::OpSet<Tag>& tags)
00058     {
00059         tagStripper.consume(item, tags);
00060     }
00061     virtual void consumeItemsUntagged(const Tagcoll::OpSet<ITEM>& items)
00062     {
00063         tagStripper.consume(items);
00064     }
00065     virtual void consumeItems(const Tagcoll::OpSet<ITEM>& items, const Tagcoll::OpSet<Tag>& tags)
00066     {
00067         tagStripper.consume(items, tags);
00068     }
00069 
00070 public:
00071     Specials(unsigned int maxPerGroup = 0) :
00072         tagStripper(coll), maxPerGroup(maxPerGroup), computed(false) {}
00073     virtual ~Specials() {}
00074     
00075     bool isComputed() const { return computed; }
00076     void compute(Status* tracker = 0);
00077     void clear()
00078     {
00079         coll = Tagcoll::CardinalityStore<ITEM, Facet>(); specials.clear();
00080         computed = false;
00081     }
00082 
00083     std::map<Facet, Tagcoll::OpSet<ITEM> > specials;
00084 };
00085 
00086 }
00087 
00088 // vim:set ts=4 sw=4:
00089 #endif

Generated on Sat Sep 10 03:47:41 2005 for libdebtags by  doxygen 1.4.4