26 #ifndef EPT_DEBTAGS_DEBTAGS_H
27 #define EPT_DEBTAGS_DEBTAGS_H
33 #include <tagcoll/coll/base.h>
34 #include <tagcoll/coll/intdiskindex.h>
35 #include <tagcoll/coll/patched.h>
44 template<
typename _,
typename _1 >
class PatchList;
49 struct coll_traits< ept::debtags::Debtags >
75 class Debtags :
public tagcoll::coll::Collection<Debtags>
83 tagcoll::coll::Patched< tagcoll::coll::IntDiskIndex >
m_coll;
102 template<
typename IDS>
105 std::set<std::string> pkgs;
106 for (
typename IDS::const_iterator i = ids.begin();
117 template<
typename PKGS>
121 for (
typename PKGS::const_iterator i = pkgs.begin();
122 i != pkgs.end(); ++i)
128 typedef tagcoll::coll::Patched< tagcoll::coll::IntDiskIndex >
coll_type;
134 Debtags::coll_type::const_iterator ci;
139 const Debtags::coll_type::const_iterator& ci)
140 : coll(coll), ci(ci), cached_val(0) {}
173 return ci == iter.ci;
177 return ci != iter.ci;
193 Debtags(
bool editable =
false);
207 template<
typename ITEMS,
typename TAGS>
208 void insert(
const ITEMS& items,
const TAGS& tags)
210 for (
typename ITEMS::const_iterator i = items.begin();
211 i != items.end(); ++i)
212 m_changes.addPatch(Patch(*i, tags, TagSet()));
215 template<
typename ITEMS>
216 void insert(
const ITEMS& items,
const wibble::Empty<Tag>& tags)
224 const Patches&
changes()
const {
return m_changes; }
229 void resetChanges() { m_changes.clear(); }
234 void setChanges(
const Patches&
changes);
239 void addChanges(
const Patches&
changes);
247 if (
id == -1)
return std::set<Tag>();
251 template<
typename ITEMS>
261 template<
typename TAGS>
265 for (
typename TAGS::const_iterator i = tags.begin();
266 i != tags.end(); ++i)
267 itags.insert(i->id());
272 ItemSet getTaggedItems()
const;
299 return m_coll.getCardinality(tag.
id());
304 using namespace tagcoll;
307 i != change.end(); ++i)
310 for (std::set<Tag>::const_iterator j = i->second.added.begin();
311 j != i->second.added.end(); ++j)
313 for (std::set<Tag>::const_iterator j = i->second.removed.begin();
314 j != i->second.removed.end(); ++j)
322 template<
typename OUT>
323 void output(OUT out)
const
325 for (const_iterator i =
begin(); i !=
end(); ++i)
382 template<
typename OUT>
390 template<
typename OUT>
391 void outputSystem(
const std::string& filename,
const OUT& out);
399 template<
typename OUT>
408 template<
typename OUT>
409 void outputPatched(
const std::string& filename,
const OUT& out);