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

Enrico Zini enrico at costa.debian.org
Tue May 2 23:21:48 UTC 2006


Author: enrico
Date: Tue May  2 23:21:46 2006
New Revision: 1692

Removed:
   tagcoll/2.0/tagcoll/OpSet.cc
Modified:
   tagcoll/2.0/   (props changed)
   tagcoll/2.0/tagcoll/Consumer.cc
   tagcoll/2.0/tagcoll/Makefile.am
   tagcoll/2.0/tagcoll/OpSet.h
Log:
 r2556 at viaza:  enrico | 2006-05-03 00:30:44 +0200
 Deleted most of the old OpSet code


Modified: tagcoll/2.0/tagcoll/Consumer.cc
==============================================================================
--- tagcoll/2.0/tagcoll/Consumer.cc	(original)
+++ tagcoll/2.0/tagcoll/Consumer.cc	Tue May  2 23:21:46 2006
@@ -43,7 +43,7 @@
 void to::test<1>()
 {
 	TestConsumer<string, string> cons;
-	OpSet<string> tags;
+	std::set<string> tags;
 
 	cons.consume("1");
 	ensure(cons.items == 1);
@@ -53,12 +53,12 @@
 	ensure(cons.items == 2);
 	ensure(cons.tags == 0);
 
-	tags += "1";
+	tags.insert("1");
 	cons.consume("1", tags);
 	ensure(cons.items == 3);
 	ensure(cons.tags == 1);
 
-	tags += "2";
+	tags.insert("2");
 	cons.consume("1", tags);
 	ensure(cons.items == 4);
 	ensure(cons.tags == 3);

Modified: tagcoll/2.0/tagcoll/Makefile.am
==============================================================================
--- tagcoll/2.0/tagcoll/Makefile.am	(original)
+++ tagcoll/2.0/tagcoll/Makefile.am	Tue May  2 23:21:46 2006
@@ -8,7 +8,6 @@
 tagcollinclude_HEADERS = \
 		stringf.h \
 		OpSet.h \
-		OpSet.cc \
 		ParserBase.h \
 		MemParserInput.h \
 		StringParserInput.h \
@@ -57,7 +56,6 @@
 lib_LTLIBRARIES = libtagcoll.la
 libtagcoll_la_SOURCES = \
 		stringf.cc \
-		OpSet.cc \
 		ParserBase.cc \
 		MemParserInput.cc \
 		StringParserInput.cc \

Modified: tagcoll/2.0/tagcoll/OpSet.h
==============================================================================
--- tagcoll/2.0/tagcoll/OpSet.h	(original)
+++ tagcoll/2.0/tagcoll/OpSet.h	Tue May  2 23:21:46 2006
@@ -2,11 +2,11 @@
 #define TAGCOLL_OPSET_H
 
 /** \file
- * std::set with operators overridden with set operations
+ * Extra useful set operations
  */
 
 /*
- * Copyright (C) 2003,2004,2005  Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003,2004,2005,2006  Enrico Zini <enrico at debian.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,129 +23,11 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
  */
 
-/* TODO: replace + with | and ^ with &, since logical operators better
- * correspond to set operations */
-
 #include <set>
 
 namespace tagcoll
 {
 
-#if 0
-/**
- * OpSet is just the standard std::set extended with set operations.
- *
- * The reason for not using a plain std::set is that the libtagcoll code
- * involves a lot of set operations, and overridden operators greatly help
- * in having cleaner code.
- *
- * Example:
- * \code
- *  OpSet<string> myfavs;
- *  OpSet<string> yourfavs;
- *  myfavourite += "pear";
- *  myfavourite += "banana";
- *  yourfavourite += "apple";
- *  yourfavourite += "pear";
- *  OpSet<string> ourfavs = myfavs ^ yourfavs;
- *  OpSet<string> interesting = myfavs + yourfavs;
- *  OpSet<string> myonlyfavs = myfavs - yourfavs;
- *  for (OpSet<string>::const_iterator i = ourfavs.begin();
- *       i != ourfavs.end(); i++)
- *     cout << *i << endl;
- * \endcode
- */
-template<class T>
-class OpSet : public std::set<T>
-{
-public:
-	using std::set<T>::begin;
-	using std::set<T>::end;
-
-	OpSet() : std::set<T>() {}
-
-	template<typename A, typename B>
-	OpSet(A a, B b) : std::set<T>(a, b) {}
-
-	/** Return true if the tag set contains tag, else false */
-	bool contains(const T& item) const { return find(item) != end(); }
-
-	/** Return true if the tag set contains ts, else false */
-	bool contains(const OpSet<T>& ts) const;
-
-	/** 
-	 * @brief Calculates the distance between two tagsets.
-	 * 
-	 * The distance between A and B is defined by infinity if the 
-	 * intersection between A und B is empty, else it is 
-	 * \f$|(A \cup B) \setminus (A \cap B)|\f$
-	 * @returns the distance between the two tagsets or -1 if the distance 
-	 * is infinity
-	 */
-	int distance(const OpSet<T>& ts) const;
-
-	/**
-	 * Singleton union
-	 * @return the set union of this set and the singleton set {tag}
-	 */
-	OpSet<T> operator+(const T& tag) const;
-
-	/**
-	 * Singleton union
-	 * @return the set union of this set and the singleton set {tag}
-	 */
-	OpSet<T>& operator+=(const T& ts);
-
-	/**
-	 * Set union
-	 * @return the set union of this set and the set ts
-	 */
-	OpSet<T> operator+(const OpSet<T>& ts) const;
-
-	/**
-	 * Singleton union
-	 * @return the set union of this set and the singleton set {tag}
-	 */
-	OpSet<T>& operator+=(const OpSet<T>& ts);
-
-	/**
-	 * Singleton difference
-	 * @return the set difference of this set and the singleton set {tag}
-	 */
-	OpSet<T> operator-(const T& tag) const;
-
-	/**
-	 * Singleton difference
-	 * @return the set difference of this set and the singleton set {tag}
-	 */
-	OpSet<T>& operator-=(const T& tag);
-
-	/**
-	 * Set difference
-	 * @return the set difference of this set and the set ts
-	 */
-	OpSet<T> operator-(const OpSet<T>& ts) const;
-
-	/**
-	 * Set difference
-	 * @return the set difference of this set and the set ts
-	 */
-	OpSet<T>& operator-=(const OpSet<T>& ts);
-
-	/**
-	 * Set intersection
-	 * @return the set intersection of this set and the set ts
-	 */
-	OpSet<T> operator^(const OpSet<T>& ts) const;
-
-	/**
-	 * Set intersection
-	 * @return the set intersection of this set and the set ts
-	 */
-	OpSet<T>& operator^=(const OpSet<T>& ts);
-};
-#endif
-
 template<typename T>
 int set_distance(const std::set<T>& set1, const std::set<T>& set2)
 {



More information about the Debtags-commits mailing list