[Debtags-commits] [svn] r1029 - libtagcoll1/trunk/tagcoll
Enrico Zini
enrico at costa.debian.org
Sun Jul 31 15:44:59 UTC 2005
Author: enrico
Date: Sun Jul 31 15:44:58 2005
New Revision: 1029
Modified:
libtagcoll1/trunk/tagcoll/ExpressionFilter.cc
libtagcoll1/trunk/tagcoll/ExpressionFilter.h
libtagcoll1/trunk/tagcoll/instantiations1.cc
Log:
Generalised ExpressionFilter on the tag part
Modified: libtagcoll1/trunk/tagcoll/ExpressionFilter.cc
==============================================================================
--- libtagcoll1/trunk/tagcoll/ExpressionFilter.cc (original)
+++ libtagcoll1/trunk/tagcoll/ExpressionFilter.cc Sun Jul 31 15:44:58 2005
@@ -27,14 +27,14 @@
using namespace std;
using namespace Tagcoll;
-template<class ITEM>
-bool ExpressionFilter<ITEM>::setExpression(const std::string& expression) throw ()
+template<class ITEM, class TAG>
+bool ExpressionFilter<ITEM, TAG>::setExpression(const std::string& expression)
{
return (expr = TagexprParser::instance()->parse(expression)) != 0;
}
-template<class ITEM>
-bool ExpressionFilter<ITEM>::match(const OpSet<string>& tags) const throw ()
+template<class ITEM, class TAG>
+bool ExpressionFilter<ITEM, TAG>::match(const OpSet<string>& tags) const
{
if (matchType == PLAIN)
return expr->eval(tags);
Modified: libtagcoll1/trunk/tagcoll/ExpressionFilter.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/ExpressionFilter.h (original)
+++ libtagcoll1/trunk/tagcoll/ExpressionFilter.h Sun Jul 31 15:44:58 2005
@@ -29,14 +29,14 @@
namespace Tagcoll
{
-template<class ITEM>
-class ExpressionFilter : public TagcollFilter<ITEM, std::string>
+template<class ITEM, class TAG>
+class ExpressionFilter : public TagcollFilter<ITEM, TAG>
{
protected:
Tagexpr* expr;
int matched;
- bool match(const OpSet<std::string>& ts) const throw ();
+ bool match(const OpSet<std::string>& ts) const;
public:
enum MatchType { PLAIN, INVERTED };
@@ -45,18 +45,18 @@
MatchType matchType;
public:
- ExpressionFilter() throw () : expr(0), matched(0), matchType(PLAIN) {}
- virtual ~ExpressionFilter() throw () { if (expr) delete expr; }
+ ExpressionFilter() : expr(0), matched(0), matchType(PLAIN) {}
+ virtual ~ExpressionFilter() { if (expr) delete expr; }
// Set the expression to use for this filter
// Return false if parsing the expression failed
- bool setExpression(const std::string& expression) throw ();
+ bool setExpression(const std::string& expression);
void setMatchType(MatchType type) throw () { matchType = type; }
int countMatched() const throw () { return matched; }
- virtual void consume(const ITEM& item) throw ()
+ virtual void consume(const ITEM& item)
{
if (match(OpSet<std::string>()))
{
@@ -65,7 +65,7 @@
}
}
- virtual void consume(const ITEM& item, const OpSet<std::string>& tags) throw ()
+ virtual void consume(const ITEM& item, const OpSet<TAG>& tags)
{
if (match(tags))
{
@@ -74,7 +74,7 @@
}
}
- virtual void consume(const OpSet<ITEM>& items) throw ()
+ virtual void consume(const OpSet<ITEM>& items)
{
if (match(OpSet<std::string>()))
{
@@ -83,7 +83,7 @@
}
}
- virtual void consume(const OpSet<ITEM>& items, const OpSet<std::string>& tags) throw ()
+ virtual void consume(const OpSet<ITEM>& items, const OpSet<TAG>& tags)
{
if (match(tags))
{
Modified: libtagcoll1/trunk/tagcoll/instantiations1.cc
==============================================================================
--- libtagcoll1/trunk/tagcoll/instantiations1.cc (original)
+++ libtagcoll1/trunk/tagcoll/instantiations1.cc Sun Jul 31 15:44:58 2005
@@ -28,7 +28,7 @@
//template class TagsToStrings<string>;
//template class TagsFromStrings<string>;
template class UnfacetedRemover<string>;
-template class ExpressionFilter<string>;
+template class ExpressionFilter<string, string>;
template class TextFormat<string, string>;
//template class TextFormat<string, Tag>;
More information about the Debtags-commits
mailing list