#ifndef APT_PRIVATE_CACHESET_H
#define APT_PRIVATE_CACHESET_H
+#include <apt-pkg/aptconfiguration.h>
#include <apt-pkg/cachefile.h>
#include <apt-pkg/cacheset.h>
#include <apt-pkg/sptr.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/depcache.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/macros.h>
#include <algorithm>
#include <vector>
+#include <string.h>
+#include <list>
+#include <ostream>
+#include <set>
+#include <string>
+#include <utility>
#include "private-output.h"
#include <apti18n.h>
+class OpProgress;
+
struct VersionSortDescriptionLocality
{
bool operator () (const pkgCache::VerIterator &v_lhs,
const pkgCache::VerIterator &v_rhs)
{
- pkgCache::DescFile *A = v_lhs.TranslatedDescription().FileList();
- pkgCache::DescFile *B = v_rhs.TranslatedDescription().FileList();
- if (A == 0 && B == 0)
- return false;
+ pkgCache::DescFile const *A = NULL;
+ pkgCache::DescFile const *B = NULL;
+ if (v_lhs->DescriptionList != 0)
+ A = v_lhs.TranslatedDescription().FileList();
+ if (v_rhs->DescriptionList != 0)
+ B = v_rhs.TranslatedDescription().FileList();
+
+ if (A == 0 && B == 0)
+ return false;
if (A == 0)
return true;
class Matcher {
public:
- virtual bool operator () (const pkgCache::PkgIterator &P) {
- return true;};
+ virtual bool operator () (const pkgCache::PkgIterator &/*P*/) {
+ return true;}
};
// FIXME: add default argument for OpProgress (or overloaded function)
-bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
- LocalitySortedVersionSet &output_set,
+bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
+ APT::VersionContainerInterface * const vci,
Matcher &matcher,
- OpProgress &progress);
-bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
- LocalitySortedVersionSet &output_set,
- OpProgress &progress);
+ OpProgress * const progress);
+bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
+ APT::VersionContainerInterface * const vci,
+ OpProgress * const progress);
// CacheSetHelper saving virtual packages /*{{{*/
public:
APT::PackageSet virtualPkgs;
- virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
- virtualPkgs.insert(Pkg);
- return CacheSetHelper::canNotFindCandidateVer(Cache, Pkg);
- }
-
- virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
- virtualPkgs.insert(Pkg);
- return CacheSetHelper::canNotFindNewestVer(Cache, Pkg);
+ virtual pkgCache::VerIterator canNotGetVersion(enum CacheSetHelper::VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE {
+ if (select == NEWEST || select == CANDIDATE || select == ALL)
+ virtualPkgs.insert(Pkg);
+ return CacheSetHelper::canNotGetVersion(select, Cache, Pkg);
}
- virtual void canNotFindAllVer(APT::VersionContainerInterface * vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
- virtualPkgs.insert(Pkg);
- CacheSetHelper::canNotFindAllVer(vci, Cache, Pkg);
+ virtual void canNotFindVersion(enum CacheSetHelper::VerSelector const select, APT::VersionContainerInterface * vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE {
+ if (select == NEWEST || select == CANDIDATE || select == ALL)
+ virtualPkgs.insert(Pkg);
+ return CacheSetHelper::canNotFindVersion(select, vci, Cache, Pkg);
}
CacheSetHelperVirtuals(bool const ShowErrors = true, GlobalError::MsgType const &ErrorType = GlobalError::NOTICE) : CacheSetHelper(ShowErrors, ErrorType) {}
explicitlyNamed = true;
}
- virtual void showTaskSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) {
+ virtual void showTaskSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) APT_OVERRIDE {
ioprintf(out, _("Note, selecting '%s' for task '%s'\n"),
Pkg.FullName(true).c_str(), pattern.c_str());
explicitlyNamed = false;
}
- virtual void showFnmatchSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) {
+ virtual void showFnmatchSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) APT_OVERRIDE {
ioprintf(out, _("Note, selecting '%s' for glob '%s'\n"),
Pkg.FullName(true).c_str(), pattern.c_str());
explicitlyNamed = false;
}
- virtual void showRegExSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) {
+ virtual void showRegExSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern) APT_OVERRIDE {
ioprintf(out, _("Note, selecting '%s' for regex '%s'\n"),
Pkg.FullName(true).c_str(), pattern.c_str());
explicitlyNamed = false;
}
- virtual void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
- std::string const &ver, bool const verIsRel) {
+ virtual void showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, pkgCache::VerIterator const Ver,
+ std::string const &ver, bool const /*verIsRel*/) APT_OVERRIDE {
if (ver == Ver.VerStr())
return;
selectedByRelease.push_back(make_pair(Ver, ver));
return false;
}
- virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
- APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::CANDIDATE);
+ virtual pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE {
+ APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, CacheSetHelper::CANDIDATE);
if (verset.empty() == false)
return *(verset.begin());
else if (ShowError == true) {
return pkgCache::VerIterator(Cache, 0);
}
- virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
+ virtual pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE {
if (Pkg->ProvidesList != 0)
{
- APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, APT::VersionSet::NEWEST);
+ APT::VersionSet const verset = tryVirtualPackage(Cache, Pkg, CacheSetHelper::NEWEST);
if (verset.empty() == false)
return *(verset.begin());
if (ShowError == true)
}
APT::VersionSet tryVirtualPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg,
- APT::VersionSet::Version const &select) {
+ CacheSetHelper::VerSelector const select) {
/* This is a pure virtual package and there is a single available
candidate providing it. */
if (unlikely(Cache[Pkg].CandidateVer != 0) || Pkg->ProvidesList == 0)