1 : /** \file
2 : * Match tag expressions against sets of Debtags Tags
3 : */
4 :
5 : /*
6 : * Copyright (C) 2003,2004,2005,2006,2007 Enrico Zini <enrico@debian.org>
7 : *
8 : * This program is free software; you can redistribute it and/or modify
9 : * it under the terms of the GNU General Public License as published by
10 : * the Free Software Foundation; either version 2 of the License, or
11 : * (at your option) any later version.
12 : *
13 : * This program is distributed in the hope that it will be useful,
14 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 : * GNU General Public License for more details.
17 : *
18 : * You should have received a copy of the GNU General Public License
19 : * along with this program; if not, write to the Free Software
20 : * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 : */
22 :
23 : #include <ept/debtags/expression.h>
24 : #include <string>
25 :
26 : namespace tagcoll
27 : {
28 :
29 : template<>
30 12 : bool Expression::operator()(const std::set<ept::debtags::Tag>& tags) const
31 : {
32 12 : std::set<std::string> names;
33 48 : for (std::set<ept::debtags::Tag>::const_iterator i = tags.begin();
34 : i != tags.end(); ++i)
35 36 : names.insert(i->fullname());
36 12 : return this->m_impl->eval(names);
37 : }
38 :
39 : template<>
40 : bool Expression::operator()(const std::set<ept::debtags::Facet>& tags) const
41 : {
42 : std::set<std::string> names;
43 : for (std::set<ept::debtags::Facet>::const_iterator i = tags.begin();
44 : i != tags.end(); ++i)
45 : names.insert(i->name());
46 : return this->m_impl->eval(names);
47 : }
48 :
49 : };
50 :
51 : // vim:set ts=4 sw=4:
|