apt  2.2.4
About: Apt (Advanced Package Tool) is a management system for software packages (Debian/Ubuntu). Release series 2.2.
  Fossies Dox: apt-2.2.4.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

private-cacheset.h
Go to the documentation of this file.
1 #ifndef APT_PRIVATE_CACHESET_H
2 #define APT_PRIVATE_CACHESET_H
3 
4 #include <apt-pkg/cacheset.h>
5 #include <apt-pkg/macros.h>
6 
8 
9 #include <list>
10 #include <set>
11 #include <string>
12 #include <vector>
13 
14 class OpProgress;
15 
17 {
20 public:
21 
22  // cppcheck-suppress noExplicitConstructor
24  iter(iter),
25  descFile(iter->DescriptionList != 0
26  ? (const pkgCache::DescFile *) iter.TranslatedDescription().FileList()
27  : nullptr)
28  {}
29  const pkgCache::DescFile * CachedDescFile() const { return descFile; }
30  operator pkgCache::VerIterator() const { return iter; }
31  map_id_t ID() const { return iter->ID; }
32 };
33 
35 {
37  const VerIteratorWithCaching &v_rhs)
38  {
39  pkgCache::DescFile const *A = v_lhs.CachedDescFile();
40  pkgCache::DescFile const *B = v_rhs.CachedDescFile();
41 
42  if (A == nullptr)
43  {
44  if (B == nullptr)
45  return v_lhs.ID() < v_rhs.ID();
46  return true;
47  }
48  else if (B == nullptr)
49  return false;
50 
51  if (A->File == B->File)
52  {
53  if (A->Offset == B->Offset)
54  return v_lhs.ID() < v_rhs.ID();
55  return A->Offset < B->Offset;
56  }
57 
58  return A->File < B->File;
59  }
60 };
61  /*}}}*/
62 // sorted by locality which makes iterating much faster
63 typedef APT::VersionContainer<
64  std::set<VerIteratorWithCaching,
66 
67 class Matcher {
68 public:
69  virtual bool operator () (const pkgCache::PkgIterator &/*P*/) {
70  return true;}
71 };
72 
73 // FIXME: add default argument for OpProgress (or overloaded function)
76  Matcher &matcher,
77  OpProgress * const progress);
80  OpProgress * const progress);
81 
82 
83 // CacheSetHelper saving virtual packages /*{{{*/
85 public:
87 
88  virtual pkgCache::VerIterator canNotGetVersion(enum CacheSetHelper::VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
89  virtual void canNotFindVersion(enum CacheSetHelper::VerSelector const select, APT::VersionContainerInterface * vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
90  virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str) APT_OVERRIDE;
91 
92  CacheSetHelperVirtuals(bool const ShowErrors = true, GlobalError::MsgType const &ErrorType = GlobalError::NOTICE);
93 };
94  /*}}}*/
95 
96 // CacheSetHelperAPTGet - responsible for message telling from the CacheSets/*{{{*/
98  /** \brief stream message should be printed to */
99  std::ostream &out;
100  /** \brief were things like Task or RegEx used to select packages? */
102 
104 public:
105  std::list<std::pair<pkgCache::VerIterator, std::string> > selectedByRelease;
106  std::set<std::string> notFound;
107 
108  explicit CacheSetHelperAPTGet(std::ostream &out);
109 
110  virtual void showPackageSelection(pkgCache::PkgIterator const &Pkg, enum PkgSelector const select, std::string const &pattern) APT_OVERRIDE;
111  void showTaskSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern);
112  void showFnmatchSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern);
113  void showRegExSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern);
114  void showVersionSelection(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern) APT_OVERRIDE;
116 
118  void canNotFindVersion(enum VerSelector const select, APT::VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE;
121  virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str) APT_OVERRIDE;
122 
124  CacheSetHelper::VerSelector const select);
125 
126  inline bool allPkgNamedExplicitly() const { return explicitlyNamed; }
127 };
128  /*}}}*/
129 
130 #endif
VerSelector
specifies which version(s) we want to refer to
Definition: cacheset.h:95
GlobalError::MsgType ErrorType
Definition: cacheset.h:163
bool explicitlyNamed
were things like Task or RegEx used to select packages?
void showFnmatchSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern)
std::set< std::string > notFound
void showTaskSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern)
bool allPkgNamedExplicitly() const
void showRegExSelection(pkgCache::PkgIterator const &Pkg, std::string const &pattern)
void showVersionSelection(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern) APT_OVERRIDE
be notified about the version being selected via pattern
void canNotFindVersion(enum VerSelector const select, APT::VersionContainerInterface *const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE
be notified if a version can't be found for a package
APT::VersionSet tryVirtualPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, CacheSetHelper::VerSelector const select)
virtual void showPackageSelection(pkgCache::PkgIterator const &Pkg, enum PkgSelector const select, std::string const &pattern) APT_OVERRIDE
be notified about the package being selected via pattern
pkgCache::VerIterator canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE
pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str) APT_OVERRIDE
pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
CacheSetHelperAPTGet(std::ostream &out)
std::ostream & out
stream message should be printed to
bool showVirtualPackageErrors(pkgCacheFile &Cache)
APT::PackageSet virtualPkgs
std::list< std::pair< pkgCache::VerIterator, std::string > > selectedByRelease
virtual void canNotFindVersion(enum CacheSetHelper::VerSelector const select, APT::VersionContainerInterface *vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE
virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str) APT_OVERRIDE
CacheSetHelperVirtuals(bool const ShowErrors=true, GlobalError::MsgType const &ErrorType=GlobalError::NOTICE)
APT::PackageSet virtualPkgs
virtual pkgCache::VerIterator canNotGetVersion(enum CacheSetHelper::VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) APT_OVERRIDE
MsgType
a message can have one of following severity
Definition: error.h:55
@ NOTICE
deprecation warnings, old fallback behavior, …
Definition: error.h:64
virtual bool operator()(const pkgCache::PkgIterator &)
const pkgCache::DescFile * descFile
const pkgCache::VerIterator iter
VerIteratorWithCaching(const pkgCache::VerIterator &iter)
const pkgCache::DescFile * CachedDescFile() const
#define APT_OVERRIDE
Definition: macros.h:111
uint32_t map_id_t
Definition: pkgcache.h:93
bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, APT::VersionContainerInterface *const vci, Matcher &matcher, OpProgress *const progress)
APT::VersionContainer< std::set< VerIteratorWithCaching, VersionSortDescriptionLocality > > LocalitySortedVersionSet
bool operator()(const VerIteratorWithCaching &v_lhs, const VerIteratorWithCaching &v_rhs)
associates a description with a Translation file
Definition: pkgcache.h:607
map_filesize_t Offset
position in the file
Definition: pkgcache.h:613
map_pointer< PackageFile > File
index of the file that this description was found in
Definition: pkgcache.h:609