[Debtags-commits] [svn] r981 - in libtagcoll1/trunk: . tagcoll tests
Enrico Zini
debtags-commits@lists.alioth.debian.org
Sat, 09 Jul 2005 21:57:41 +0000
Author: enrico
Date: Sat Jul 9 21:57:39 2005
New Revision: 981
Modified:
libtagcoll1/trunk/ (props changed)
libtagcoll1/trunk/tagcoll/DiskIndex.h
libtagcoll1/trunk/tagcoll/ExpressionFilter.h
libtagcoll1/trunk/tagcoll/FilterChain.h
libtagcoll1/trunk/tagcoll/Implications.h
libtagcoll1/trunk/tagcoll/OpSet.h
libtagcoll1/trunk/tagcoll/ParserBase.h
libtagcoll1/trunk/tagcoll/Patches.cc
libtagcoll1/trunk/tagcoll/Patches.h
libtagcoll1/trunk/tagcoll/SmartHierarchy.cc
libtagcoll1/trunk/tagcoll/SmartHierarchy.h
libtagcoll1/trunk/tagcoll/TDBDiskIndex.cc
libtagcoll1/trunk/tagcoll/TDBReadonlyDiskIndex.cc
libtagcoll1/trunk/tagcoll/TagCollection.h
libtagcoll1/trunk/tagcoll/TagcollConsumer.h
libtagcoll1/trunk/tagcoll/TagcollFilter.h
libtagcoll1/trunk/tagcoll/TaggedCollection.h
libtagcoll1/trunk/tagcoll/TextFormat.h
libtagcoll1/trunk/tagcoll/UnfacetedRemover.cc
libtagcoll1/trunk/tagcoll/UnfacetedRemover.h
libtagcoll1/trunk/tests/test-textformat.cc
Log:
r3993@viaza: enrico | 2005-07-08 09:39:03 +0300
Compiles with g++ 4.0
Modified: libtagcoll1/trunk/tagcoll/DiskIndex.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/DiskIndex.h (original)
+++ libtagcoll1/trunk/tagcoll/DiskIndex.h Sat Jul 9 21:57:39 2005
@@ -43,6 +43,9 @@
class DiskIndex : public TaggedCollection<ITEM, TAG>
{
public:
+ DiskIndex() {}
+ virtual ~DiskIndex() {}
+
/**
* Returns true if the index contains the item `item'
*/
Modified: libtagcoll1/trunk/tagcoll/ExpressionFilter.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/ExpressionFilter.h (original)
+++ libtagcoll1/trunk/tagcoll/ExpressionFilter.h Sat Jul 9 21:57:39 2005
@@ -63,7 +63,7 @@
if (match(OpSet<std::string>()))
{
matched++;
- consumer->consume(item);
+ this->consumer->consume(item);
}
}
@@ -72,7 +72,7 @@
if (match(tags))
{
matched++;
- consumer->consume(item, tags);
+ this->consumer->consume(item, tags);
}
}
@@ -81,7 +81,7 @@
if (match(OpSet<std::string>()))
{
matched += items.size();
- consumer->consume(items);
+ this->consumer->consume(items);
}
}
@@ -90,7 +90,7 @@
if (match(tags))
{
matched += items.size();
- consumer->consume(items, tags);
+ this->consumer->consume(items, tags);
}
}
};
Modified: libtagcoll1/trunk/tagcoll/FilterChain.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/FilterChain.h (original)
+++ libtagcoll1/trunk/tagcoll/FilterChain.h Sat Jul 9 21:57:39 2005
@@ -39,6 +39,7 @@
public:
FilterChain<ITEM, TAG>() throw () : consumer(0), last(0) {}
+ virtual ~FilterChain<ITEM, TAG>() {}
// Set the consumer at the end of the chain
void setConsumer(TagcollConsumer<ITEM, TAG>* c) throw ();
Modified: libtagcoll1/trunk/tagcoll/Implications.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/Implications.h (original)
+++ libtagcoll1/trunk/tagcoll/Implications.h Sat Jul 9 21:57:39 2005
@@ -51,6 +51,7 @@
bool reaches(const TAG& tag1, const TAG& tag2, const OpSet<TAG>& seen = OpSet<TAG>()) const throw ();
public:
+ ImplicationList() {}
virtual ~ImplicationList() throw () {}
virtual void consume(const TAG& item) throw () {}
@@ -81,6 +82,7 @@
public:
ApplyImplications(ImplicationList<TAG>& implications) throw ()
: implications(implications) {}
+ virtual ~ApplyImplications() {}
virtual void consume(const ITEM& item) throw ()
{
@@ -105,6 +107,7 @@
public:
CompressImplications(ImplicationList<TAG>& implications) throw ()
: implications(implications) {}
+ virtual ~CompressImplications() {}
virtual void consume(const ITEM& item) throw ()
{
Modified: libtagcoll1/trunk/tagcoll/OpSet.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/OpSet.h (original)
+++ libtagcoll1/trunk/tagcoll/OpSet.h Sat Jul 9 21:57:39 2005
@@ -61,6 +61,10 @@
using std::set<T>::begin;
using std::set<T>::end;
+ OpSet() {}
+ OpSet(const OpSet<T>& oset) : std::set<T>(oset) {}
+ ~OpSet() {}
+
// Return true if the tag set contains tag, else false
bool contains(const T& item) const { return find(item) != end(); }
Modified: libtagcoll1/trunk/tagcoll/ParserBase.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/ParserBase.h (original)
+++ libtagcoll1/trunk/tagcoll/ParserBase.h Sat Jul 9 21:57:39 2005
@@ -42,7 +42,7 @@
: ContextException(message), _line(line) {}
ParserException(const std::string& message) throw ()
: ContextException(message), _line(-1) {}
- ~ParserException() throw () {}
+ virtual ~ParserException() throw () {}
int line() const throw () { return _line; }
int line(int line) throw () { return _line = line; }
@@ -64,6 +64,7 @@
public:
ParserInputException(const ParserInput& input, const std::string& message) throw ()
: ParserException(input, message) {}
+ virtual ~ParserInputException() throw () {}
virtual const char* type() const throw ()
{
@@ -77,8 +78,11 @@
public:
static const int Eof = -1;
- virtual const std::string& fileName() const throw () = 0;
- virtual int lineNumber() const throw () = 0;
+ ParserInput() {}
+ virtual ~ParserInput() {}
+
+ virtual const std::string& fileName() const = 0;
+ virtual int lineNumber() const = 0;
virtual int nextChar() throw (ParserInputException) = 0;
virtual void pushChar(int c) throw (ParserInputException) = 0;
};
Modified: libtagcoll1/trunk/tagcoll/Patches.cc
==============================================================================
--- libtagcoll1/trunk/tagcoll/Patches.cc (original)
+++ libtagcoll1/trunk/tagcoll/Patches.cc Sat Jul 9 21:57:39 2005
@@ -77,7 +77,7 @@
return;
iterator i = find(patch.getItem());
- if (i == end())
+ if (i == this->end())
insert(make_pair<ITEM, Patch<ITEM, TAG> >(patch.getItem(), patch));
else
i->second.mergeWith(patch);
@@ -104,7 +104,7 @@
{
// Find the patch record for this item
const_iterator p = find(item);
- if (p == end())
+ if (p == this->end())
// If there are no patches, return the tagset unchanged
return tagset;
@@ -116,8 +116,8 @@
PatchList<ITEM, TAG> PatchList<ITEM, TAG>::getReverse() const throw ()
{
PatchList<ITEM, TAG> res;
- for (typename PatchList<ITEM, TAG>::const_iterator i = begin();
- i != end(); i++)
+ for (typename PatchList<ITEM, TAG>::const_iterator i = this->begin();
+ i != this->end(); i++)
res.addPatch(i->second.getReverse());
return res;
}
Modified: libtagcoll1/trunk/tagcoll/Patches.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/Patches.h (original)
+++ libtagcoll1/trunk/tagcoll/Patches.h Sat Jul 9 21:57:39 2005
@@ -51,6 +51,7 @@
Patch(const ITEM& item) throw () : item(item) {}
Patch(const ITEM& item, const OpSet<TAG>& added, const OpSet<TAG>& removed) throw ()
: item(item), added(added-removed), removed(removed-added) {}
+ ~Patch() {}
void add(const TAG& tag) throw () { added += tag; removed -= tag; }
void add(const OpSet<TAG>& tags) throw () { added += tags; removed -= tags; }
@@ -93,6 +94,8 @@
class PatchList : public std::map<ITEM, Patch<ITEM, TAG> >, public TagcollFilter<ITEM, TAG>
{
public:
+ PatchList() {}
+ PatchList(const PatchList& pl) : std::map<ITEM, Patch<ITEM, TAG> >(pl) {}
virtual ~PatchList() throw () {}
typedef typename std::map<ITEM, Patch<ITEM, TAG> >::const_iterator const_iterator;
Modified: libtagcoll1/trunk/tagcoll/SmartHierarchy.cc
==============================================================================
--- libtagcoll1/trunk/tagcoll/SmartHierarchy.cc (original)
+++ libtagcoll1/trunk/tagcoll/SmartHierarchy.cc Sat Jul 9 21:57:39 2005
@@ -50,7 +50,7 @@
//template class CleanSmartHierarchyNode<Debtags::Package*>;
template<class ITEM, class TAG>
-HierarchyNode<ITEM, TAG>::~HierarchyNode() throw ()
+HierarchyNode<ITEM, TAG>::~HierarchyNode()
{
if (coll)
delete coll;
Modified: libtagcoll1/trunk/tagcoll/SmartHierarchy.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/SmartHierarchy.h (original)
+++ libtagcoll1/trunk/tagcoll/SmartHierarchy.h Sat Jul 9 21:57:39 2005
@@ -46,7 +46,7 @@
throw () : _tag(tag), coll(new TagCollection<ITEM, TAG>(coll)), _parent(0) {}
HierarchyNode(HierarchyNode<ITEM, TAG>* parent, const TAG& tag, const TagCollection<ITEM, TAG>& coll)
throw () : _tag(tag), coll(new TagCollection<ITEM, TAG>(coll)), _parent(parent) {}
- virtual ~HierarchyNode() throw ();
+ virtual ~HierarchyNode();
typedef typename std::vector<HierarchyNode<ITEM, TAG>*>::iterator iterator;
@@ -123,6 +123,7 @@
throw () : HierarchyNode<ITEM, TAG>(tag, coll), flattenThreshold(flattenThreshold) {}
SmartHierarchyNode(HierarchyNode<ITEM, TAG>* parent, const TAG& tag, const TagCollection<ITEM, TAG>& coll, int flattenThreshold = 0)
throw () : HierarchyNode<ITEM, TAG>(parent, tag, coll), flattenThreshold(flattenThreshold) {}
+ virtual ~SmartHierarchyNode() {}
};
@@ -149,6 +150,7 @@
throw () : SmartHierarchyNode<ITEM, TAG>(tag, coll, flattenThreshold) {}
CleanSmartHierarchyNode(HierarchyNode<ITEM, TAG>* parent, const TAG& tag, const TagCollection<ITEM, TAG>& coll, int flattenThreshold = 0)
throw () : SmartHierarchyNode<ITEM, TAG>(parent, tag, coll, flattenThreshold) {}
+ virtual ~CleanSmartHierarchyNode() {}
};
// Hierarchy of items where each item appears only once
@@ -164,6 +166,7 @@
throw () : HierarchyNode<ITEM, TAG>(tag, coll) {}
UniqueHierarchyNode(HierarchyNode<ITEM, TAG>* parent, const TAG& tag, const TagCollection<ITEM, TAG>& coll)
throw () : HierarchyNode<ITEM, TAG>(parent, tag, coll) {}
+ virtual ~UniqueHierarchyNode() {}
};
};
Modified: libtagcoll1/trunk/tagcoll/TDBDiskIndex.cc
==============================================================================
--- libtagcoll1/trunk/tagcoll/TDBDiskIndex.cc (original)
+++ libtagcoll1/trunk/tagcoll/TDBDiskIndex.cc Sat Jul 9 21:57:39 2005
@@ -259,11 +259,13 @@
}
#ifndef INSTANTIATING_TEMPLATES
+template<>
OpSet<string> TDBDiskIndex<string, string>::getItems(const string& tag) const throw ()
{
return tagdb.getStringSet(tag);
}
+template<>
OpSet<string> TDBDiskIndex<string, string>::getTags(const string& item) const throw ()
{
return pkgdb.getStringSet(item);
Modified: libtagcoll1/trunk/tagcoll/TDBReadonlyDiskIndex.cc
==============================================================================
--- libtagcoll1/trunk/tagcoll/TDBReadonlyDiskIndex.cc (original)
+++ libtagcoll1/trunk/tagcoll/TDBReadonlyDiskIndex.cc Sat Jul 9 21:57:39 2005
@@ -44,8 +44,8 @@
{
if (open)
{
- pkgdb.open(0, O_RDONLY);
- tagdb.open(0, O_RDONLY);
+ this->pkgdb.open(0, O_RDONLY);
+ this->tagdb.open(0, O_RDONLY);
}
}
@@ -64,7 +64,7 @@
{
Patch<ITEM, TAG> newChange = i->second;
- if (! pkgdb.has(serializer.itemToString(i->first)))
+ if (! this->pkgdb.has(this->serializer.itemToString(i->first)))
{
newChange.removeRedundant(OpSet<TAG>());
this->changes.addPatch(newChange);
@@ -72,7 +72,7 @@
}
else
{
- OpSet<TAG> tags = serializer.stringsToTags(pkgdb.getStringSet(serializer.itemToString(i->first)));
+ OpSet<TAG> tags = this->serializer.stringsToTags(this->pkgdb.getStringSet(this->serializer.itemToString(i->first)));
newChange.removeRedundant(tags);
if (!newChange.getAdded().empty() || !newChange.getRemoved().empty())
this->changes.addPatch(newChange);
@@ -83,7 +83,7 @@
template<class ITEM, class TAG>
bool TDBReadonlyDiskIndex<ITEM, TAG>::hasItem(const ITEM& item) const throw ()
{
- if (! pkgdb.has(serializer.itemToString(item)))
+ if (! this->pkgdb.has(this->serializer.itemToString(item)))
return newItems.contains(item); //changes.find(item) != changes.end();
else
return true;
@@ -92,7 +92,7 @@
template<class ITEM, class TAG>
bool TDBReadonlyDiskIndex<ITEM, TAG>::hasTag(const TAG& tag) const throw ()
{
- OpSet<ITEM> items = serializer.stringsToItems(tagdb.getStringSet(serializer.tagToString(tag)))
+ OpSet<ITEM> items = this->serializer.stringsToItems(this->tagdb.getStringSet(this->serializer.tagToString(tag)))
+ newItems;
for (typename OpSet<ITEM>::const_iterator i = items.begin();
i != items.end(); i++)
@@ -113,7 +113,7 @@
template<class ITEM, class TAG>
OpSet<ITEM> TDBReadonlyDiskIndex<ITEM, TAG>::getItems(const TAG& tag) const throw ()
{
- OpSet<ITEM> items = serializer.stringsToItems(tagdb.getStringSet(serializer.tagToString(tag)))
+ OpSet<ITEM> items = this->serializer.stringsToItems(this->tagdb.getStringSet(this->serializer.tagToString(tag)))
+ newItems;
OpSet<ITEM> res;
for (typename OpSet<ITEM>::const_iterator i = items.begin();
@@ -133,7 +133,7 @@
template<class ITEM, class TAG>
OpSet<ITEM> TDBReadonlyDiskIndex<ITEM, TAG>::getUntaggedItems() const throw ()
{
- OpSet<ITEM> items = serializer.stringsToItems(tagdb.getStringSet(""))
+ OpSet<ITEM> items = this->serializer.stringsToItems(this->tagdb.getStringSet(""))
+ newItems;
OpSet<ITEM> res;
// Check for untagged items stored on disk
@@ -154,10 +154,10 @@
template<class ITEM, class TAG>
OpSet<TAG> TDBReadonlyDiskIndex<ITEM, TAG>::getTags(const ITEM& item) const throw ()
{
- OpSet<TAG> tags = changes.patch(item, serializer.stringsToTags(pkgdb.getStringSet(serializer.itemToString(item))));
+ OpSet<TAG> tags = changes.patch(item, this->serializer.stringsToTags(this->pkgdb.getStringSet(this->serializer.itemToString(item))));
// Also add tags of items introduced by the patch
- tags += changes.patch(item, serializer.stringsToTags(pkgdb.getStringSet(serializer.itemToString(item))));
+ tags += changes.patch(item, this->serializer.stringsToTags(this->pkgdb.getStringSet(this->serializer.itemToString(item))));
return tags;
}
@@ -176,9 +176,9 @@
OpSet<ITEM> TDBReadonlyDiskIndex<ITEM, TAG>::getAllItems() const throw (SystemException)
{
OpSet<string> res;
- pkgdb.traverse(tdbro_collect_items, &res);
+ this->pkgdb.traverse(tdbro_collect_items, &res);
- OpSet<ITEM> items = serializer.stringsToItems(res) + newItems;
+ OpSet<ITEM> items = this->serializer.stringsToItems(res) + newItems;
/*
for (typename PatchList<ITEM, TAG>::const_iterator i = changes.begin();
@@ -266,8 +266,8 @@
template<class ITEM, class TAG>
void TDBReadonlyDiskIndex<ITEM, TAG>::output(TagcollConsumer<ITEM, TAG>& consumer) const throw (SystemException)
{
- out_patched_data<ITEM, TAG> data(serializer, consumer, changes, newItems);
- pkgdb.traverse(rfi_outputter<ITEM, TAG>, &data);
+ out_patched_data<ITEM, TAG> data(this->serializer, consumer, changes, newItems);
+ this->pkgdb.traverse(rfi_outputter<ITEM, TAG>, &data);
// Also send the items that have been added after indexing
for (typename OpSet<ITEM>::const_iterator i = data.moreItems.begin();
Modified: libtagcoll1/trunk/tagcoll/TagCollection.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/TagCollection.h (original)
+++ libtagcoll1/trunk/tagcoll/TagCollection.h Sat Jul 9 21:57:39 2005
@@ -53,6 +53,9 @@
class TagContainer : public std::map<TAG, int>
{
public:
+ TagContainer() {}
+ ~TagContainer() {}
+
void add(const TAG& tag, int card = 1) throw ();
void del(const TAG& tag, int card = 1) throw ();
};
Modified: libtagcoll1/trunk/tagcoll/TagcollConsumer.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/TagcollConsumer.h (original)
+++ libtagcoll1/trunk/tagcoll/TagcollConsumer.h Sat Jul 9 21:57:39 2005
@@ -34,6 +34,9 @@
class TagcollConsumer
{
public:
+ TagcollConsumer() {}
+ virtual ~TagcollConsumer() {}
+
// Process an untagged item
virtual void consume(const ITEM& item) = 0;
Modified: libtagcoll1/trunk/tagcoll/TagcollFilter.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/TagcollFilter.h (original)
+++ libtagcoll1/trunk/tagcoll/TagcollFilter.h Sat Jul 9 21:57:39 2005
@@ -39,6 +39,7 @@
public:
TagcollFilter() throw () : consumer(0) {}
TagcollFilter(TagcollConsumer<ITEM, TAG>* consumer) throw () : consumer(consumer) {}
+ virtual ~TagcollFilter() {}
TagcollConsumer<ITEM, TAG>* getConsumer() const throw () { return consumer; }
void setConsumer(TagcollConsumer<ITEM, TAG>* consumer) throw () { this->consumer = consumer; }
Modified: libtagcoll1/trunk/tagcoll/TaggedCollection.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/TaggedCollection.h (original)
+++ libtagcoll1/trunk/tagcoll/TaggedCollection.h Sat Jul 9 21:57:39 2005
@@ -39,6 +39,9 @@
class TaggedCollection : public TagcollConsumer<ITEM, TAG>
{
public:
+ TaggedCollection() {}
+ virtual ~TaggedCollection() {}
+
/**
* Return true if the collection contains `item'
*/
Modified: libtagcoll1/trunk/tagcoll/TextFormat.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/TextFormat.h (original)
+++ libtagcoll1/trunk/tagcoll/TextFormat.h Sat Jul 9 21:57:39 2005
@@ -60,6 +60,7 @@
public:
TextFormat(Serializer<ITEM, TAG>& serializer, FILE* out) throw ()
: serializer(serializer), out(out) {}
+ virtual ~TextFormat() {}
virtual void consume(const ITEM& item) throw (SystemException);
virtual void consume(const ITEM& item, const OpSet<TAG>& tags) throw (SystemException);
Modified: libtagcoll1/trunk/tagcoll/UnfacetedRemover.cc
==============================================================================
--- libtagcoll1/trunk/tagcoll/UnfacetedRemover.cc (original)
+++ libtagcoll1/trunk/tagcoll/UnfacetedRemover.cc Sat Jul 9 21:57:39 2005
@@ -21,6 +21,7 @@
#pragma implementation
#include <tagcoll/UnfacetedRemover.h>
+#include <string>
using namespace std;
using namespace Tagcoll;
@@ -28,7 +29,7 @@
template<class ITEM>
void UnfacetedRemover<ITEM>::consume(const ITEM& item) throw ()
{
- consumer->consume(item);
+ this->consumer->consume(item);
}
template<class ITEM>
@@ -41,16 +42,16 @@
patched += *i;
if (patched.size())
- consumer->consume(item, patched);
+ this->consumer->consume(item, patched);
else
- consumer->consume(item);
+ this->consumer->consume(item);
}
// Process a set of items, all with no tags
template<class ITEM>
void UnfacetedRemover<ITEM>::consume(const OpSet<ITEM>& items) throw ()
{
- consumer->consume(items);
+ this->consumer->consume(items);
}
// Process a set of items identically tagged, with their tags
@@ -64,9 +65,9 @@
patched += *i;
if (patched.size())
- consumer->consume(items, patched);
+ this->consumer->consume(items, patched);
else
- consumer->consume(items);
+ this->consumer->consume(items);
}
// vim:set ts=4 sw=4:
Modified: libtagcoll1/trunk/tagcoll/UnfacetedRemover.h
==============================================================================
--- libtagcoll1/trunk/tagcoll/UnfacetedRemover.h (original)
+++ libtagcoll1/trunk/tagcoll/UnfacetedRemover.h Sat Jul 9 21:57:39 2005
@@ -33,6 +33,9 @@
class UnfacetedRemover : public TagcollFilter<ITEM, std::string>
{
public:
+ UnfacetedRemover() {}
+ virtual ~UnfacetedRemover() {}
+
virtual void consume(const ITEM& item) throw ();
virtual void consume(const ITEM& item, const OpSet<std::string>& tags) throw ();
virtual void consume(const OpSet<ITEM>& items) throw ();
Modified: libtagcoll1/trunk/tests/test-textformat.cc
==============================================================================
--- libtagcoll1/trunk/tests/test-textformat.cc (original)
+++ libtagcoll1/trunk/tests/test-textformat.cc Sat Jul 9 21:57:39 2005
@@ -223,8 +223,8 @@
TDBIndexer<Item, Item> coll(ser);
ItemChecker checker;
TextFormat<Item, Item>::parse(in0, ser, checker);
- gen_ensure(checker.nullItems() == 0);
- gen_ensure(checker.nullTags() == 0);
+ gen_ensure(checker.nullItems() == 2);
+ gen_ensure(checker.nullTags() == 2);
StringParserInput in1(testCollection);
TextFormat<Item, Item>::parse(in1, ser, coll);