[Debtags-commits] [svn] r1846 - in debtags-edit/1.2: . debian src
Enrico Zini
enrico at costa.debian.org
Mon Aug 14 23:16:23 UTC 2006
Author: enrico
Date: Mon Aug 14 23:16:22 2006
New Revision: 1846
Removed:
debtags-edit/1.2/src/CommandlineParser.cc
debtags-edit/1.2/src/CommandlineParser.h
Modified:
debtags-edit/1.2/ (props changed)
debtags-edit/1.2/configure.ac
debtags-edit/1.2/debian/control
debtags-edit/1.2/src/DebtagsDocument.cc
debtags-edit/1.2/src/DebtagsDocument.h
debtags-edit/1.2/src/FilterPanel.cc
debtags-edit/1.2/src/FilterPanel.h
debtags-edit/1.2/src/Makefile.am
debtags-edit/1.2/src/TagEditor.cc
debtags-edit/1.2/src/TagMenu.cc
debtags-edit/1.2/src/TagMenu.h
debtags-edit/1.2/src/TagSelector.cc
debtags-edit/1.2/src/TagSelector.h
debtags-edit/1.2/src/Thread.cc
debtags-edit/1.2/src/Thread.h
Log:
r3154 at viaza: enrico | 2006-08-15 00:15:26 +0100
Ported most to the new libept, currently stuck on FilterPanel
Modified: debtags-edit/1.2/configure.ac
==============================================================================
--- debtags-edit/1.2/configure.ac (original)
+++ debtags-edit/1.2/configure.ac Mon Aug 14 23:16:22 2006
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(debtags-edit, 1.1.3, [enrico at debian.org])
+AC_INIT(debtags-edit, 1.2, [enrico at debian.org])
AC_CONFIG_SRCDIR([configure.ac])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE([foreign])
@@ -22,7 +22,7 @@
dnl AM_PROG_LIBTOOL
LIBTAGCOLL_DEFS
-LIBAPT_FRONT_DEFS
+LIBEPT_DEFS
PKG_CHECK_MODULES([GTKMM], [sigc++-2.0 >= 2.0 gtkmm-2.4 >= 2.4.0])AC_SUBST([GTKMM_CFLAGS])
AC_SUBST([GTKMM_LIBS])
Modified: debtags-edit/1.2/debian/control
==============================================================================
--- debtags-edit/1.2/debian/control (original)
+++ debtags-edit/1.2/debian/control Mon Aug 14 23:16:22 2006
@@ -2,7 +2,7 @@
Section: misc
Priority: optional
Maintainer: Enrico Zini <enrico at debian.org>
-Build-Depends: cdbs, debhelper (>= 4.1), dh-buildinfo, pkg-config, libapt-front-dev (>= 0.3.8), libapt-front-dev (<< 0.4), libgtkmm-2.4-dev
+Build-Depends: cdbs, debhelper (>= 4.1), dh-buildinfo, pkg-config, libept-dev (>= 0.4), libept-dev (<< 0.4.1), libgtkmm-2.4-dev
Standards-Version: 3.6.2.0
Package: debtags-edit
Modified: debtags-edit/1.2/src/DebtagsDocument.cc
==============================================================================
--- debtags-edit/1.2/src/DebtagsDocument.cc (original)
+++ debtags-edit/1.2/src/DebtagsDocument.cc Mon Aug 14 23:16:22 2006
@@ -23,29 +23,30 @@
#include "DebtagsDocument.h"
+#if 0
#include <tagcoll/InputMerger.h>
#include <tagcoll/ItemGrouper.h>
#include <tagcoll/Expression.h>
#include <tagcoll/StdioParserInput.h>
#include <tagcoll/StringParserInput.h>
+#endif
#include "Environment.h"
#include <errno.h>
using namespace std;
+#if 0
using namespace Tagcoll;
using namespace aptFront;
using namespace aptFront::cache;
using namespace aptFront::cache::component;
+#endif
DebtagsDocument::DebtagsDocument() throw () :
//DebtagsSimple<aptFront::cache::entity::Package>(true),
- _packages(aptFront::cache::Global::get().packages()),
- _debtags(aptFront::cache::Global::get().debtags()),
- _voc(aptFront::cache::Global::get().tags()),
_changed(false),
- _lastPatch(Tagcoll::Patch<Package, Tag>(Package())),
+ _lastPatch(tagcoll::Patch<Package, Tag>(Package())),
_undoTail(0), /*specialsGen(*this),*/ computeIntensive(false)/*, specials(100)*/, hasSpecials(NO)
{
#if 0
@@ -215,7 +216,7 @@
debug("Pre undo: tail: %d, size: %d\n", _undoTail, _undoBuffer.size());
_undoTail--;
- debtags().tagdb().applyChange(_undoBuffer[_undoTail]);
+ debtags().applyChange(_undoBuffer[_undoTail]);
_undoBuffer[_undoTail] = _undoBuffer[_undoTail].getReverse();
debug("Post undo: tail: %d, size: %d\n", _undoTail, _undoBuffer.size());
@@ -230,7 +231,7 @@
debug("Pre redo: tail: %d, size: %d\n", _undoTail, _undoBuffer.size());
- debtags().tagdb().applyChange(_undoBuffer[_undoTail]);
+ debtags().applyChange(_undoBuffer[_undoTail]);
_undoBuffer[_undoTail] = _undoBuffer[_undoTail].getReverse();
_undoTail++;
@@ -246,7 +247,7 @@
return;
// Build the new patch
- Tagcoll::Patch<Package, Tag> newPatch(
+ tagcoll::Patch<Package, Tag> newPatch(
pkg,
_lastPatch.getAdded(),
_lastPatch.getRemoved());
@@ -263,16 +264,16 @@
}
}
-void DebtagsDocument::applyChange(const Patch<Package, Tag>& change)
+void DebtagsDocument::applyChange(const tagcoll::Patch<Package, Tag>& change)
{
- PatchList<Package, Tag> patchList;
+ tagcoll::PatchList<Package, Tag> patchList;
patchList.addPatch(change);
applyChange(patchList);
}
-void DebtagsDocument::applyChange(const PatchList<Package, Tag>& change)
+void DebtagsDocument::applyChange(const tagcoll::PatchList<Package, Tag>& change)
{
- debtags().tagdb().applyChange(change);
+ debtags().applyChange(change);
if (1 /*reverse != change*/)
{
@@ -294,7 +295,7 @@
if (change.size() == 1)
_lastPatch = change.begin()->second;
else
- _lastPatch = Tagcoll::Patch<Package, Tag>(Package());
+ _lastPatch = tagcoll::Patch<Package, Tag>(Package());
debug("Post change: tail: %d, size: %d\n", _undoTail, _undoBuffer.size());
@@ -328,7 +329,7 @@
}
*/
-void DebtagsDocument::save() throw (FileException)
+void DebtagsDocument::save() throw (wibble::exception::File)
{
debtags().savePatch();
_changed = false;
@@ -354,7 +355,7 @@
*/
}
-void DebtagsDocument::send() throw (FileException)
+void DebtagsDocument::send() throw (wibble::exception::File)
{
debtags().sendPatch();
}
Modified: debtags-edit/1.2/src/DebtagsDocument.h
==============================================================================
--- debtags-edit/1.2/src/DebtagsDocument.h (original)
+++ debtags-edit/1.2/src/DebtagsDocument.h Mon Aug 14 23:16:22 2006
@@ -23,16 +23,25 @@
#include <sigc++/sigc++.h>
-#include <apt-front/cache/entity/package.h>
-#include <apt-front/cache/entity/tag.h>
-#include <apt-front/cache/component/packagetags.h>
-#include <apt-front/cache/component/tags.h>
+#include <ept/forward.h>
+#include <ept/configuration/apt.h>
+#include <ept/cache/apt/packages.h>
+#include <ept/cache/debtags/tagmap.h>
+#include <ept/cache/debtags/vocabulary.h>
#include <tagcoll/Patches.h>
+#include <tagcoll/coll/fast.h>
+#if 0
+#include <ept/cache/entity/package.h>
+#include <ept/cache/entity/tag.h>
+#include <ept/cache/component/packagetags.h>
+#include <ept/cache/component/tags.h>
+
#include <tagcoll/InputMerger.h>
#include <tagcoll/ItemGrouper.h>
//#include <debtags/Utils.h>
+#endif
#include "Mutex.h"
#include "Thread.h"
@@ -47,9 +56,14 @@
typedef SigC::Signal0<void> type_signal_reselected;
typedef SigC::Signal0<void> type_signal_filename_changed;
- typedef aptFront::cache::entity::Package Package;
- typedef aptFront::cache::entity::Facet Facet;
- typedef aptFront::cache::entity::Tag Tag;
+ typedef ept::configuration::apt::cache::Aggregator Aggregator;
+ typedef ept::configuration::apt::cache::Index Index;
+ typedef ept::configuration::apt::cache::TagMap TagMap;
+ typedef ept::configuration::apt::cache::Vocabulary Vocabulary;
+
+ typedef ept::configuration::apt::cache::Package Package;
+ typedef ept::configuration::apt::cache::Facet Facet;
+ typedef ept::configuration::apt::cache::Tag Tag;
protected:
#if 0
@@ -75,16 +89,14 @@
};
#endif
- aptFront::cache::component::Packages& _packages;
- aptFront::cache::component::PackageTags& _debtags;
- aptFront::cache::component::Tags& _voc;
+ Aggregator _agg;
bool _changed;
Package _current;
- Tagcoll::Patch<Package, Tag> _lastPatch;
- std::vector<Tagcoll::PatchList<Package, Tag> > _undoBuffer;
+ tagcoll::Patch<Package, Tag> _lastPatch;
+ std::vector<tagcoll::PatchList<Package, Tag> > _undoBuffer;
unsigned int _undoTail;
type_signal_changed _signal_changed;
@@ -103,16 +115,16 @@
DebtagsDocument() throw ();
virtual ~DebtagsDocument();
- aptFront::cache::component::Packages& packages() { return _packages; }
- const aptFront::cache::component::Packages& packages() const { return _packages; }
+ Index& packages() { return _agg.index(); }
+ const Index& packages() const { return _agg.index(); }
- aptFront::cache::component::PackageTags& debtags() { return _debtags; }
- const aptFront::cache::component::PackageTags& debtags() const { return _debtags; }
+ TagMap& debtags() { return _agg.tagMap(); }
+ const TagMap& debtags() const { return _agg.tagMap(); }
- aptFront::cache::component::Tags& vocabulary() { return _voc; }
- const aptFront::cache::component::Tags& vocabulary() const { return _voc; }
+ Vocabulary& vocabulary() { return _agg.vocabulary(); }
+ const Vocabulary& vocabulary() const { return _agg.vocabulary(); }
- const Tagcoll::PatchList<Package, Tag>& getPatch() const
+ const tagcoll::PatchList<Package, Tag> getPatch() const
{
return debtags().changes();
}
@@ -139,19 +151,19 @@
Package& current() { return _current; }
const Package& current() const { return _current; }
- Tagcoll::OpSet<Tag> currentTags() const
+ std::set<Tag> currentTags() const
{
if (_current.valid())
- return debtags().tagdb().getTags(_current);
+ return debtags().getTagsOfItem(_current);
else
- return Tagcoll::OpSet<Tag>();
+ return std::set<Tag>();
}
void setCurrent(const Package& pkg);
// Apply a change, appending the reverse change in the undo buffer
- void applyChange(const Tagcoll::Patch<Package, Tag>& change);
- void applyChange(const Tagcoll::PatchList<Package, Tag>& change);
+ void applyChange(const tagcoll::Patch<Package, Tag>& change);
+ void applyChange(const tagcoll::PatchList<Package, Tag>& change);
bool canUndo() const;
bool canRedo() const;
@@ -164,15 +176,15 @@
void reapply(const Package& pkg);
//void load() throw (FileException, ParserException);
- void save() throw (Tagcoll::FileException);
- void send() throw (Tagcoll::FileException);
+ void save() throw (wibble::exception::File);
+ void send() throw (wibble::exception::File);
//void output(TagcollConsumer<T>& consumer) throw ();
//void output(TagcollConsumer<int>& consumer) throw ();
// Results of the package filter
//Debtags::PackageSet currentPackages;
- Tagcoll::InputMerger<Package, Tag> subCollection;
+ tagcoll::coll::Fast<Package, Tag> subCollection;
//Debtags::Specials<Package> specials;
enum { YES, NO, GENERATING } hasSpecials;
Modified: debtags-edit/1.2/src/FilterPanel.cc
==============================================================================
--- debtags-edit/1.2/src/FilterPanel.cc (original)
+++ debtags-edit/1.2/src/FilterPanel.cc Mon Aug 14 23:16:22 2006
@@ -20,18 +20,40 @@
#include "FilterPanel.h"
-#include <tagcoll/stringf.h>
+#include "Environment.h"
+
+#include <sstream>
+#include <iostream>
+
+//#include <wibble/consumer.h>
+
+#include <tagcoll/stream/filters.h>
+#include <tagcoll/stream/expression.h>
+
+#include <ept/predicate/combinators.h>
+#include <ept/predicate/factory.h>
+
+#if 0
+#include <ept/predicate/matchers.h>
+#include <ept/cache/cache.h>
+#include <ept/cache/package.h>
+#include <ept/cache/apt/packages.h>
+#endif
-#include <tagcoll/Expression.h>
+#if 0
+#include <tagcoll/expression.h>
#include <tagcoll/Filters.h>
-#include "Environment.h"
+#include <ept/cache/debtags/expression.h>
+#endif
+#if 0
#include <apt-front/cache/component/debtags/utils.h>
#include <apt-front/predicate/predicate.h>
#include <apt-front/predicate/factory.h>
#include <apt-front/predicate/combinators.h>
#include <apt-front/predicate/matchers.h>
#include <apt-front/utils/consumer.h>
+#endif
#include "DebtagsDocument.h"
@@ -51,9 +73,9 @@
using namespace std;
-using namespace Tagcoll;
-using namespace aptFront;
-using namespace cache;
+using namespace ept;
+using namespace configuration::apt;
+//using namespace cache;
//#define MAX_VISIBLE_PKG 200
@@ -216,50 +238,46 @@
DOC& doc;
- class Stats : public Consumer<Package, Tag>, public std::map<Facet, int>
+ class Stats : public std::map<Facet, int>
{
protected:
DOC& doc;
const Facet& pivot;
- OpSet<Facet> facets;
+ std::set<Facet> facets;
- void update(const Tagcoll::OpSet<Tag>& tags, int count)
+ void update(const std::set<Tag>& tags, int count)
{
- OpSet<Facet> has;
- for (typename OpSet<Tag>::const_iterator i = tags.begin();
+ std::set<Facet> has;
+ for (typename std::set<Tag>::const_iterator i = tags.begin();
i != tags.end(); i++)
has += i->facet();
if (has.contains(pivot))
{
has = facets - has;
- for (typename OpSet<Facet>::const_iterator i = has.begin(); i != has.end(); i++)
+ for (typename std::set<Facet>::const_iterator i = has.begin(); i != has.end(); i++)
(*this)[*i] += count;
}
}
- void consumeItemUntagged(const Package& pkg) {}
- void consumeItemsUntagged(const Package& pkg) {}
- void consumeItem(const Package& item, const Tagcoll::OpSet<Tag>& tags)
- {
- update(tags, 1);
- }
- void consumeItems(const Tagcoll::OpSet<Package>& items, const Tagcoll::OpSet<Tag>& tags)
- {
- update(tags, items.size());
- }
public:
Stats(DOC& doc, const Facet& pivot) : doc(doc), pivot(pivot)
{
facets = doc.vocabulary().facets();
}
virtual ~Stats() {}
+
+ template<typename ITEMS, typename TAGS>
+ void insert(const ITEMS& items, const TAGS& tags)
+ {
+ update(tags, items.size());
+ }
};
void on_master_changed()
{
Facet master = getMasterFacet();
- fprintf(stderr, "masterchanged %.*s\n", PFSTR(master.name()));
+ cerr << "masterchanged " << master.name() << endl;
slaveListModel->clear();
@@ -277,7 +295,9 @@
{
row = *(slaveListModel->append());
row[slaveListModelColumns.facet] = i->second;
- row[slaveListModelColumns.label] = i->second.name() + " (" + stringf::fmt(i->first) + ")";
+ stringstream str;
+ str << i->second.name() << " (" << i->first << ")";
+ row[slaveListModelColumns.label] = str.str();
}
}
@@ -286,7 +306,7 @@
Facet master = getMasterFacet();
Facet slave = getSlaveFacet();
- fprintf(stderr, "-> %.*s::* && ! %.*s::*\n", PFSTR(master.name()), PFSTR(slave.name()));
+ cerr << "-> " << master.name() << "::* && ! " << slave.name() << "::*" << endl;
}
public:
@@ -329,8 +349,8 @@
add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
Gtk::TreeModel::Row row;
- OpSet<Facet> facets = doc.vocabulary().facets();
- for (typename OpSet<Facet>::const_iterator i = facets.begin();
+ std::set<Facet> facets = doc.vocabulary().facets();
+ for (typename std::set<Facet>::const_iterator i = facets.begin();
i != facets.end(); i++)
{
row = *(masterListModel->append());
@@ -389,7 +409,7 @@
int selected;
std::string selectedLabel;
Facet specialFacet;
- OpSet<Package> specialPackages;
+ std::set<Package> specialPackages;
void on_selected_changed(int val)
{
@@ -473,7 +493,7 @@
std::string getSelectedLabel() { return selectedLabel; }
int getSelected() { return selected; }
Facet getSpecialFacet() { return specialFacet; }
- OpSet<Package> getSpecialPackages() { return specialPackages; }
+ std::set<Package> getSpecialPackages() { return specialPackages; }
};
@@ -504,7 +524,11 @@
if (!specialFacet)
specialQuery.set_label(dialog.getSelectedLabel());
else
- specialQuery.set_label("Special: " + specialFacet.name() + " (" + stringf::fmt(specialPackages.size()) + ")");
+ {
+ stringstream str;
+ str << "Special: " << specialFacet.name() << " (" << specialPackages.size() << ")";
+ specialQuery.set_label(str.str());
+ }
}
updateList();
}
@@ -548,40 +572,31 @@
};
#endif
-template<class DOC>
-void FilterPanel<DOC>::outputSpecialColl(Consumer<Package, Tag>& consumer)
+template<class DOC> template<typename OUT>
+void FilterPanel<DOC>::outputSpecialColl(OUT& consumer)
{
if (specialID == -1)
{
- Tagcoll::FilterItemsByExpression<Package, Tag> filter(
- consumer, specialExpression);
- doc.debtags().tagdb().output(filter);
+ doc.debtags().output(tagcoll::stream::filterItemsByExpression(specialExpression, consumer));
} else if (specialID == 0) {
- doc.debtags().tagdb().output(consumer);
+ doc.debtags().output(consumer);
} else if (specialID == 1) {
- UntaggedRemover<Package, Tag> filter(consumer, true);
- doc.debtags().tagdb().output(filter);
+ doc.debtags().output(tagcoll::stream::untaggedRemover(consumer, true));
} else if (specialID == 2) {
- Tagcoll::FilterItemsByExpression<Package, Tag> filter(
- consumer, "uitoolkit::* && !interface::*");
- doc.debtags().tagdb().output(filter);
+ doc.debtags().output(tagcoll::stream::filterItemsByExpression("uitoolkit::* && !interface::*", consumer));
} else if (specialID == 3) {
- Tagcoll::FilterItemsByExpression<Package, Tag> filter(
- consumer, "uitoolkit::* && !implemented-in::*");
- doc.debtags().tagdb().output(filter);
+ doc.debtags().output(tagcoll::stream::filterItemsByExpression("uitoolkit::* && !implemented-in::*", consumer));
} else if (specialID == 4) {
- Tagcoll::FilterItemsByExpression<Package, Tag> filter(
- consumer, "!role::*");
- doc.debtags().tagdb().output(filter);
+ doc.debtags().output(tagcoll::stream::filterItemsByExpression("!role::*", consumer));
} else {
if (!specialFacet)
{
warning("I don't know how to handle special ID %d", specialID);
} else {
- for (typename OpSet<Package>::const_iterator i = specialPackages.begin();
+ for (typename std::set<Package>::const_iterator i = specialPackages.begin();
i != specialPackages.end(); i++)
{
- OpSet<Tag> tags = doc.debtags().tagdb().getTags(*i);
+ std::set<Tag> tags = doc.debtags().tagdb().getTags(*i);
if (tags.empty())
consumer.consume(*i);
else
@@ -597,20 +612,29 @@
submitButton.set_sensitive(true);
}
-template< typename PKG, typename TAG >
-class TagcollConsumerAdaptor : public utils::ConsumerImpl< PKG, TagcollConsumerAdaptor<PKG, TAG> >
+template<typename OUT>
+class TagAdder : public wibble::mixin::OutputIterator< TagAdder<OUT> >
{
-protected:
- Consumer<PKG, TAG>& m_out;
+ OUT out;
public:
- TagcollConsumerAdaptor( Consumer<PKG, TAG>& out) : m_out( out ) {}
- virtual void consume( const PKG& a ) {
- if (a != PKG())
- m_out.consume(a, a.tags());
- }
+ TagAdder(const OUT& out) : out(out) {}
+
+ template<typename Package>
+ TagAdder<OUT>& operator=(const Package& pkg)
+ {
+ *out = make_pair(wibble::singleton(pkg), pkg.tags());
+ ++out;
+ return *this;
+ }
};
+template<typename OUT>
+TagAdder<OUT> tagAdder(const OUT& out)
+{
+ return TagAdder<OUT>(out);
+}
+
template<class DOC>
void FilterPanel<DOC>::reselect()
{
@@ -634,6 +658,8 @@
}
}
+#define AUTO(y, x...) typeof(x) y = x
+
template<class DOC>
void FilterPanel<DOC>::updateList()
{
@@ -663,28 +689,28 @@
string name_f = nameFilter.get_text();
string desc_f = ftextFilter.get_text();
string maint_f = maintFilter.get_text();
- OpSet<Tag> tags_f = tagSelector.selected();
+ std::set<Tag> tags_f = tagSelector.selected();
predicate::Predicate<Package> p = predicate::True<Package>();
if (!name_f.empty())
{
- p = p and predicate::Factory<Package>::name(name_f);
+ p = p and match::Package::name(name_f);
filters = true;
}
if (!desc_f.empty())
{
- p = p and predicate::Factory<Package>::description(desc_f);
+ p = p and (match::Package::shortDescription(desc_f) or
+ match::Package::longDescription(desc_f));
filters = true;
}
if (!maint_f.empty())
{
- p = p and predicate::Factory<Package>::maintainer(maint_f);
+ p = p and match::Package::maintainer(maint_f);
filters = true;
}
- for (typename OpSet<Tag>::const_iterator i = tags_f.begin();
- i != tags_f.end(); i++)
+ if (!tags_f.empty())
{
- p = p and predicate::Factory<Package>::tag(*i);
+ p = p and match::Package::tagSet(tags_f);
filters = true;
}
switch (statusFilter.get_history())
@@ -741,13 +767,10 @@
if (filters)
{
- utils::Range<Package> r = filteredRange(
- utils::Range<Package>(range(doc.packages().packagesBegin(), doc.packages().packagesEnd())), p);
- r.output(TagcollConsumerAdaptor<Package, Tag>(doc.subCollection));
+ AUTO(r, filteredRange(doc.packages().range(), p));
+ r.output(wibble::consumer(tagAdder(tagcoll::coll::inserter(doc.subCollection))));
} else {
- for (component::Packages::iterator i = doc.packages().packagesBegin();
- i != doc.packages().packagesEnd(); ++i)
- doc.subCollection.consume(*i, i->tags());
+ doc.packages().range().output(wibble::consumer(tagAdder(tagcoll::coll::inserter(doc.subCollection))));
}
/*
p.apply(utils::range(doc.packages().packagesBegin(), doc.packages().packagesEnd()),
@@ -806,24 +829,24 @@
//PackageBuffer::iterator lastIter = pkgs.size() > max_pkg ? pkgs.begin() + max_pkg : pkgs.end();
- string state;
+ stringstream state;
#ifdef MAX_VISIBLE_PKG
if (doc.subCollection.itemCount() > max_pkg)
{
- state = stringf::fmt(">%d (%d) packages found", max_pkg, doc.subCollection.itemCount());
+ state << ">" << max_pkg << " (" << doc.subCollection.itemCount() << ") packages found";
//printf("The limit of %d visualized packages has been reached: please narrow your search.\n", max_pkg);
} else {
- state = stringf::fmt("%d packages found", doc.subCollection.itemCount());
+ state << doc.subCollection.itemCount() << " packages found";
}
#else
- state = stringf::fmt("%d packages found", doc.subCollection.itemCount());
+ state << doc.subCollection.itemCount() << " packages found";
#endif
- foundStats.set_text(state);
+ foundStats.set_text(state.str());
//pkgs.sort();
itemListModel->clear();
- doc.subCollection.output(*this);
+ doc.subCollection.output(tagcoll::coll::inserter(*this));
/*
printf("UPDATELIST populate\n");
unsigned int j = 0;
@@ -837,33 +860,32 @@
submitButton.set_sensitive(false);
}
-template<class DOC>
-void FilterPanel<DOC>::consumeItemUntagged(const Package& pkg)
+template<class DOC> template<typename ITEMS, typename TAGS>
+void FilterPanel<DOC>::insert(const ITEMS& pkgs, const TAGS& tags)
{
#ifdef MAX_VISIBLE_PKG
static const unsigned int max_pkg = 500;
- if (itemListModel->children().size() > max_pkg)
- return;
#endif
- if (pkg != Package())
+
+ for (typename ITEMS::const_iterator pkg = pkgs.begin(); pkg != pkgs.end(); ++pkg)
{
- Gtk::TreeModel::Row row;
- row = *(itemListModel->append());
- row[itemListModelColumns.pkg] = pkg;
- row[itemListModelColumns.name] = pkg.name();
- row[itemListModelColumns.desc] = pkg.shortDescription(string("(description not available)"));
+#ifdef MAX_VISIBLE_PKG
+ if (itemListModel->children().size() > max_pkg)
+ return;
+#endif
+ if (*pkg != Package())
+ {
+ Gtk::TreeModel::Row row;
+ row = *(itemListModel->append());
+ row[itemListModelColumns.pkg] = *pkg;
+ row[itemListModelColumns.name] = pkg->name();
+ row[itemListModelColumns.desc] = pkg->shortDescription(string("(description not available)"));
+ }
+ //if (sel.find(*i) != sel.end())
+ //itemList.get_selection()->select(row);
}
- //if (sel.find(*i) != sel.end())
- //itemList.get_selection()->select(row);
}
-template<class DOC>
-void FilterPanel<DOC>::consumeItem(const Package& item, const Tagcoll::OpSet<Tag>& tags)
-{
- consume(item);
-}
-
-
/*
bool FilterPanel::do_list_focus_in_event(GdkEventFocus*)
{
Modified: debtags-edit/1.2/src/FilterPanel.h
==============================================================================
--- debtags-edit/1.2/src/FilterPanel.h (original)
+++ debtags-edit/1.2/src/FilterPanel.h Mon Aug 14 23:16:22 2006
@@ -21,8 +21,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <tagcoll/OpSet.h>
-#include <tagcoll/Consumer.h>
+//#include <tagcoll/OpSet.h>
+//#include <tagcoll/Consumer.h>
#include "TagSelector.h"
@@ -38,7 +38,7 @@
#include <gtkmm/radiobutton.h>
template<class DOC>
-class FilterPanel : public Gtk::Frame, public Tagcoll::Consumer<typename DOC::Package, typename DOC::Tag>
+class FilterPanel : public Gtk::Frame
{
protected:
typedef typename DOC::Package Package;
@@ -68,7 +68,7 @@
int specialID;
std::string specialExpression;
Facet specialFacet;
- Tagcoll::OpSet<Package> specialPackages;
+ std::set<Package> specialPackages;
// Tree model columns
class ItemListModelColumns : public Gtk::TreeModel::ColumnRecord
@@ -94,10 +94,8 @@
void reselect();
void updateList();
- void outputSpecialColl(Tagcoll::Consumer<Package, Tag>& consumer);
-
- virtual void consumeItemUntagged(const Package& item);
- virtual void consumeItem(const Package& item, const Tagcoll::OpSet<Tag>& tags);
+ template<typename OUT>
+ void outputSpecialColl(OUT& consumer);
public:
FilterPanel(DOC& doc);
@@ -128,6 +126,9 @@
void do_facets_dialog();
void do_todo_dialog();
+
+ template<typename ITEMS, typename TAGS>
+ void insert(const ITEMS& items, const TAGS& tags);
};
// vim:set ts=4 sw=4:
Modified: debtags-edit/1.2/src/Makefile.am
==============================================================================
--- debtags-edit/1.2/src/Makefile.am (original)
+++ debtags-edit/1.2/src/Makefile.am Mon Aug 14 23:16:22 2006
@@ -7,7 +7,6 @@
debtags_edit_SOURCES = \
Thread.cc \
Environment.cc \
- CommandlineParser.cc \
DebtagsDocument.cc \
TagMenu.cc \
TagSelector.cc \
@@ -24,4 +23,4 @@
INCLUDES = $(LIBAPT_FRONT_CFLAGS) $(LIBTAGCOLL_CFLAGS) $(GTKMM_CFLAGS)
-EXTRA_DIST = CommandlineParser.h DebtagsDocument.h DebtagsEditor.h Environment.h FilterPanel.h Mutex.h PatchReview.h RelatedPanel.h TagEditor.h TagMenu.h TagSelector.h Thread.h
+EXTRA_DIST = DebtagsDocument.h DebtagsEditor.h Environment.h FilterPanel.h Mutex.h PatchReview.h RelatedPanel.h TagEditor.h TagMenu.h TagSelector.h Thread.h
Modified: debtags-edit/1.2/src/TagEditor.cc
==============================================================================
--- debtags-edit/1.2/src/TagEditor.cc (original)
+++ debtags-edit/1.2/src/TagEditor.cc Mon Aug 14 23:16:22 2006
@@ -24,10 +24,12 @@
#include "Environment.h"
+#include <wibble/operators.h>
#include <gtkmm/eventbox.h>
using namespace std;
-using namespace Tagcoll;
+using namespace wibble::operators;
+//using namespace Tagcoll;
//template class TagEditor<DebtagsDocument>;
@@ -107,14 +109,14 @@
void TagEditor<DOC>::on_add_to_selection(Tag tag)
{
//printf("Add to sel: %.*s\n", PFSTR(tag));
- OpSet<Tag> tags;
- tags += tag;
+ std::set<Tag> tags;
+ tags |= tag;
doc.applyChange(
- Patch<typename DOC::Package, Tag>(
+ tagcoll::Patch<typename DOC::Package, Tag>(
doc.current(),
tags,
- OpSet<Tag>()));
+ std::set<Tag>()));
/*
TagSet _selected = doc.currentTags();
@@ -132,13 +134,13 @@
void TagEditor<DOC>::on_del_from_selection(Tag tag)
{
//printf("Del from sel: %.*s\n", PFSTR(tag));
- OpSet<Tag> tags;
- tags += tag;
+ std::set<Tag> tags;
+ tags |= tag;
doc.applyChange(
- Patch<typename DOC::Package, Tag>(
+ tagcoll::Patch<typename DOC::Package, Tag>(
doc.current(),
- OpSet<Tag>(),
+ std::set<Tag>(),
tags));
/*
@@ -250,7 +252,7 @@
{
time_t start = time(NULL);
- OpSet<Tag> _selected = doc.currentTags();
+ std::set<Tag> _selected = doc.currentTags();
if (table)
{
@@ -273,24 +275,24 @@
// Create the facet/tag hierarchy
int facets = 0, tags = 0;
- std::map< Facet, OpSet<Tag> > contents;
- for (typename OpSet<Tag>::const_iterator i = _selected.begin(); i != _selected.end(); i++)
+ std::map< Facet, std::set<Tag> > contents;
+ for (typename std::set<Tag>::const_iterator i = _selected.begin(); i != _selected.end(); i++)
{
// fprintf(stderr, "Tag %.*s facet %.*s name %.*s\n",
// PFSTR(i->fullname()), PFSTR(i->facet().name()), PFSTR(i->name()));
- typename std::map< Facet, OpSet<Tag> >::iterator j = contents.find(i->facet());
+ typename std::map< Facet, std::set<Tag> >::iterator j = contents.find(i->facet());
if (j != contents.end())
{
- j->second += *i;
- tags++;
+ j->second |= *i;
+ ++tags;
}
else
{
- OpSet<Tag> v;
- v += *i;
- contents.insert(pair< Facet, OpSet<Tag> >(i->facet(), v));
- facets++;
- tags++;
+ std::set<Tag> v;
+ v |= *i;
+ contents.insert(pair< Facet, std::set<Tag> >(i->facet(), v));
+ ++facets;
+ ++tags;
}
}
@@ -307,7 +309,7 @@
// Add facets and tags
int row = 0;
- for (typename std::map< Facet, OpSet<Tag> >::const_iterator i = contents.begin(); i != contents.end(); i++)
+ for (typename std::map< Facet, std::set<Tag> >::const_iterator i = contents.begin(); i != contents.end(); i++)
{
//printf("Add facet: %.*s\n", PFSTR(i->first));
@@ -329,7 +331,7 @@
++row;
- for (typename OpSet<Tag>::const_iterator j = i->second.begin(); j != i->second.end(); j++)
+ for (typename std::set<Tag>::const_iterator j = i->second.begin(); j != i->second.end(); j++)
{
//printf("Add tag: %.*s\n", PFSTR(*j));
//table->attach(*manage(new Gtk::Label("")), 0, 1, row, row+1, Gtk::SHRINK);
Modified: debtags-edit/1.2/src/TagMenu.cc
==============================================================================
--- debtags-edit/1.2/src/TagMenu.cc (original)
+++ debtags-edit/1.2/src/TagMenu.cc Mon Aug 14 23:16:22 2006
@@ -23,17 +23,21 @@
#include "Environment.h"
#include "DebtagsDocument.h"
+#include <wibble/operators.h>
+#include <tagcoll/SmartHierarchy.h>
+#if 0
#include <apt-front/cache/component/debtags/utils.h>
#include <tagcoll/CardinalityStore.h>
-#include <tagcoll/SmartHierarchy.h>
+#endif
#include <map>
#include <vector>
#include <string>
using namespace std;
-using namespace Tagcoll;
-using namespace aptFront::cache::component::debtags;
+using namespace wibble::operators;
+//using namespace Tagcoll;
+//using namespace aptFront::cache::component::debtags;
//template class TagMenu<DebtagsDocument>;
@@ -44,11 +48,11 @@
}
template<class DOC>
-void TagMenu<DOC>::populateWith(const OpSet<Tag>& tags) throw ()
+void TagMenu<DOC>::populateWith(const std::set<Tag>& tags) throw ()
{
// Needs std:: not to be confused with some other map in gtkmm
std::map<Facet, vector<Tag> > contents;
- for (typename OpSet<Tag>::const_iterator i = tags.begin(); i != tags.end(); i++)
+ for (typename std::set<Tag>::const_iterator i = tags.begin(); i != tags.end(); i++)
contents[i->facet()].push_back(*i);
for (typename std::map<Facet, vector<Tag> >::const_iterator i = contents.begin(); i != contents.end(); i++)
@@ -70,9 +74,9 @@
}
template<class DOC>
-void TagMenu<DOC>::populateWith(const OpSet<Tag>& tags, const Facet& facet) throw ()
+void TagMenu<DOC>::populateWith(const std::set<Tag>& tags, const Facet& facet) throw ()
{
- for (typename OpSet<Tag>::const_iterator i = tags.begin(); i != tags.end(); i++)
+ for (typename std::set<Tag>::const_iterator i = tags.begin(); i != tags.end(); i++)
{
//printf("Facet: %.*s, tag: %.*s\n", PFSTR(f), PFSTR(t));
if (i->facet() == facet)
@@ -87,14 +91,14 @@
}
template<class DOC>
-void TagMenu<DOC>::populateWith(const OpSet<Tag>& tags, const OpSet<Facet>& toplevelFacets) throw ()
+void TagMenu<DOC>::populateWith(const std::set<Tag>& tags, const std::set<Facet>& toplevelFacets) throw ()
{
// Needs std:: not to be confused with some other map
std::map<Facet, vector<Tag> > contents;
- for (typename OpSet<Tag>::const_iterator i = tags.begin(); i != tags.end(); i++)
+ for (typename std::set<Tag>::const_iterator i = tags.begin(); i != tags.end(); i++)
{
// Filter out non-toplevel facets
- if (!toplevelFacets.contains(i->facet()))
+ if (! (i->facet() <= toplevelFacets))
continue;
typename std::map<Facet, vector<Tag> >::iterator j = contents.find(i->facet());
@@ -133,8 +137,8 @@
populateWith(doc.vocabulary().tags());
}
-template<class DOC>
-void TagMenu<DOC>::populateAvailable(const DOC& doc, const OpSet<Tag>& selectedTags, const Collection<Package, Tag>& items) throw ()
+template<class DOC> template<typename ROCOLL>
+void TagMenu<DOC>::populateAvailable(const DOC& doc, const std::set<Tag>& selectedTags, const ROCOLL& items) throw ()
{
/*
OpSet<Tag> merged;
@@ -158,26 +162,25 @@
populateWith(items.getAllTags() - selectedTags);
}
-template<class DOC>
+template<class DOC> template<typename ROCOLL>
void TagMenu<DOC>::populateAvailableSmart(
const DOC& doc,
- const OpSet<Tag>& selectedTags,
- const Collection<Package, Tag>& items) throw ()
+ const std::set<Tag>& selectedTags,
+ const ROCOLL& items) throw ()
{
// Compute the minimum set of toplevel facets that can be used to select
// all items in `items'
+ typedef tagcoll::HierarchyNode< tagcoll::coll::Fast<Package, Facet> > Node;
- CardinalityStore<Package, Facet> coll;
- OpSet<Facet> toplevelFacets;
+ tagcoll::coll::Fast<Package, Facet> coll;
+ std::set<Facet> toplevelFacets;
// Make a new collection tagged with facets instead of tags
- TagToFacet<Package> tagStripper(coll);
- items.output(tagStripper);
+ items.output(tagStripper(inserter(coll)));
Facet f;
- SmartHierarchyNode<Package, Facet> node(f, coll, 0);
- for (typename HierarchyNode<Package, Facet>::iterator i = node.begin();
- i != node.end(); i++)
+ auto_ptr<Node> node = smartHierarchyNode(f, coll, 0);
+ for (typename Node::iterator i = node->begin(); i != node->end(); ++i)
toplevelFacets += (*i)->tag();
if (toplevelFacets.size() > 5)
@@ -187,35 +190,35 @@
}
template<class DOC>
-void TagMenu<DOC>::populateAvailable(const DOC& doc, const OpSet<Tag>& selectedTags) throw ()
+void TagMenu<DOC>::populateAvailable(const DOC& doc, const std::set<Tag>& selectedTags) throw ()
{
- OpSet<Tag> tags = selectedTags.empty() ?
- doc.debtags().tagdb().getAllTags()
- : doc.debtags().tagdb().getCompanionTags(selectedTags);
+ std::set<Tag> tags = selectedTags.empty() ?
+ doc.debtags().getAllTags()
+ : doc.debtags().getCompanionTags(selectedTags);
//OpSet<Tag> tags = Debtags::Environment::get().tagdb().getCompanionTags(selectedTags);
populateWith(tags);
}
template<class DOC>
-void TagMenu<DOC>::populateAvailable(const DOC& doc, const OpSet<Tag>& selectedTags, const Facet& facet) throw ()
+void TagMenu<DOC>::populateAvailable(const DOC& doc, const std::set<Tag>& selectedTags, const Facet& facet) throw ()
{
- OpSet<Tag> tags = doc.debtags().tagdb().getCompanionTags(selectedTags);
+ std::set<Tag> tags = doc.debtags().getCompanionTags(selectedTags);
populateWith(tags, facet);
}
template<class DOC>
-void TagMenu<DOC>::populateUnselected(const DOC& doc, const OpSet<Tag>& selectedTags) throw ()
+void TagMenu<DOC>::populateUnselected(const DOC& doc, const std::set<Tag>& selectedTags) throw ()
{
- OpSet<Tag> tags = doc.vocabulary().tags() - selectedTags;
+ std::set<Tag> tags = doc.vocabulary().tags() - selectedTags;
//for (OpSet<string>::const_iterator i = tags.begin(); i != tags.end(); i++)
//printf("Sel: %.*s\n", PFSTR(*i));
populateWith(tags);
}
template<class DOC>
-void TagMenu<DOC>::populateUnselected(const DOC& doc, const OpSet<Tag>& selectedTags, const Facet& facet) throw ()
+void TagMenu<DOC>::populateUnselected(const DOC& doc, const std::set<Tag>& selectedTags, const Facet& facet) throw ()
{
- OpSet<Tag> tags = doc.vocabulary().tags() - selectedTags;
+ std::set<Tag> tags = doc.vocabulary().tags() - selectedTags;
//for (OpSet<string>::const_iterator i = tags.begin(); i != tags.end(); i++)
//printf("Sel: %.*s\n", PFSTR(*i));
populateWith(tags, facet);
Modified: debtags-edit/1.2/src/TagMenu.h
==============================================================================
--- debtags-edit/1.2/src/TagMenu.h (original)
+++ debtags-edit/1.2/src/TagMenu.h Mon Aug 14 23:16:22 2006
@@ -22,10 +22,11 @@
*/
#include <gtkmm/menu.h>
-#include <apt-front/cache/entity/tag.h>
+//#include <apt-front/cache/entity/tag.h>
//#include <debtags/PackageSet.h>
-#include <tagcoll/Collection.h>
+//#include <tagcoll/Collection.h>
+#include <set>
#include <vector>
template<class DOC>
@@ -49,9 +50,9 @@
void on_canceled() Se è intercettabile
*/
- void populateWith(const Tagcoll::OpSet<Tag>& tags) throw ();
- void populateWith(const Tagcoll::OpSet<Tag>& tags, const Facet& facet) throw ();
- void populateWith(const Tagcoll::OpSet<Tag>& tags, const Tagcoll::OpSet<Facet>& toplevelFacets) throw ();
+ void populateWith(const std::set<Tag>& tags) throw ();
+ void populateWith(const std::set<Tag>& tags, const Facet& facet) throw ();
+ void populateWith(const std::set<Tag>& tags, const std::set<Facet>& toplevelFacets) throw ();
public:
TagMenu() throw () : Gtk::Menu() {}
@@ -64,16 +65,18 @@
// Populate with all tags
void populateAll(const DOC& doc) throw ();
// Populate with all companion tags of the given tag set
- void populateAvailable(const DOC& doc, const Tagcoll::OpSet<Tag>& selectedTags) throw ();
+ void populateAvailable(const DOC& doc, const std::set<Tag>& selectedTags) throw ();
// Populate with all companion tags of the tags with which the given packages have been tagged
- void populateAvailable(const DOC& doc, const Tagcoll::OpSet<Tag>& selectedTags, const Tagcoll::Collection<Package, Tag>& items) throw ();
- void populateAvailableSmart(const DOC& doc, const Tagcoll::OpSet<Tag>& selectedTags, const Tagcoll::Collection<Package, Tag>& items) throw ();
+ template<typename ROCOLL>
+ void populateAvailable(const DOC& doc, const std::set<Tag>& selectedTags, const ROCOLL& items) throw ();
+ template<typename ROCOLL>
+ void populateAvailableSmart(const DOC& doc, const std::set<Tag>& selectedTags, const ROCOLL& items) throw ();
// Populate with all companion tags of the given tag set in the given facet
- void populateAvailable(const DOC& doc, const Tagcoll::OpSet<Tag>& selectedTags, const Facet& facet) throw ();
+ void populateAvailable(const DOC& doc, const std::set<Tag>& selectedTags, const Facet& facet) throw ();
// Populate with all tags except the ones in selectedTags
- void populateUnselected(const DOC& doc, const Tagcoll::OpSet<Tag>& selectedTags) throw ();
+ void populateUnselected(const DOC& doc, const std::set<Tag>& selectedTags) throw ();
// Populate with all tags except the ones in selectedTags
- void populateUnselected(const DOC& doc, const Tagcoll::OpSet<Tag>& selectedTags, const Facet& facet) throw ();
+ void populateUnselected(const DOC& doc, const std::set<Tag>& selectedTags, const Facet& facet) throw ();
};
// vim:set ts=4 sw=4:
Modified: debtags-edit/1.2/src/TagSelector.cc
==============================================================================
--- debtags-edit/1.2/src/TagSelector.cc (original)
+++ debtags-edit/1.2/src/TagSelector.cc Mon Aug 14 23:16:22 2006
@@ -23,10 +23,13 @@
#include "Environment.h"
+#include <wibble/operators.h>
+
#include <gtkmm/eventbox.h>
using namespace std;
-using namespace Tagcoll;
+using namespace wibble::operators;
+//using namespace Tagcoll;
void TagSelector::do_changed()
{
@@ -102,7 +105,7 @@
{
//printf("Add to sel: %.*s\n", PFSTR(tag));
unsigned int count_pre = _selected.size();
- _selected += tag;
+ _selected |= tag;
if (count_pre != _selected.size())
{
updateView();
@@ -125,8 +128,8 @@
void TagSelector::on_document_changed()
{
time_t start = time(NULL);
- OpSet<DebtagsDocument::Tag> allTags = doc.vocabulary().tags();
- _selected = _selected ^ allTags;
+ std::set<DebtagsDocument::Tag> allTags = doc.vocabulary().tags();
+ _selected = _selected & allTags;
updateView();
time_t end = time(NULL);
if (end != start)
@@ -216,7 +219,7 @@
// Create the facet/tag hierarchy
int facets = 0, tags = 0;
std::map<DebtagsDocument::Facet, std::vector<DebtagsDocument::Tag> > contents;
- for (OpSet<DebtagsDocument::Tag>::const_iterator i = _selected.begin(); i != _selected.end(); i++)
+ for (std::set<DebtagsDocument::Tag>::const_iterator i = _selected.begin(); i != _selected.end(); i++)
{
std::map<DebtagsDocument::Facet, vector<DebtagsDocument::Tag> >::iterator j = contents.find(i->facet());
if (j != contents.end())
Modified: debtags-edit/1.2/src/TagSelector.h
==============================================================================
--- debtags-edit/1.2/src/TagSelector.h (original)
+++ debtags-edit/1.2/src/TagSelector.h Mon Aug 14 23:16:22 2006
@@ -36,7 +36,7 @@
protected:
DebtagsDocument& doc;
- Tagcoll::OpSet<DebtagsDocument::Tag> _selected;
+ std::set<DebtagsDocument::Tag> _selected;
Gtk::Table* table;
Gtk::VBox tableBox;
@@ -71,8 +71,8 @@
virtual void do_add_tag(DebtagsDocument::Tag tag);
virtual void do_remove_tag(DebtagsDocument::Tag tag);
- const Tagcoll::OpSet<DebtagsDocument::Tag>& selected() const throw () { return _selected; }
- const Tagcoll::OpSet<DebtagsDocument::Tag>& selected(const Tagcoll::OpSet<DebtagsDocument::Tag>& tagset) throw ()
+ const std::set<DebtagsDocument::Tag>& selected() const throw () { return _selected; }
+ const std::set<DebtagsDocument::Tag>& selected(const std::set<DebtagsDocument::Tag>& tagset) throw ()
{
_selected = tagset;
updateView();
Modified: debtags-edit/1.2/src/Thread.cc
==============================================================================
--- debtags-edit/1.2/src/Thread.cc (original)
+++ debtags-edit/1.2/src/Thread.cc Mon Aug 14 23:16:22 2006
@@ -19,26 +19,23 @@
*/
#include "Thread.h"
-#include "tagcoll/stringf.h"
-
+#include <sstream>
using namespace std;
-using namespace stringf;
-using namespace Tagcoll;
void* Thread::Starter(void* parm) throw ()
{
return ((Thread*)parm)->main();
}
-void Thread::start() throw (SystemException)
+void Thread::start() throw (wibble::exception::System)
{
int res = pthread_create(&thread, 0, Starter, this);
if (res != 0)
- throw SystemException(res, string("Creating ") + threadTag() + " thread");
+ throw wibble::exception::System(res, string("Creating ") + threadTag() + " thread");
}
-void Thread::startDetached() throw (SystemException)
+void Thread::startDetached() throw (wibble::exception::System)
{
pthread_attr_t thread_attrs;
pthread_attr_init(&thread_attrs);
@@ -46,40 +43,44 @@
int res = pthread_create(&thread, &thread_attrs, Starter, this);
pthread_attr_destroy(&thread_attrs);
if (res != 0)
- throw SystemException(res, string("Creating ") + threadTag() + " thread");
+ throw wibble::exception::System(res, string("Creating ") + threadTag() + " thread");
}
void Thread::testCancel() throw () { pthread_testcancel(); }
-void* Thread::join() throw (SystemException)
+void* Thread::join() throw (wibble::exception::System)
{
void* result = 0;
int res = pthread_join(thread, &result);
if (res != 0)
- throw SystemException(res, string("Joining ") + threadTag() + " thread");
+ throw wibble::exception::System(res, string("Joining ") + threadTag() + " thread");
return result;
}
-void Thread::detach() throw (SystemException)
+void Thread::detach() throw (wibble::exception::System)
{
int res = pthread_detach(thread);
if (res != 0)
- throw SystemException(res, string("Detaching ") + threadTag() + " thread");
+ throw wibble::exception::System(res, string("Detaching ") + threadTag() + " thread");
}
-void Thread::cancel() throw (SystemException)
+void Thread::cancel() throw (wibble::exception::System)
{
int res = pthread_cancel(thread);
if (res != 0)
- throw SystemException(res, string("Cancelling ") + threadTag() + " thread");
+ throw wibble::exception::System(res, string("Cancelling ") + threadTag() + " thread");
}
-void Thread::kill(int signal) throw (SystemException)
+void Thread::kill(int signal) throw (wibble::exception::System)
{
int res = pthread_kill(thread, signal);
if (res != 0)
- throw SystemException(res, string("Killing ") + threadTag() + " thread with signal " + fmt(signal));
+ {
+ stringstream str;
+ str << "Killing " << threadTag() << " thread with signal " << signal;
+ throw wibble::exception::System(res, str.str());
+ }
}
Modified: debtags-edit/1.2/src/Thread.h
==============================================================================
--- debtags-edit/1.2/src/Thread.h (original)
+++ debtags-edit/1.2/src/Thread.h Mon Aug 14 23:16:22 2006
@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <tagcoll/Exception.h>
+#include <wibble/exception.h>
#include <pthread.h>
#include <signal.h>
@@ -69,22 +69,22 @@
virtual ~Thread() throw () {}
/// Start the thread
- void start() throw (Tagcoll::SystemException);
+ void start() throw (wibble::exception::System);
/// Start the thread in the detached state
- void startDetached() throw (Tagcoll::SystemException);
+ void startDetached() throw (wibble::exception::System);
/// Join the thread
- void* join() throw (Tagcoll::SystemException);
+ void* join() throw (wibble::exception::System);
/// Put the thread in the detached state
- void detach() throw (Tagcoll::SystemException);
+ void detach() throw (wibble::exception::System);
/// Send a cancellation request to the thread
- void cancel() throw (Tagcoll::SystemException);
+ void cancel() throw (wibble::exception::System);
/// Sent a signal to the thread
- void kill(int signal) throw (Tagcoll::SystemException);
+ void kill(int signal) throw (wibble::exception::System);
};
// vim:set ts=4 sw=4:
More information about the Debtags-commits
mailing list