[280] | 1 | #ifndef RTAGCOLFILTER_H |
---|
| 2 | #define RTAGCOLFILTER_H |
---|
| 3 | |
---|
| 4 | #ifdef HAVE_DEBTAG |
---|
| 5 | |
---|
| 6 | /* |
---|
| 7 | * Represent a list of tag substitutions to apply as a TagcollFilter |
---|
| 8 | * |
---|
| 9 | * Copyright (C) 2003 Enrico Zini <enrico@debian.org> |
---|
| 10 | * |
---|
| 11 | * This library is free software; you can redistribute it and/or |
---|
| 12 | * modify it under the terms of the GNU Lesser General Public |
---|
| 13 | * License as published by the Free Software Foundation; either |
---|
| 14 | * version 2.1 of the License, or (at your option) any later version. |
---|
| 15 | * |
---|
| 16 | * This library is distributed in the hope that it will be useful, |
---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
| 19 | * Lesser General Public License for more details. |
---|
| 20 | * |
---|
| 21 | * You should have received a copy of the GNU Lesser General Public |
---|
| 22 | * License along with this library; if not, write to the Free Software |
---|
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 24 | */ |
---|
| 25 | |
---|
| 26 | //#pragma interface |
---|
| 27 | |
---|
| 28 | #include <TagcollConsumer.h> |
---|
| 29 | #include <TagcollFilter.h> |
---|
| 30 | |
---|
| 31 | #include <map> |
---|
| 32 | #include <string> |
---|
| 33 | #include "rpackage.h" |
---|
| 34 | #include "rpackagelister.h" |
---|
| 35 | |
---|
| 36 | class RTagcollFilter:public TagcollFilter<std::string> { |
---|
| 37 | protected: |
---|
| 38 | RPackageLister *_lister; |
---|
| 39 | |
---|
| 40 | public: |
---|
| 41 | RTagcollFilter(RPackageLister *lister) throw() |
---|
| 42 | : _lister(lister) { |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | virtual void consume(const std::string &item) throw() { |
---|
| 46 | // make sure that only elements we know about are displayed |
---|
| 47 | // this should really use getElementInDisplayList |
---|
| 48 | if (_lister->getElement(item) != NULL) |
---|
| 49 | consumer->consume(item); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | virtual void consume(const std::string &item, |
---|
| 53 | const OpSet<std::string> &tags) throw() { |
---|
| 54 | // make sure that only elements we know about are displayed |
---|
| 55 | // this should really use getElementInDisplayList |
---|
| 56 | if (_lister->getElement(item) != NULL) |
---|
| 57 | consumer->consume(item, tags); |
---|
| 58 | } |
---|
| 59 | }; |
---|
| 60 | |
---|
| 61 | // vim:set ts=4 sw=4: |
---|
| 62 | |
---|
| 63 | #endif // HAVE_DEBTAGS |
---|
| 64 | #endif |
---|