[Debtags-commits] [svn] r1849 - in debtags-edit/1.2: . src
Enrico Zini
enrico at costa.debian.org
Tue Aug 15 17:12:19 UTC 2006
Author: enrico
Date: Tue Aug 15 17:12:17 2006
New Revision: 1849
Added:
debtags-edit/1.2/src/DebtagsEditOptions.h
Removed:
debtags-edit/1.2/src/instantiations.cc
debtags-edit/1.2/src/instantiations1.cc
Modified:
debtags-edit/1.2/ (props changed)
debtags-edit/1.2/src/DebtagsDocument.cc
debtags-edit/1.2/src/DebtagsDocument.h
debtags-edit/1.2/src/DebtagsEditor.cc
debtags-edit/1.2/src/DebtagsEditor.h
debtags-edit/1.2/src/FilterPanel.cc
debtags-edit/1.2/src/Makefile.am
debtags-edit/1.2/src/PatchReview.cc
debtags-edit/1.2/src/PatchReview.h
debtags-edit/1.2/src/RelatedPanel.cc
debtags-edit/1.2/src/TagEditor.cc
debtags-edit/1.2/src/TagEditor.h
debtags-edit/1.2/src/TagMenu.cc
debtags-edit/1.2/src/Thread.cc
debtags-edit/1.2/src/Thread.h
debtags-edit/1.2/src/debtags-edit.cc
Log:
r3160 at viaza: enrico | 2006-08-15 14:45:35 +0100
More porting
Modified: debtags-edit/1.2/src/DebtagsDocument.cc
==============================================================================
--- debtags-edit/1.2/src/DebtagsDocument.cc (original)
+++ debtags-edit/1.2/src/DebtagsDocument.cc Tue Aug 15 17:12:17 2006
@@ -1,7 +1,7 @@
/*
* Tagged Collection document for a Document-View editing architecture
*
- * Copyright (C) 2003 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -391,4 +391,14 @@
i != _collection.end(); i++)
consumer.consume(i->second, i->first);
}*/
+
+#include <ept/cache/debtags/tagmap.tcc>
+#include <ept/cache/debtags/vocabulary.tcc>
+#include <ept/cache/apt/index.tcc>
+#include <ept/cache/apt/packages.tcc>
+#include <ept/cache/apt/records.tcc>
+#include <ept/cache/apt/state.tcc>
+#include <ept/cache/tag.tcc>
+
+
// vim:set ts=4 sw=4:
Modified: debtags-edit/1.2/src/DebtagsDocument.h
==============================================================================
--- debtags-edit/1.2/src/DebtagsDocument.h (original)
+++ debtags-edit/1.2/src/DebtagsDocument.h Tue Aug 15 17:12:17 2006
@@ -4,7 +4,7 @@
/*
* Tagged Collection document for a Document-View editing architecture
*
- * Copyright (C) 2003 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: debtags-edit/1.2/src/DebtagsEditor.cc
==============================================================================
--- debtags-edit/1.2/src/DebtagsEditor.cc (original)
+++ debtags-edit/1.2/src/DebtagsEditor.cc Tue Aug 15 17:12:17 2006
@@ -1,7 +1,7 @@
/*
* Main application class
*
- * Copyright (C) 2003,2004,2005 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,7 +20,6 @@
#include "DebtagsEditor.h"
-#include <tagcoll/stringf.h>
#include <tagcoll/Patches.h>
#include "Environment.h"
#include "DebtagsDocument.h"
@@ -32,7 +31,6 @@
#include <map>
using namespace std;
-using namespace Tagcoll;
//template class DebtagsEditor<DebtagsDocument>;
@@ -337,8 +335,8 @@
try {
doc.save();
//setChanged(false);
- } catch (Exception& e) {
- Gtk::MessageDialog err(string("Save failed: ") + e.desc() + " (" + e.type() + ")",
+ } catch (std::exception& e) {
+ Gtk::MessageDialog err(string("Save failed: ") + e.what(),
false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
err.run();
}
@@ -356,8 +354,8 @@
doc.send();
Gtk::MessageDialog oki("Mail sent.", false, Gtk::MESSAGE_INFO, Gtk::BUTTONS_OK, true);
oki.run();
- } catch (Exception& e) {
- Gtk::MessageDialog err(string("Send failed: ") + e.desc() + " (" + e.type() + ")",
+ } catch (std::exception& e) {
+ Gtk::MessageDialog err(string("Send failed: ") + e.what(),
false, Gtk::MESSAGE_ERROR, Gtk::BUTTONS_OK, true);
err.run();
}
Modified: debtags-edit/1.2/src/DebtagsEditor.h
==============================================================================
--- debtags-edit/1.2/src/DebtagsEditor.h (original)
+++ debtags-edit/1.2/src/DebtagsEditor.h Tue Aug 15 17:12:17 2006
@@ -4,7 +4,7 @@
/*
* Main application class
*
- * Copyright (C) 2003,2004,2005 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: debtags-edit/1.2/src/FilterPanel.cc
==============================================================================
--- debtags-edit/1.2/src/FilterPanel.cc (original)
+++ debtags-edit/1.2/src/FilterPanel.cc Tue Aug 15 17:12:17 2006
@@ -1,7 +1,7 @@
/*
* A single view on a TagcollDocument
*
- * Copyright (C) 2003 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -250,12 +250,12 @@
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 |= i->facet();
+ if (pivot <= has)
{
has = facets - has;
for (typename std::set<Facet>::const_iterator i = has.begin(); i != has.end(); i++)
- (*this)[*i] += count;
+ (*this)[*i] |= count;
}
}
@@ -283,7 +283,7 @@
Gtk::TreeModel::Row row;
Stats stats(doc, master);
- doc.debtags().outputPatched(stats);
+ doc.debtags().outputPatched(tagcoll::coll::inserter(stats));
std::map<int, Facet> rstats;
for (typename Stats::const_iterator i = stats.begin();
i != stats.end(); i++)
@@ -768,9 +768,9 @@
if (filters)
{
AUTO(r, filteredRange(doc.packages().range(), p));
- r.output(wibble::consumer(tagAdder(tagcoll::coll::inserter(doc.subCollection))));
+ std::copy(r.begin(), r.end(), tagAdder(tagcoll::coll::inserter(doc.subCollection)));
} else {
- doc.packages().range().output(wibble::consumer(tagAdder(tagcoll::coll::inserter(doc.subCollection))));
+ std::copy(doc.packages().begin(), doc.packages().end(), tagAdder(tagcoll::coll::inserter(doc.subCollection)));
}
/*
p.apply(utils::range(doc.packages().packagesBegin(), doc.packages().packagesEnd()),
@@ -896,5 +896,10 @@
template class FilterPanel<DebtagsDocument>;
+#include <tagcoll/coll/fast.tcc>
+#include <ept/cache/debtags/tagmap.tcc>
+#include <ept/cache/apt/packages.tcc>
+#include <ept/cache/apt/records.tcc>
+#include <ept/cache/apt/state.tcc>
// 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 Tue Aug 15 17:12:17 2006
@@ -15,12 +15,9 @@
RelatedPanel.cc \
PatchReview.cc \
DebtagsEditor.cc \
- debtags-edit.cc \
- instantiations.cc
- instantiations.cc \
- instantiations1.cc
-debtags_edit_LDADD = $(LIBAPT_FRONT_LIBS) $(LIBTAGCOLL_LIBS) $(GTKMM_LIBS) -lpthread -lrt
+ debtags-edit.cc
+debtags_edit_LDADD = $(LIBEPT_LIBS) $(GTKMM_LIBS) -lpthread -lrt
-INCLUDES = $(LIBAPT_FRONT_CFLAGS) $(LIBTAGCOLL_CFLAGS) $(GTKMM_CFLAGS)
+INCLUDES = $(LIBEPT_CFLAGS) $(GTKMM_CFLAGS)
-EXTRA_DIST = 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 DebtagsEditOptions.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/PatchReview.cc
==============================================================================
--- debtags-edit/1.2/src/PatchReview.cc (original)
+++ debtags-edit/1.2/src/PatchReview.cc Tue Aug 15 17:12:17 2006
@@ -1,7 +1,7 @@
/*
* Main application class
*
- * Copyright (C) 2003,2004,2005 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003,2004,2005,2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -26,7 +26,6 @@
#include <gtkmm/paned.h>
using namespace std;
-using namespace Tagcoll;
template<class DOC>
PatchReview<DOC>::PatchReview(DOC& doc)
@@ -294,7 +293,7 @@
template<class DOC>
void PatchReview<DOC>::updatePackages()
{
- typedef PatchList<Package, Tag> patch_t;
+ typedef tagcoll::PatchList<Package, Tag> patch_t;
const patch_t& patch = doc.getPatch();
patchListModel->clear();
@@ -308,15 +307,15 @@
row = *(patchListModel->append());
row[patchListModelColumns.pkg] = i->first;
row[patchListModelColumns.name] = i->first.name();
- const OpSet<Tag>& added = i->second.getAdded();
- const OpSet<Tag>& removed = i->second.getRemoved();
+ const std::set<Tag>& added = i->second.getAdded();
+ const std::set<Tag>& removed = i->second.getRemoved();
string p;
- for (typename OpSet<Tag>::const_iterator j = added.begin(); j != added.end(); j++)
+ for (typename std::set<Tag>::const_iterator j = added.begin(); j != added.end(); j++)
if (p.empty())
p += "+" + j->fullname();
else
p += ", +" + j->fullname();
- for (typename OpSet<Tag>::const_iterator j = removed.begin(); j != removed.end(); j++)
+ for (typename std::set<Tag>::const_iterator j = removed.begin(); j != removed.end(); j++)
if (p.empty())
p += "-" + j->fullname();
else
@@ -331,7 +330,7 @@
template<class DOC>
void PatchReview<DOC>::updateCurrent()
{
- typedef PatchList<Package, Tag> patch_t;
+ typedef tagcoll::PatchList<Package, Tag> patch_t;
const patch_t& patch = doc.getPatch();
typename patch_t::const_iterator p = patch.find(doc.current());
Glib::RefPtr<Gtk::TreeSelection> sel = patchList.get_selection();
@@ -348,10 +347,10 @@
descrBuf->set_text("Unable to access package informations");
}
- const OpSet<Tag>& added = p->second.getAdded();
- const OpSet<Tag>& removed = p->second.getRemoved();
+ const std::set<Tag>& added = p->second.getAdded();
+ const std::set<Tag>& removed = p->second.getRemoved();
- for (typename OpSet<Tag>::const_iterator i = added.begin();
+ for (typename std::set<Tag>::const_iterator i = added.begin();
i != added.end(); i++)
{
Gtk::TreeModel::Row row;
@@ -361,7 +360,7 @@
row[tagListModelColumns.sdesc] = i->shortDescription();
}
- for (typename OpSet<Tag>::const_iterator i = removed.begin();
+ for (typename std::set<Tag>::const_iterator i = removed.begin();
i != removed.end(); i++)
{
Gtk::TreeModel::Row row;
@@ -590,5 +589,7 @@
template class PatchReview<DebtagsDocument>;
+#include <ept/cache/apt/packages.tcc>
+#include <ept/cache/debtags/tagmap.tcc>
// vim:set ts=4 sw=4:
Modified: debtags-edit/1.2/src/PatchReview.h
==============================================================================
--- debtags-edit/1.2/src/PatchReview.h (original)
+++ debtags-edit/1.2/src/PatchReview.h Tue Aug 15 17:12:17 2006
@@ -2,9 +2,9 @@
#define PATCH_REVIEW_H
/*
- * Main application class
+ * Patch review panel
*
- * Copyright (C) 2003,2004,2005 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003,2004,2005,2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,7 +29,7 @@
/**
- * Main application window
+ * Patch review panel
*
* Contains:
* \verbatim
Modified: debtags-edit/1.2/src/RelatedPanel.cc
==============================================================================
--- debtags-edit/1.2/src/RelatedPanel.cc (original)
+++ debtags-edit/1.2/src/RelatedPanel.cc Tue Aug 15 17:12:17 2006
@@ -1,7 +1,7 @@
/*
* A single view on a TagcollDocument
*
- * Copyright (C) 2003 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,12 +20,13 @@
#include "RelatedPanel.h"
-#include <tagcoll/stringf.h>
-
#include "DebtagsDocument.h"
#include <map>
#include <algorithm>
+#include <sstream>
+
+#include <wibble/operators.h>
#include <gtkmm/table.h>
#include <gtkmm/label.h>
@@ -33,7 +34,7 @@
#include <gtkmm/treemodel.h>
using namespace std;
-using namespace Tagcoll;
+using namespace wibble::operators;
//template class RelatedPanel<DebtagsDocument>;
@@ -94,27 +95,27 @@
unsigned int dist = 0;
//pkgs.clear();
- OpSet<Tag> ref = doc.debtags().tagdb().getTags(pivot);
- OpSet<Package> related;
+ std::set<Tag> ref = doc.debtags().getTagsOfItem(pivot);
+ std::set<Package> related;
for ( ; related.size() == 0 && dist <= ref.size(); dist++)
{
fprintf(stderr, "Trying distance %d...\n", dist);
//Debtags::Environment::get().outputRelated(pkgs, pivot, dist);
- related += doc.debtags().tagdb().getRelatedItems(pivot.tags(), dist);
+ related |= doc.debtags().getRelatedItems(pivot.tags(), dist);
//related.output(pkgs);
}
//PackageBuffer::const_iterator lastIter = pkgs.size() > max_pkg ? pkgs.begin() + max_pkg : pkgs.end();
- string state;
+ stringstream state;
if (related.size() > max_pkg)
{
- state = stringf::fmt(">%d (%d) packages at distance %d", max_pkg, related.size(), dist);
+ state << ">" << max_pkg << " (" << related.size() << ") packages at distance " << dist;
//printf("The limit of %d visualized packages has been reached: please narrow your search.\n", max_pkg);
} else {
- state = stringf::fmt("%d packages at distance %d", related.size(), dist);
+ state << related.size() << " packages at distance " << dist;
}
- foundStats.set_text(state);
+ foundStats.set_text(state.str());
//pkgs.sort();
@@ -122,7 +123,7 @@
Gtk::TreeModel::Row row;
itemListModel->clear();
unsigned int count = 0;
- for (typename OpSet<Package>::const_iterator i = related.begin(); count < max_pkg && i != related.end(); i++, count++)
+ for (typename std::set<Package>::const_iterator i = related.begin(); count < max_pkg && i != related.end(); i++, count++)
{
//printf("rpUPDATELIST: %.*s\n", PFSTR((*i)->name()));
if (*i != Package())
@@ -139,5 +140,6 @@
template class RelatedPanel<DebtagsDocument>;
+#include <ept/cache/debtags/tagmap.tcc>
// vim:set ts=4 sw=4:
Modified: debtags-edit/1.2/src/TagEditor.cc
==============================================================================
--- debtags-edit/1.2/src/TagEditor.cc (original)
+++ debtags-edit/1.2/src/TagEditor.cc Tue Aug 15 17:12:17 2006
@@ -1,7 +1,7 @@
/*
* Tag list and selector widget
*
- * Copyright (C) 2003 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: debtags-edit/1.2/src/TagEditor.h
==============================================================================
--- debtags-edit/1.2/src/TagEditor.h (original)
+++ debtags-edit/1.2/src/TagEditor.h Tue Aug 15 17:12:17 2006
@@ -4,7 +4,7 @@
/*
* Tag list and selector widget
*
- * Copyright (C) 2003 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--2006 Enrico Zini <enrico at debian.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Modified: debtags-edit/1.2/src/TagMenu.cc
==============================================================================
--- debtags-edit/1.2/src/TagMenu.cc (original)
+++ debtags-edit/1.2/src/TagMenu.cc Tue Aug 15 17:12:17 2006
@@ -228,5 +228,8 @@
template class TagMenu<DebtagsDocument>;
+#include <ept/cache/tag.tcc>
+#include <ept/cache/debtags/vocabulary.tcc>
+#include <ept/cache/debtags/tagmap.tcc>
// vim:set ts=4 sw=4:
Modified: debtags-edit/1.2/src/Thread.cc
==============================================================================
--- debtags-edit/1.2/src/Thread.cc (original)
+++ debtags-edit/1.2/src/Thread.cc Tue Aug 15 17:12:17 2006
@@ -1,7 +1,7 @@
/*
* OO encapsulation of Posix threads
*
- * Copyright (C) 2003 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--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
Modified: debtags-edit/1.2/src/Thread.h
==============================================================================
--- debtags-edit/1.2/src/Thread.h (original)
+++ debtags-edit/1.2/src/Thread.h Tue Aug 15 17:12:17 2006
@@ -4,7 +4,7 @@
/*
* OO encapsulation of Posix threads
*
- * Copyright (C) 2003 Enrico Zini <enrico at debian.org>
+ * Copyright (C) 2003--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
Modified: debtags-edit/1.2/src/debtags-edit.cc
==============================================================================
--- debtags-edit/1.2/src/debtags-edit.cc (original)
+++ debtags-edit/1.2/src/debtags-edit.cc Tue Aug 15 17:12:17 2006
@@ -1,7 +1,7 @@
/*
* tagcolledit - GUI for editing tagged collections
*
- * Copyright (C) 2003 Enrico Zini
+ * Copyright (C) 2003--2006 Enrico Zini
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -27,14 +27,12 @@
#define PACKAGE_VERSION "unknown"
#endif
-#include <tagcoll/Exception.h>
-#include <tagcoll/stringf.h>
-
-#include <apt-front/init.h>
-#include <apt-front/cache/cache.h>
+#include <wibble/exception.h>
+#include <ept/init.h>
+#include <ept/configuration/apt.h>
#include "Environment.h"
-#include "CommandlineParser.h"
+#include "DebtagsEditOptions.h"
#include "DebtagsDocument.h"
#include "DebtagsEditor.h"
@@ -42,57 +40,32 @@
#include <gtkmm/main.h>
using namespace std;
-using namespace Tagcoll;
+using namespace ept::configuration::apt;
int main(int argc, char* argv[])
{
try {
// Install the handler for unexpected exceptions
- InstallUnexpected installUnexpected;
+ wibble::exception::InstallUnexpected installUnexpected;
- CommandlineParser opts(APPNAME, "[options]",
- "GUI editor for Debian package tags\n"
- "Edits the Debian Package Tags database present on the system\n"
- "saving the changes in ~/.debtags-edit\n");
- opts.add("version", 0, "version", "print the program version, then exit");
- opts.add("verbose", 0, "verbose", "enable verbose output");
- opts.add("debug", 0, "debug", "enable debugging output (including verbose output)");
+ wibble::commandline::DebtagsEditOptions opts;
- // Process the commandline
- if (!opts.parse(argc, argv))
- {
- opts.printHelp();
- return 1;
- }
- if (opts.get("help").defined())
- {
- opts.printHelp();
+ if (opts.parse(argc, (const char**)argv))
return 0;
- }
- if (opts.get("version").defined())
- {
- printf("%s ver." PACKAGE_VERSION "\n", APPNAME);
- return 0;
- }
- if (opts.get("verbose").defined())
- Environment::get().verbose(true);
- if (opts.get("debug").defined())
- Environment::get().debug(true);
- if (!aptFront::cache::component::PackageTags::hasTagDatabase())
+ if (opts.out_verbose->boolValue())
+ ::Environment::get().verbose(true);
+
+ if (opts.out_debug->boolValue())
+ ::Environment::get().debug(true);
+
+ if (!cache::TagMap::hasTagDatabase())
{
fprintf(stderr, "Debtags database has not been found. Please run debtags update and try again\n");
return 1;
}
- aptFront::init();
- // Opens the package cache
- // 0 is a pointer to an optional OpProgress object for status feedback
- aptFront::cache::Global::get().open(aptFront::cache::Cache::OpenDefault
- | aptFront::cache::Cache::OpenReadOnly
- | aptFront::cache::Cache::OpenTags
- | aptFront::cache::Cache::OpenDebtagsEditable);
-
+ ept::init();
//Debtags::Environment::init(true);
//printf("State dir is %.*s\n", PFSTR(Debtags::TagDB<Debtags::Package>::statedir()));
@@ -128,11 +101,13 @@
return 0;
}
- catch (Exception& e)
+ catch (std::exception& e)
{
- fatal_error("%s: %.*s\n", e.type(), PFSTR(e.desc()));
+ fatal_error("%s\n", e.what());
return 1;
}
}
+#include <ept/cache/debtags/tagmap.tcc>
+
// vim:set ts=4 sw=4:
More information about the Debtags-commits
mailing list