[Debtags-commits] [svn] r1687 - in tagcoll/2.0: . tools

Enrico Zini enrico at costa.debian.org
Tue May 2 00:58:43 UTC 2006


Author: enrico
Date: Tue May  2 00:58:42 2006
New Revision: 1687

Modified:
   tagcoll/2.0/   (props changed)
   tagcoll/2.0/Makefile.am
   tagcoll/2.0/tools/tagcoll.cc
Log:
 r2546 at viaza:  enrico | 2006-05-02 02:57:18 +0200
 Various updates to tagcoll.cc, but it doesn't build yet


Modified: tagcoll/2.0/Makefile.am
==============================================================================
--- tagcoll/2.0/Makefile.am	(original)
+++ tagcoll/2.0/Makefile.am	Tue May  2 00:58:42 2006
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-SUBDIRS = tagcoll tests tools bench doc .
+SUBDIRS = tagcoll tools tests bench doc .
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA=libtagcoll.pc

Modified: tagcoll/2.0/tools/tagcoll.cc
==============================================================================
--- tagcoll/2.0/tools/tagcoll.cc	(original)
+++ tagcoll/2.0/tools/tagcoll.cc	Tue May  2 00:58:42 2006
@@ -37,6 +37,7 @@
 #include <stdlib.h>	// getenv
 
 #include <wibble/exception.h>
+#include <wibble/operators.h>
 #include <tagcoll/stringf.h>
 
 #include <tagcoll/CardinalityStore.h>
@@ -62,6 +63,7 @@
 
 using namespace std;
 using namespace tagcoll;
+using namespace wibble::operators;
 
 
 bool isdir(const std::string& file)
@@ -83,7 +85,7 @@
 
 void printNode(HierarchyNode<string, string>* node, string prefix = "")
 {
-	OpSet<string> items = node->getItems();
+	std::set<string> items = node->getItems();
 	if (!items.empty())
 	{
 		printItems(items, prefix + ": ");
@@ -101,13 +103,13 @@
 	}
 }
 
-OpSet<string> getItems(HierarchyNode<string, string>* node)
+std::set<string> getItems(HierarchyNode<string, string>* node)
 {
-	OpSet<string> items = node->getItems();
+	std::set<string> items = node->getItems();
 	
 	for (HierarchyNode<string, string>::iterator i = node->begin();
 			i != node->end(); i++)
-		items += getItems(*i);
+		items |= getItems(*i);
 
 	return items;
 }
@@ -117,12 +119,12 @@
 	if (file == "-")
 	{
 		StdioParserInput input(stdin, "<stdin>");
-		TextFormat<string, string>::parse(input, consumer(builder));
+		textformat::parse(input, consumer(builder));
 	}
 	else
 	{
 		StdioParserInput input(file);
-		TextFormat<string, string>::parse(input, consumer(builder));
+		textformat::parse(input, consumer(builder));
 	}
 }
 
@@ -133,7 +135,7 @@
 	if (file == "-")
 	{
 		StdioParserInput input(stdin, "<stdin>");
-		return TextFormat<string, string>::parsePatch(conv, conv, input);
+		return textformat::parsePatch(conv, conv, input);
 	}
 	else if (isdir(file))
 	{
@@ -146,7 +148,7 @@
 			if (d->d_name[0] == '.')
 				continue;
 			StdioParserInput input(file + '/' + d->d_name);
-			patches.addPatch(TextFormat<string, string>::parsePatch(conv, conv, input));
+			patches.addPatch(textformat::parsePatch(conv, conv, input));
 		}
 		closedir(dir);
 		return patches;
@@ -154,7 +156,7 @@
 	else
 	{
 		StdioParserInput input(file);
-		return TextFormat<string, string>::parsePatch(conv, conv, input);
+		return textformat::parsePatch(conv, conv, input);
 	}
 }
 
@@ -254,15 +256,15 @@
 	{
 		this->consumer->consume(item);
 	}
-	virtual void consumeItem(const ITEM& item, const OpSet<TAG>& tags)
+	virtual void consumeItem(const ITEM& item, const std::set<TAG>& tags)
 	{
 		this->consumer->consume(item);
 	}
-	virtual void consumeItemsUntagged(const OpSet<ITEM>& items)
+	virtual void consumeItemsUntagged(const std::set<ITEM>& items)
 	{
 		this->consumer->consume(items);
 	}
-	virtual void consumeItem(const OpSet<ITEM>& items, const OpSet<TAG>& tags)
+	virtual void consumeItem(const std::set<ITEM>& items, const std::set<TAG>& tags)
 	{
 		this->consumer->consume(items);
 	}
@@ -281,17 +283,17 @@
 
 	virtual void consumeItemUntagged(const ITEM& item)
 	{
-		consumer->consume(reversedNull, OpSet<ITEM>() + item);
+		consumer->consume(reversedNull, std::set<ITEM>() + item);
 	}
-	virtual void consumeItem(const ITEM& item, const OpSet<TAG>& tags)
+	virtual void consumeItem(const ITEM& item, const std::set<TAG>& tags)
 	{
-		consumer->consume(tags, OpSet<ITEM>() + item);
+		consumer->consume(tags, std::set<ITEM>() + item);
 	}
-	virtual void consumeItemsUntagged(const OpSet<ITEM>& items)
+	virtual void consumeItemsUntagged(const std::set<ITEM>& items)
 	{
 		consumer->consume(reversedNull, items);
 	}
-	virtual void consumeItem(const OpSet<ITEM>& items, const OpSet<TAG>& tags)
+	virtual void consumeItem(const std::set<ITEM>& items, const std::set<TAG>& tags)
 	{
 		consumer->consume(tags, items);
 	}
@@ -417,7 +419,7 @@
 	}
 
 	/// Process a tagged item, with its tags
-	virtual void consumeItem(const string& item, const OpSet<string>& tags)
+	virtual void consumeItem(const string& item, const std::set<string>& tags)
 	{
 		if (itemsOnly)
 			consumeItemUntagged(item);
@@ -428,19 +430,19 @@
 	}
 
 	/// Process a set of items, all with no tags
-	virtual void consumeItemsUntagged(const OpSet<string>& items)
+	virtual void consumeItemsUntagged(const std::set<string>& items)
 	{
 		if (grouper)
 			grouper->consume(items);
 		else
 			// Explicitly split groups
-			for (OpSet<string>::const_iterator i = items.begin();
+			for (std::set<string>::const_iterator i = items.begin();
 					i != items.end(); i++)
 				output.consume(*i);
 	}
 
 	/// Process a set of items identically tagged, with their tags
-	virtual void consumeItems(const OpSet<string>& items, const OpSet<string>& tags)
+	virtual void consumeItems(const std::set<string>& items, const std::set<string>& tags)
 	{
 		if (itemsOnly)
 			consumeItemsUntagged(items);
@@ -448,7 +450,7 @@
 			grouper->consume(items, tags);
 		else
 			// Explicitly split groups
-			for (OpSet<string>::const_iterator i = items.begin();
+			for (std::set<string>::const_iterator i = items.begin();
 					i != items.end(); i++)
 				output.consume(*i, tags);
 	}
@@ -493,11 +495,11 @@
 			Implications<string> newImpls;
 
 			// Find tag implications
-			OpSet<string> allTags = coll.getAllTags();
-			for (OpSet<string>::const_iterator t = allTags.begin();
+			std::set<string> allTags = coll.getAllTags();
+			for (std::set<string>::const_iterator t = allTags.begin();
 					t != allTags.end(); t++)
 			{
-				OpSet<string> implied = coll.getImpliedBy(*t);
+				std::set<string> implied = coll.getImpliedBy(*t);
 				if (!implied.empty())
 					newImpls.consume(*t, implied);
 			}
@@ -593,7 +595,7 @@
 
 			// Get the tagset as the intersection of the tagsets of all input items
 			set<string>::const_iterator i = splititems.begin();
-			OpSet<string> ts = merger.getTags(*i);
+			std::set<string> ts = merger.getTags(*i);
 			for (++i; i != splititems.end(); i++)
 				ts = ts ^ merger.getTags(*i);
 
@@ -615,10 +617,10 @@
 			if (maxdist)
 			{
 				// Get the related tagsets
-				list< OpSet<string> > rel = coll.getRelatedTagsets(ts, maxdist);
+				list< std::set<string> > rel = coll.getRelatedTagsets(ts, maxdist);
 
 				// Print the output list
-				for (list< OpSet<string> >::const_iterator i = rel.begin();
+				for (list< std::set<string> >::const_iterator i = rel.begin();
 						i != rel.end(); i++)
 					printItems(coll.getItemsExactMatch(*i));
 			}
@@ -656,21 +658,21 @@
 			// Default operation: build the smart hierarchy
 			SmartHierarchyNode<string, string> root("_top", coll, flattenThreshold);
 
-			OpSet<string> seen;
+			std::set<string> seen;
 			for (HierarchyNode<string, string>::iterator i = root.begin();
 					i != root.end(); i++)
 			{
-				OpSet<string> items = getItems(*i);
+				std::set<string> items = getItems(*i);
 
 				// Find the items in this branch that are not present in
 				// any of the previous ones
-				OpSet<string> newItems;
+				std::set<string> newItems;
 				if (!seen.empty())
 				{
-					for (OpSet<string>::const_iterator j = items.begin();
+					for (std::set<string>::const_iterator j = items.begin();
 							j != items.end(); j++)
 					{
-						OpSet<string> tags = coll.getTags(*j) ^ seen;
+						std::set<string> tags = coll.getTags(*j) ^ seen;
 						if (tags.empty())
 							newItems += *j;
 					}
@@ -679,7 +681,7 @@
 							PFSTR((*i)->tag()), items.size(), newItems.size());
 
 					int indent = (*i)->tag().size() + 2;
-					for (OpSet<string>::const_iterator j = newItems.begin(); j != newItems.end(); j++)
+					for (std::set<string>::const_iterator j = newItems.begin(); j != newItems.end(); j++)
 						printf("%*s%.*s\n", indent, "", PFSTR(*j));
 				}
 



More information about the Debtags-commits mailing list