[Debtags-commits] [svn] r1686 - in tagcoll/2.0: . tagcoll
Enrico Zini
enrico at costa.debian.org
Tue May 2 00:55:03 UTC 2006
Author: enrico
Date: Tue May 2 00:55:02 2006
New Revision: 1686
Modified:
tagcoll/2.0/ (props changed)
tagcoll/2.0/tagcoll/Expression.cc
tagcoll/2.0/tagcoll/Expression.h
tagcoll/2.0/tagcoll/Filter.cc
Log:
r2541 at viaza: enrico | 2006-05-02 02:53:12 +0200
Tests pass
Modified: tagcoll/2.0/tagcoll/Expression.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Expression.cc (original)
+++ tagcoll/2.0/tagcoll/Expression.cc Tue May 2 00:55:02 2006
@@ -293,7 +293,7 @@
"d: c::D, e::F\n"
);
InputMerger<string, string> result;
- parseCollection(input_coll, filterItemsByExpression(
+ parseCollection(input_coll, filterTagsByExpression(
"*::D || e::F || c", consumer(result)));
InputMerger<string, string> reference;
Modified: tagcoll/2.0/tagcoll/Expression.h
==============================================================================
--- tagcoll/2.0/tagcoll/Expression.h (original)
+++ tagcoll/2.0/tagcoll/Expression.h Tue May 2 00:55:02 2006
@@ -24,7 +24,7 @@
#include <string>
#include <set>
#include <map>
-#include <vector>
+#include <wibble/singleton.h>
namespace tagcoll
{
@@ -289,21 +289,22 @@
// output iterator interface
- FilterTagsByExpression& operator++() const { return *this; }
+ FilterTagsByExpression& operator++() { return *this; }
template<typename Items, typename Tags>
FilterTagsByExpression& operator=(const std::pair<Items, Tags>& data)
{
+ // TODO:
// We can use a vector since we know the input is sorted, and we
// remove elements without altering the order of the remaining ones
- std::vector<typename Tags::value_type> filtered;
+ std::set<typename Tags::value_type> filtered;
bool changed = false;
- for (typename Tags::iterator i = data.second.begin();
+ for (typename Tags::const_iterator i = data.second.begin();
i != data.second.end(); ++i)
{
- if (match(*i))
- filtered.push_back(*i);
+ if (match(wibble::singleton(*i)))
+ filtered.insert(*i);
else
changed = true;
}
Modified: tagcoll/2.0/tagcoll/Filter.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Filter.cc (original)
+++ tagcoll/2.0/tagcoll/Filter.cc Tue May 2 00:55:02 2006
@@ -54,15 +54,15 @@
{
// fprintf(stderr, "Fancuno\n");
// std::cerr << "adding untagged" << std::endl;
- OpSet<string> tags;
- tags += "untagged";
+ std::set<string> tags;
+ tags.insert("untagged");
consumer->consume(item, tags);
}
- virtual void consumeItem(const std::string& item, const OpSet<std::string>& tags)
+ virtual void consumeItem(const std::string& item, const std::set<std::string>& tags)
{
// fprintf(stderr, "Fancdue\n");
- OpSet<string> tags1;
- for (OpSet<string>::const_iterator i = tags.begin();
+ std::set<string> tags1;
+ for (std::set<string>::const_iterator i = tags.begin();
i != tags.end(); i++)
if (*i == "removeme")
// std::cerr << "Removing removeme from " << item << std::endl;
@@ -70,13 +70,13 @@
else if (*i == "add")
{
// std::cerr << "Adding " << toadd << " to " << item << std::endl;
- tags1 += toadd;
- tags1 += *i;
+ tags1.insert(toadd);
+ tags1.insert(*i);
}
else
{
// std::cerr << "Passing " << *i << " on for " << item << std::endl;
- tags1 += *i;
+ tags1.insert(*i);
}
if (tags1.empty())
More information about the Debtags-commits
mailing list