apt: apt-pkg/cacheset.h Source File

apt 3.3.3 commandline package manager

cacheset.h
Go to the documentation of this file.
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
8 /*}}}*/
9#ifndef APT_CACHESET_H
10#define APT_CACHESET_H
11// Include Files /*{{{*/
12#include <fstream>
13#include <map>
14#include <set>
15#if __cplusplus >= 201103L
16#include <forward_list>
17#include <initializer_list>
18#include <unordered_set>
19#endif
20#include <algorithm>
21#include <deque>
22#include <iterator>
23#include <list>
24#include <string>
25#include <vector>
26
27#include <cstddef>
28
29#include <apt-pkg/error.h>
30#include <apt-pkg/macros.h>
31#include <apt-pkg/pkgcache.h>
32
33 /*}}}*/
34
35class pkgCacheFile;
36
37namespace APT {
38class PackageContainerInterface;
39class VersionContainerInterface;
40
41 class APT_PUBLIC CacheSetHelper { /*{{{*/
50public: /*{{{*/
51 CacheSetHelper(bool const ShowError = true,
52 GlobalError::MsgType ErrorType = GlobalError::ERROR);
53 virtual ~CacheSetHelper();
54
55 enum PkgSelector { UNKNOWN, REGEX, TASK, FNMATCH, PACKAGENAME, STRING, PATTERN };
56
57 virtual bool PackageFrom(enum PkgSelector const select, PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
58
59 virtual bool PackageFromCommandLine(PackageContainerInterface * const pci, pkgCacheFile &Cache, const char **cmdline);
60
61 struct PkgModifier {
62 enum Position { NONE, PREFIX, POSTFIX };
63 unsigned short ID;
64 const char * const Alias;
65 Position Pos;
66 PkgModifier (unsigned short const &id, const char * const alias, Position const &pos) noexcept : ID(id), Alias(alias), Pos(pos) {}
67 };
68 virtual bool PackageFromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
69 pkgCacheFile &Cache, const char * cmdline,
70 std::list<PkgModifier> const &mods);
71
72
81 virtual void showPackageSelection(pkgCache::PkgIterator const &pkg, PkgSelector const select, std::string const &pattern);
82
92 virtual void canNotFindPackage(enum PkgSelector const select, PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
93
95 enum VerSelector {
97 RELEASE,
99 VERSIONNUMBER,
101 ALL,
103 CANDANDINST,
105 CANDIDATE,
107 INSTALLED,
109 CANDINST,
111 INSTCAND,
113 NEWEST
114 };
115
127 virtual void showVersionSelection(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const &Ver,
128 enum VerSelector const select, std::string const &pattern);
129
139 virtual void canNotFindVersion(enum VerSelector const select, VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
140
141 // the difference between canNotFind and canNotGet is that the later is more low-level
142 // and called from other places: In this case looking into the code is the only real answer…
143 virtual pkgCache::VerIterator canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
144
145 virtual pkgCache::PkgIterator canNotFindPkgName(pkgCacheFile &Cache, std::string const &str);
146
147 bool showErrors() const { return ShowError; }
148 bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); }
149 GlobalError::MsgType errorType() const { return ErrorType; }
150 GlobalError::MsgType errorType(GlobalError::MsgType const &newValue)
151 {
152 if (ErrorType == newValue) return ErrorType;
153 else {
154 GlobalError::MsgType const &oldValue = ErrorType;
155 ErrorType = newValue;
156 return oldValue;
157 }
158 }
159
160 std::string getLastVersionMatcher() const;
161 void setLastVersionMatcher(std::string const &matcher);
162 /*}}}*/
163protected:
164 bool ShowError;
165 GlobalError::MsgType ErrorType;
166
167 pkgCache::VerIterator canNotGetInstCandVer(pkgCacheFile &Cache,
168 pkgCache::PkgIterator const &Pkg);
169 pkgCache::VerIterator canNotGetCandInstVer(pkgCacheFile &Cache,
170 pkgCache::PkgIterator const &Pkg);
171
172 pkgCache::VerIterator canNotGetVerFromRelease(pkgCacheFile &Cache,
173 pkgCache::PkgIterator const &Pkg, std::string const &release);
174 pkgCache::VerIterator canNotGetVerFromVersionNumber(pkgCacheFile &Cache,
175 pkgCache::PkgIterator const &Pkg, std::string const &verstr);
176
177 bool PackageFromTask(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
178 bool PackageFromRegEx(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
179 bool PackageFromFnmatch(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
180 bool PackageFromPackageName(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string pattern);
181 bool PackageFromString(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
182 bool PackageFromPattern(PackageContainerInterface * const pci, pkgCacheFile &Cache, std::string const &pattern);
183private:
184 void showTaskSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
185 void showRegExSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
186 void showFnmatchSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
187 void showPatternSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern);
188 void canNotFindTask(PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern);
189 void canNotFindRegEx(PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern);
190 void canNotFindFnmatch(PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string pattern);
191 void canNotFindPackage(PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &str);
192 void showSelectedVersion(pkgCache::PkgIterator const &Pkg, pkgCache::VerIterator const Ver,
193 std::string const &ver, bool const verIsRel);
194 void canNotFindAllVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
195 void canNotFindInstCandVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
196 void canNotFindCandInstVer(VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
197 pkgCache::VerIterator canNotFindNewestVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
198 pkgCache::VerIterator canNotFindCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
199 pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg);
200
201 class Private;
202 Private * const d;
203}; /*}}}*/
204// Iterator templates for our Containers /*{{{*/
205 template<typename Interface, typename Master, typename iterator_type, typename container_iterator, typename container_value> class Container_iterator_base :
206 public Interface::template iterator_base<iterator_type>
207{
208protected:
209 container_iterator _iter;
210public:
211 using iterator_category = typename std::iterator_traits<container_iterator>::iterator_category;
212 using value_type = container_value;
213 using difference_type = std::ptrdiff_t;
214 using pointer = container_value*;
215 using reference = container_value&;
216 explicit Container_iterator_base(container_iterator const &i) : _iter(i) {}
217 inline container_value operator*(void) const { return static_cast<iterator_type const*>(this)->getType(); };
218 operator container_iterator(void) const { return _iter; }
219 inline iterator_type& operator++() { ++_iter; return static_cast<iterator_type&>(*this); }
220 inline iterator_type operator++(int) { iterator_type tmp(*this); operator++(); return tmp; }
221 inline iterator_type operator+(typename container_iterator::difference_type const &n) const { return iterator_type(_iter + n); }
222 inline iterator_type operator+=(typename container_iterator::difference_type const &n) { _iter += n; return static_cast<iterator_type&>(*this); }
223 inline iterator_type& operator--() { --_iter;; return static_cast<iterator_type&>(*this); }
224 inline iterator_type operator--(int) { iterator_type tmp(*this); operator--(); return tmp; }
225 inline iterator_type operator-(typename container_iterator::difference_type const &n) const { return iterator_type(_iter - n); }
226 inline typename container_iterator::difference_type operator-(iterator_type const &b) { return (_iter - b._iter); }
227 inline iterator_type operator-=(typename container_iterator::difference_type const &n) { _iter -= n; return static_cast<iterator_type&>(*this); }
228 inline bool operator!=(iterator_type const &i) const { return _iter != i._iter; }
229 inline bool operator==(iterator_type const &i) const { return _iter == i._iter; }
230 inline bool operator<(iterator_type const &i) const { return _iter < i._iter; }
231 inline bool operator>(iterator_type const &i) const { return _iter > i._iter; }
232 inline bool operator<=(iterator_type const &i) const { return _iter <= i._iter; }
233 inline bool operator>=(iterator_type const &i) const { return _iter >= i._iter; }
234 inline typename container_iterator::reference operator[](typename container_iterator::difference_type const &n) const { return _iter[n]; }
235
236 friend std::ostream& operator<<(std::ostream& out, iterator_type i) { return operator<<(out, *i); }
237 friend Master;
238};
239 template<class Interface, class Container, class Master> class Container_const_iterator :
240 public Container_iterator_base<Interface, Master, Container_const_iterator<Interface, Container, Master>, typename Container::const_iterator, typename Container::value_type>
241{
242 typedef Container_const_iterator<Interface, Container, Master> iterator_type;
243 typedef typename Container::const_iterator container_iterator;
244public:
245 explicit Container_const_iterator(container_iterator i) :
246 Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
247
248 inline typename Container::value_type getType(void) const { return *this->_iter; }
249};
250 template<class Interface, class Container, class Master> class Container_iterator :
251 public Container_iterator_base<Interface, Master, Container_iterator<Interface, Container, Master>, typename Container::iterator, typename Container::value_type>
252{
253 typedef Container_iterator<Interface, Container, Master> iterator_type;
254 typedef typename Container::iterator container_iterator;
255public:
256 explicit Container_iterator(container_iterator const &i) :
257 Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
258
259 operator typename Master::const_iterator() { return typename Master::const_iterator(this->_iter); }
260 inline typename Container::iterator::reference operator*(void) const { return *this->_iter; }
261
262 inline typename Container::value_type getType(void) const { return *this->_iter; }
263};
264 template<class Interface, class Container, class Master> class Container_const_reverse_iterator :
265 public Container_iterator_base<Interface, Master, Container_const_reverse_iterator<Interface, Container, Master>, typename Container::const_reverse_iterator, typename Container::value_type>
266{
267 typedef Container_const_reverse_iterator<Interface, Container, Master> iterator_type;
268 typedef typename Container::const_reverse_iterator container_iterator;
269public:
270 explicit Container_const_reverse_iterator(container_iterator i) :
271 Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
272
273 inline typename Container::value_type getType(void) const { return *this->_iter; }
274};
275 template<class Interface, class Container, class Master> class Container_reverse_iterator :
276 public Container_iterator_base<Interface, Master, Container_reverse_iterator<Interface, Container, Master>, typename Container::reverse_iterator, typename Container::value_type>
277{
278 typedef Container_reverse_iterator<Interface, Container, Master> iterator_type;
279 typedef typename Container::reverse_iterator container_iterator;
280public:
281 explicit Container_reverse_iterator(container_iterator i) :
282 Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
283
284 operator typename Master::const_iterator() { return typename Master::const_iterator(this->_iter); }
285 inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast<iterator_type&>(*this); }
286 inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast<iterator_type&>(*this); }
287 inline typename Container::reverse_iterator::reference operator*(void) const { return *this->_iter; }
288
289 inline typename Container::value_type getType(void) const { return *this->_iter; }
290};
291 /*}}}*/
292 class APT_PUBLIC PackageContainerInterface { /*{{{*/
302public:
303 template<class Itr> class iterator_base { /*{{{*/
304 pkgCache::PkgIterator getType() const { return static_cast<Itr const*>(this)->getType(); };
305 public:
306 operator pkgCache::PkgIterator(void) const { return getType(); }
307
308 inline const char *Name() const {return getType().Name(); }
309 inline std::string FullName(bool const Pretty) const { return getType().FullName(Pretty); }
310 inline std::string FullName() const { return getType().FullName(); }
311 inline bool Purge() const {return getType().Purge(); }
312 inline const char *Arch() const {return getType().Arch(); }
313 inline pkgCache::GrpIterator Group() const { return getType().Group(); }
314 inline pkgCache::VerIterator VersionList() const { return getType().VersionList(); }
315 inline pkgCache::VerIterator CurrentVer() const { return getType().CurrentVer(); }
316 inline pkgCache::DepIterator RevDependsList() const { return getType().RevDependsList(); }
317 inline pkgCache::PrvIterator ProvidesList() const { return getType().ProvidesList(); }
318 inline pkgCache::PkgIterator::OkState State() const { return getType().State(); }
319 inline const char *CurVersion() const { return getType().CurVersion(); }
320 inline pkgCache *Cache() const { return getType().Cache(); }
321 inline unsigned long Index() const {return getType().Index();}
322 // we have only valid iterators here
323 inline bool end() const { return false; }
324
325 inline pkgCache::Package const * operator->() const {return &*getType();}
326 };
327 /*}}}*/
328
329 virtual bool insert(pkgCache::PkgIterator const &P) = 0;
330 virtual bool empty() const = 0;
331 virtual void clear() = 0;
332 virtual size_t size() const = 0;
333
334 void setConstructor(CacheSetHelper::PkgSelector const by) { ConstructedBy = by; }
335 CacheSetHelper::PkgSelector getConstructor() const { return ConstructedBy; }
336 PackageContainerInterface();
337 explicit PackageContainerInterface(CacheSetHelper::PkgSelector const by);
338 PackageContainerInterface(PackageContainerInterface const &by);
339 PackageContainerInterface& operator=(PackageContainerInterface const &other);
340 virtual ~PackageContainerInterface();
341
342private:
343 CacheSetHelper::PkgSelector ConstructedBy;
344 void * const d;
345};
346 /*}}}*/
347 template<class Container> class PackageContainer : public PackageContainerInterface {/*{{{*/
353 Container _cont;
354public: /*{{{*/
356 typedef Container_const_iterator<PackageContainerInterface, Container, PackageContainer> const_iterator;
357 typedef Container_iterator<PackageContainerInterface, Container, PackageContainer> iterator;
358 typedef Container_const_reverse_iterator<PackageContainerInterface, Container, PackageContainer> const_reverse_iterator;
359 typedef Container_reverse_iterator<PackageContainerInterface, Container, PackageContainer> reverse_iterator;
360 typedef typename Container::value_type value_type;
361 typedef typename Container::pointer pointer;
362 typedef typename Container::const_pointer const_pointer;
363 typedef typename Container::reference reference;
364 typedef typename Container::const_reference const_reference;
365 typedef typename Container::difference_type difference_type;
366 typedef typename Container::size_type size_type;
367 typedef typename Container::allocator_type allocator_type;
368
369 bool insert(pkgCache::PkgIterator const &P) override { if (P.end() == true) return false; _cont.insert(P); return true; }
370 template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }
371 void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
372
373 [[nodiscard]] bool empty() const override { return _cont.empty(); }
374 void clear() override { return _cont.clear(); }
375 [[nodiscard]] size_t size() const override { return _cont.size(); }
376#if __GNUC__ >= 5 || (__GNUC_MINOR__ >= 9 && __GNUC__ >= 4)
377 iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
378 iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
379#else
380 iterator erase( iterator pos ) { return iterator(_cont.erase(pos._iter)); }
381 iterator erase( iterator first, iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
382#endif
383 const_iterator begin() const { return const_iterator(_cont.begin()); }
384 const_iterator end() const { return const_iterator(_cont.end()); }
385 const_reverse_iterator rbegin() const { return const_reverse_iterator(_cont.rbegin()); }
386 const_reverse_iterator rend() const { return const_reverse_iterator(_cont.rend()); }
387#if __cplusplus >= 201103L
388 const_iterator cbegin() const { return const_iterator(_cont.cbegin()); }
389 const_iterator cend() const { return const_iterator(_cont.cend()); }
390 const_reverse_iterator crbegin() const { return const_reverse_iterator(_cont.crbegin()); }
391 const_reverse_iterator crend() const { return const_reverse_iterator(_cont.crend()); }
392#endif
393 iterator begin() { return iterator(_cont.begin()); }
394 iterator end() { return iterator(_cont.end()); }
395 reverse_iterator rbegin() { return reverse_iterator(_cont.rbegin()); }
396 reverse_iterator rend() { return reverse_iterator(_cont.rend()); }
397 const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); }
398
399 PackageContainer() : PackageContainerInterface(CacheSetHelper::UNKNOWN) {}
400 explicit PackageContainer(CacheSetHelper::PkgSelector const &by) : PackageContainerInterface(by) {}
401 template<typename Itr> PackageContainer(Itr first, Itr last) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(first, last) {}
402#if __cplusplus >= 201103L
403 PackageContainer(std::initializer_list<value_type> list) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(list) {}
404 void push_back(value_type&& P) { _cont.emplace_back(std::move(P)); }
405 template<typename... Args> void emplace_back(Args&&... args) { _cont.emplace_back(std::forward<Args>(args)...); }
406#endif
407 void push_back(const value_type& P) { _cont.push_back(P); }
408
419 template<class Compare> bool sort(Compare /*Comp*/) { return false; }
420
429 static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
430 PackageContainer cont(CacheSetHelper::TASK);
431 helper.PackageFrom(CacheSetHelper::TASK, &cont, Cache, pattern);
432 return cont;
433 }
434 static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern) {
435 CacheSetHelper helper;
436 return FromTask(Cache, pattern, helper);
437 }
438
447 static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
448 PackageContainer cont(CacheSetHelper::REGEX);
449 helper.PackageFrom(CacheSetHelper::REGEX, &cont, Cache, pattern);
450 return cont;
451 }
452
453 static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string const &pattern) {
454 CacheSetHelper helper;
455 return FromRegEx(Cache, pattern, helper);
456 }
457
458 static PackageContainer FromFnmatch(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
459 PackageContainer cont(CacheSetHelper::FNMATCH);
460 helper.PackageFrom(CacheSetHelper::FNMATCH, &cont, Cache, pattern);
461 return cont;
462 }
463 static PackageContainer FromFnMatch(pkgCacheFile &Cache, std::string const &pattern) {
464 CacheSetHelper helper;
465 return FromFnmatch(Cache, pattern, helper);
466 }
467
473 static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
474 PackageContainer cont;
475 helper.PackageFrom(CacheSetHelper::PACKAGENAME, &cont, Cache, pattern);
476 return cont;
477 }
478 static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern) {
479 CacheSetHelper helper;
480 return FromString(Cache, pattern, helper);
481 }
482
490 static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
491 PackageContainer cont;
492 helper.PackageFromCommandLine(&cont, Cache, cmdline);
493 return cont;
494 }
495 static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
496 CacheSetHelper helper;
497 return FromCommandLine(Cache, cmdline, helper);
498 }
499
511 static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
512 pkgCacheFile &Cache,
513 const char **cmdline,
514 std::list<CacheSetHelper::PkgModifier> const &mods,
515 unsigned short const &fallback,
516 CacheSetHelper &helper) {
517 std::map<unsigned short, PackageContainer> pkgsets;
518 for (const char **I = cmdline; *I != 0; ++I) {
519 unsigned short modID = fallback;
520 PackageContainer pkgset;
521 helper.PackageFromModifierCommandLine(modID, &pkgset, Cache, *I, mods);
522 pkgsets[modID].insert(pkgset);
523 }
524 return pkgsets;
525 }
526 static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
527 pkgCacheFile &Cache,
528 const char **cmdline,
529 std::list<CacheSetHelper::PkgModifier> const &mods,
530 unsigned short const &fallback) {
531 CacheSetHelper helper;
532 return GroupedFromCommandLine(Cache, cmdline,
533 mods, fallback, helper);
534 }
535 /*}}}*/
536}; /*}}}*/
537// various specialisations for PackageContainer /*{{{*/
538template<> template<class Cont> void PackageContainer<std::list<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
539 for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
540 _cont.push_back(*p);
541}
542#if __cplusplus >= 201103L
543template<> template<class Cont> void PackageContainer<std::forward_list<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
544 for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
545 _cont.push_front(*p);
546}
547#endif
548template<> template<class Cont> void PackageContainer<std::deque<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
549 for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
550 _cont.push_back(*p);
551}
552template<> template<class Cont> void PackageContainer<std::vector<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
553 for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
554 _cont.push_back(*p);
555}
556// these are 'inline' as otherwise the linker has problems with seeing these untemplated
557// specializations again and again - but we need to see them, so that library users can use them
558template<> inline bool PackageContainer<std::list<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
559 if (P.end() == true)
560 return false;
561 _cont.push_back(P);
562 return true;
563}
564#if __cplusplus >= 201103L
565template<> inline bool PackageContainer<std::forward_list<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
566 if (P.end() == true)
567 return false;
568 _cont.push_front(P);
569 return true;
570}
571#endif
572template<> inline bool PackageContainer<std::deque<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
573 if (P.end() == true)
574 return false;
575 _cont.push_back(P);
576 return true;
577}
578template<> inline bool PackageContainer<std::vector<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
579 if (P.end() == true)
580 return false;
581 _cont.push_back(P);
582 return true;
583}
584template<> inline void PackageContainer<std::list<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
585 for (const_iterator p = begin; p != end; ++p)
586 _cont.push_back(*p);
587}
588#if __cplusplus >= 201103L
589template<> inline void PackageContainer<std::forward_list<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
590 for (const_iterator p = begin; p != end; ++p)
591 _cont.push_front(*p);
592}
593#endif
594template<> inline void PackageContainer<std::deque<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
595 for (const_iterator p = begin; p != end; ++p)
596 _cont.push_back(*p);
597}
598template<> inline void PackageContainer<std::vector<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
599 for (const_iterator p = begin; p != end; ++p)
600 _cont.push_back(*p);
601}
602#if APT_GCC_VERSION < 0x409
603template<> inline PackageContainer<std::set<pkgCache::PkgIterator> >::iterator PackageContainer<std::set<pkgCache::PkgIterator> >::erase(iterator i) {
604 _cont.erase(i._iter);
605 return end();
606}
607template<> inline PackageContainer<std::set<pkgCache::PkgIterator> >::iterator PackageContainer<std::set<pkgCache::PkgIterator> >::erase(iterator first, iterator last) {
608 _cont.erase(first, last);
609 return end();
610}
611#endif
612template<> template<class Compare> inline bool PackageContainer<std::vector<pkgCache::PkgIterator> >::sort(Compare Comp) {
613 std::sort(_cont.begin(), _cont.end(), Comp);
614 return true;
615}
616template<> template<class Compare> inline bool PackageContainer<std::list<pkgCache::PkgIterator> >::sort(Compare Comp) {
617 _cont.sort(Comp);
618 return true;
619}
620#if __cplusplus >= 201103L
621template<> template<class Compare> inline bool PackageContainer<std::forward_list<pkgCache::PkgIterator> >::sort(Compare Comp) {
622 _cont.sort(Comp);
623 return true;
624}
625#endif
626template<> template<class Compare> inline bool PackageContainer<std::deque<pkgCache::PkgIterator> >::sort(Compare Comp) {
627 std::sort(_cont.begin(), _cont.end(), Comp);
628 return true;
629}
630 /*}}}*/
631
632// class PackageUniverse - pkgCache as PackageContainerInterface /*{{{*/
640 class APT_PUBLIC PackageUniverse : public PackageContainerInterface {
641 pkgCache * const _cont;
642 void * const d;
643public:
644 class const_iterator : public APT::Container_iterator_base<APT::PackageContainerInterface, PackageUniverse, PackageUniverse::const_iterator, pkgCache::PkgIterator, pkgCache::PkgIterator>
645 {
646 public:
647 explicit const_iterator(pkgCache::PkgIterator i):
648 Container_iterator_base<APT::PackageContainerInterface, PackageUniverse, PackageUniverse::const_iterator, pkgCache::PkgIterator, pkgCache::PkgIterator>(i) {}
649
650 inline pkgCache::PkgIterator getType(void) const { return _iter; }
651 };
652 typedef const_iterator iterator;
653 typedef pkgCache::PkgIterator value_type;
654 typedef typename pkgCache::PkgIterator* pointer;
655 typedef typename pkgCache::PkgIterator const* const_pointer;
656 typedef const pkgCache::PkgIterator& const_reference;
657 typedef const_reference reference;
658 typedef const_iterator::difference_type difference_type;
659 typedef std::make_unsigned<const_iterator::difference_type>::type size_type;
660
661 [[nodiscard]] bool empty() const override { return false; }
662 [[nodiscard]] size_t size() const override { return _cont->Head().PackageCount; }
663
664 const_iterator begin() const { return const_iterator(_cont->PkgBegin()); }
665 const_iterator end() const { return const_iterator(_cont->PkgEnd()); }
666 const_iterator cbegin() const { return const_iterator(_cont->PkgBegin()); }
667 const_iterator cend() const { return const_iterator(_cont->PkgEnd()); }
668 iterator begin() { return iterator(_cont->PkgBegin()); }
669 iterator end() { return iterator(_cont->PkgEnd()); }
670
671 pkgCache * data() const { return _cont; }
672
673 explicit PackageUniverse(pkgCache * const Owner);
674 explicit PackageUniverse(pkgCacheFile * const Owner);
675 virtual ~PackageUniverse();
676
677private:
678 APT_HIDDEN bool insert(pkgCache::PkgIterator const &/*P*/) override { return true; }
679 template<class Cont> APT_HIDDEN void insert(PackageContainer<Cont> const &) { }
680 APT_HIDDEN void insert(const_iterator, const_iterator) { }
681
682 APT_HIDDEN void clear() override { }
683 APT_HIDDEN iterator erase( const_iterator pos );
684 APT_HIDDEN iterator erase( const_iterator first, const_iterator last );
685};
686 /*}}}*/
687typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet;
688#if __cplusplus >= 201103L
689typedef PackageContainer<std::unordered_set<pkgCache::PkgIterator> > PackageUnorderedSet;
690typedef PackageContainer<std::forward_list<pkgCache::PkgIterator> > PackageForwardList;
691#endif
692typedef PackageContainer<std::list<pkgCache::PkgIterator> > PackageList;
693typedef PackageContainer<std::deque<pkgCache::PkgIterator> > PackageDeque;
694typedef PackageContainer<std::vector<pkgCache::PkgIterator> > PackageVector;
695
696 class APT_PUBLIC VersionContainerInterface { /*{{{*/
700public:
702 template<class Itr> class iterator_base { /*{{{*/
703 pkgCache::VerIterator getType() const { return static_cast<Itr const*>(this)->getType(); };
704 public:
705 operator pkgCache::VerIterator(void) { return getType(); }
706
707 inline pkgCache *Cache() const { return getType().Cache(); }
708 inline unsigned long Index() const {return getType().Index();}
709 inline int CompareVer(const pkgCache::VerIterator &B) const { return getType().CompareVer(B); }
710 inline const char *VerStr() const { return getType().VerStr(); }
711 inline const char *Section() const { return getType().Section(); }
712 inline const char *Arch() const { return getType().Arch(); }
713 inline pkgCache::PkgIterator ParentPkg() const { return getType().ParentPkg(); }
714 inline pkgCache::DescIterator DescriptionList() const { return getType().DescriptionList(); }
715 inline pkgCache::DescIterator TranslatedDescription() const { return getType().TranslatedDescription(); }
716 inline pkgCache::DepIterator DependsList() const { return getType().DependsList(); }
717 inline pkgCache::PrvIterator ProvidesList() const { return getType().ProvidesList(); }
718 inline pkgCache::VerFileIterator FileList() const { return getType().FileList(); }
719 inline bool Downloadable() const { return getType().Downloadable(); }
720 inline const char *PriorityType() const { return getType().PriorityType(); }
721 inline std::string RelStr() const { return getType().RelStr(); }
722 inline bool Automatic() const { return getType().Automatic(); }
723 inline pkgCache::VerFileIterator NewestFile() const { return getType().NewestFile(); }
724 // we have only valid iterators here
725 inline bool end() const { return false; }
726
727 inline pkgCache::Version const * operator->() const { return &*getType(); }
728 };
729 /*}}}*/
730
731 virtual bool insert(pkgCache::VerIterator const &V) = 0;
732 virtual bool empty() const = 0;
733 virtual void clear() = 0;
734 virtual size_t size() const = 0;
735
736 struct Modifier {
737 unsigned short const ID;
738 const char * const Alias;
739 enum Position { NONE, PREFIX, POSTFIX } const Pos;
740 enum CacheSetHelper::VerSelector const SelectVersion;
741 Modifier (unsigned short const &id, const char * const alias, Position const &pos,
742 enum CacheSetHelper::VerSelector const select) noexcept : ID(id), Alias(alias), Pos(pos),
743 SelectVersion(select) {}
744 };
745
746 static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
747 const char **cmdline, CacheSetHelper::VerSelector const fallback,
748 CacheSetHelper &helper);
749
750 static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
751 std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
752 bool const onlyFromName = false);
753
754 static bool FromPattern(VersionContainerInterface *const vci, pkgCacheFile &Cache,
755 std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper);
756
757 static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
758 pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback,
759 CacheSetHelper &helper);
760
761 static bool FromModifierCommandLine(unsigned short &modID,
762 VersionContainerInterface * const vci,
763 pkgCacheFile &Cache, const char * cmdline,
764 std::list<Modifier> const &mods,
765 CacheSetHelper &helper);
766
767
768 static bool FromDependency(VersionContainerInterface * const vci,
769 pkgCacheFile &Cache,
770 pkgCache::DepIterator const &D,
771 CacheSetHelper::VerSelector const selector,
772 CacheSetHelper &helper);
773
774 VersionContainerInterface();
775 VersionContainerInterface(VersionContainerInterface const &other);
776 VersionContainerInterface& operator=(VersionContainerInterface const &other);
777 virtual ~VersionContainerInterface();
778private:
779 void * const d;
780
781protected: /*{{{*/
782
788 static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache,
789 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
790
796 static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
797 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
798 /*}}}*/
799};
800 /*}}}*/
801 template<class Container> class VersionContainer : public VersionContainerInterface {/*{{{*/
807 Container _cont;
808public: /*{{{*/
809
810 typedef Container_const_iterator<VersionContainerInterface, Container, VersionContainer> const_iterator;
811 typedef Container_iterator<VersionContainerInterface, Container, VersionContainer> iterator;
812 typedef Container_const_reverse_iterator<VersionContainerInterface, Container, VersionContainer> const_reverse_iterator;
813 typedef Container_reverse_iterator<VersionContainerInterface, Container, VersionContainer> reverse_iterator;
814 typedef typename Container::value_type value_type;
815 typedef typename Container::pointer pointer;
816 typedef typename Container::const_pointer const_pointer;
817 typedef typename Container::reference reference;
818 typedef typename Container::const_reference const_reference;
819 typedef typename Container::difference_type difference_type;
820 typedef typename Container::size_type size_type;
821 typedef typename Container::allocator_type allocator_type;
822
823 bool insert(pkgCache::VerIterator const &V) override { if (V.end() == true) return false; _cont.insert(V); return true; }
824 template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }
825 void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
826 [[nodiscard]] bool empty() const override { return _cont.empty(); }
827 void clear() override { return _cont.clear(); }
828 [[nodiscard]] size_t size() const override { return _cont.size(); }
829#if APT_GCC_VERSION >= 0x409
830 iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
831 iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
832#else
833 iterator erase( iterator pos ) { return iterator(_cont.erase(pos._iter)); }
834 iterator erase( iterator first, iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
835#endif
836 const_iterator begin() const { return const_iterator(_cont.begin()); }
837 const_iterator end() const { return const_iterator(_cont.end()); }
838 const_reverse_iterator rbegin() const { return const_reverse_iterator(_cont.rbegin()); }
839 const_reverse_iterator rend() const { return const_reverse_iterator(_cont.rend()); }
840#if __cplusplus >= 201103L
841 const_iterator cbegin() const { return const_iterator(_cont.cbegin()); }
842 const_iterator cend() const { return const_iterator(_cont.cend()); }
843 const_reverse_iterator crbegin() const { return const_reverse_iterator(_cont.crbegin()); }
844 const_reverse_iterator crend() const { return const_reverse_iterator(_cont.crend()); }
845#endif
846 iterator begin() { return iterator(_cont.begin()); }
847 iterator end() { return iterator(_cont.end()); }
848 reverse_iterator rbegin() { return reverse_iterator(_cont.rbegin()); }
849 reverse_iterator rend() { return reverse_iterator(_cont.rend()); }
850 const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }
851
852 VersionContainer() : VersionContainerInterface() {}
853 template<typename Itr> VersionContainer(Itr first, Itr last) : VersionContainerInterface(), _cont(first, last) {}
854#if __cplusplus >= 201103L
855 VersionContainer(std::initializer_list<value_type> list) : VersionContainerInterface(), _cont(list) {}
856 void push_back(value_type&& P) { _cont.emplace_back(std::move(P)); }
857 template<typename... Args> void emplace_back(Args&&... args) { _cont.emplace_back(std::forward<Args>(args)...); }
858#endif
859 void push_back(const value_type& P) { _cont.push_back(P); }
860
871 template<class Compare> bool sort(Compare /*Comp*/) { return false; }
872
881 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
882 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper) {
883 VersionContainer vercon;
884 VersionContainerInterface::FromCommandLine(&vercon, Cache, cmdline, fallback, helper);
885 return vercon;
886 }
887 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
888 CacheSetHelper::VerSelector const fallback) {
889 CacheSetHelper helper;
890 return FromCommandLine(Cache, cmdline, fallback, helper);
891 }
892 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
893 return FromCommandLine(Cache, cmdline, CacheSetHelper::CANDINST);
894 }
895 static VersionContainer FromString(pkgCacheFile &Cache, std::string const &pkg,
896 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
897 bool const /*onlyFromName = false*/) {
898 VersionContainer vercon;
899 VersionContainerInterface::FromString(&vercon, Cache, pkg, fallback, helper);
900 return vercon;
901 }
902 static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg,
903 CacheSetHelper::VerSelector const fallback) {
904 CacheSetHelper helper;
905 return FromString(Cache, pkg, fallback, helper);
906 }
907 static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg) {
908 return FromString(Cache, pkg, CacheSetHelper::CANDINST);
909 }
910
911
918 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
919 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper) {
920 VersionContainer vercon;
921 VersionContainerInterface::FromPackage(&vercon, Cache, P, fallback, helper);
922 return vercon;
923 }
924 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
925 CacheSetHelper::VerSelector const fallback) {
926 CacheSetHelper helper;
927 return FromPackage(Cache, P, fallback, helper);
928 }
929 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P) {
930 return FromPackage(Cache, P, CacheSetHelper::CANDIDATE);
931 }
932
933 static std::map<unsigned short, VersionContainer> GroupedFromCommandLine(
934 pkgCacheFile &Cache,
935 const char **cmdline,
936 std::list<Modifier> const &mods,
937 unsigned short const fallback,
938 CacheSetHelper &helper) {
939 std::map<unsigned short, VersionContainer> versets;
940 for (const char **I = cmdline; *I != 0; ++I) {
941 unsigned short modID = fallback;
942 VersionContainer verset;
943 VersionContainerInterface::FromModifierCommandLine(modID, &verset, Cache, *I, mods, helper);
944 versets[modID].insert(verset);
945 }
946 return versets;
947
948 }
949 static std::map<unsigned short, VersionContainer> GroupedFromCommandLine(
950 pkgCacheFile &Cache, const char **cmdline,
951 std::list<Modifier> const &mods,
952 unsigned short const fallback) {
953 CacheSetHelper helper;
954 return GroupedFromCommandLine(Cache, cmdline,
955 mods, fallback, helper);
956 }
957
958 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
959 CacheSetHelper::VerSelector const selector, CacheSetHelper &helper) {
960 VersionContainer vercon;
961 VersionContainerInterface::FromDependency(&vercon, Cache, D, selector, helper);
962 return vercon;
963 }
964 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
965 CacheSetHelper::VerSelector const selector) {
966 CacheSetHelper helper;
967 return FromDependency(Cache, D, selector, helper);
968 }
969 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D) {
970 return FromDependency(Cache, D, CacheSetHelper::CANDIDATE);
971 }
972 /*}}}*/
973}; /*}}}*/
974// various specialisations for VersionContainer /*{{{*/
975template<> template<class Cont> void VersionContainer<std::list<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
976 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
977 _cont.push_back(*v);
978}
979#if __cplusplus >= 201103L
980template<> template<class Cont> void VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
981 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
982 _cont.push_front(*v);
983}
984#endif
985template<> template<class Cont> void VersionContainer<std::deque<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
986 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
987 _cont.push_back(*v);
988}
989template<> template<class Cont> void VersionContainer<std::vector<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
990 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
991 _cont.push_back(*v);
992}
993// these are 'inline' as otherwise the linker has problems with seeing these untemplated
994// specializations again and again - but we need to see them, so that library users can use them
995template<> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
996 if (V.end() == true)
997 return false;
998 _cont.push_back(V);
999 return true;
1000}
1001#if __cplusplus >= 201103L
1002template<> inline bool VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1003 if (V.end() == true)
1004 return false;
1005 _cont.push_front(V);
1006 return true;
1007}
1008#endif
1009template<> inline bool VersionContainer<std::deque<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1010 if (V.end() == true)
1011 return false;
1012 _cont.push_back(V);
1013 return true;
1014}
1015template<> inline bool VersionContainer<std::vector<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1016 if (V.end() == true)
1017 return false;
1018 _cont.push_back(V);
1019 return true;
1020}
1021template<> inline void VersionContainer<std::list<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1022 for (const_iterator v = begin; v != end; ++v)
1023 _cont.push_back(*v);
1024}
1025#if __cplusplus >= 201103L
1026template<> inline void VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1027 for (const_iterator v = begin; v != end; ++v)
1028 _cont.push_front(*v);
1029}
1030#endif
1031template<> inline void VersionContainer<std::deque<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1032 for (const_iterator v = begin; v != end; ++v)
1033 _cont.push_back(*v);
1034}
1035template<> inline void VersionContainer<std::vector<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1036 for (const_iterator v = begin; v != end; ++v)
1037 _cont.push_back(*v);
1038}
1039#if APT_GCC_VERSION < 0x409
1040template<> inline VersionContainer<std::set<pkgCache::VerIterator> >::iterator VersionContainer<std::set<pkgCache::VerIterator> >::erase(iterator i) {
1041 _cont.erase(i._iter);
1042 return end();
1043}
1044template<> inline VersionContainer<std::set<pkgCache::VerIterator> >::iterator VersionContainer<std::set<pkgCache::VerIterator> >::erase(iterator first, iterator last) {
1045 _cont.erase(first, last);
1046 return end();
1047}
1048#endif
1049template<> template<class Compare> inline bool VersionContainer<std::vector<pkgCache::VerIterator> >::sort(Compare Comp) {
1050 std::sort(_cont.begin(), _cont.end(), Comp);
1051 return true;
1052}
1053template<> template<class Compare> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::sort(Compare Comp) {
1054 _cont.sort(Comp);
1055 return true;
1056}
1057#if __cplusplus >= 201103L
1058template<> template<class Compare> inline bool VersionContainer<std::forward_list<pkgCache::VerIterator> >::sort(Compare Comp) {
1059 _cont.sort(Comp);
1060 return true;
1061}
1062#endif
1063template<> template<class Compare> inline bool VersionContainer<std::deque<pkgCache::VerIterator> >::sort(Compare Comp) {
1064 std::sort(_cont.begin(), _cont.end(), Comp);
1065 return true;
1066}
1067 /*}}}*/
1068
1069typedef VersionContainer<std::set<pkgCache::VerIterator> > VersionSet;
1070#if __cplusplus >= 201103L
1071typedef VersionContainer<std::unordered_set<pkgCache::VerIterator> > VersionUnorderedSet;
1072typedef VersionContainer<std::forward_list<pkgCache::VerIterator> > VersionForwardList;
1073#endif
1074typedef VersionContainer<std::list<pkgCache::VerIterator> > VersionList;
1075typedef VersionContainer<std::deque<pkgCache::VerIterator> > VersionDeque;
1076typedef VersionContainer<std::vector<pkgCache::VerIterator> > VersionVector;
1077}
1078#endif
APT::CacheSetHelper
Definition cacheset.h:41
APT::CacheSetHelper::VerSelector
VerSelector
specifies which version(s) we want to refer to
Definition cacheset.h:95
APT::CacheSetHelper::CANDIDATE
@ CANDIDATE
Definition cacheset.h:105
APT::CacheSetHelper::NEWEST
@ NEWEST
Definition cacheset.h:113
APT::CacheSetHelper::INSTALLED
@ INSTALLED
Definition cacheset.h:107
APT::CacheSetHelper::CANDANDINST
@ CANDANDINST
Definition cacheset.h:103
APT::CacheSetHelper::INSTCAND
@ INSTCAND
Definition cacheset.h:111
APT::CacheSetHelper::CANDINST
@ CANDINST
Definition cacheset.h:109
APT::CacheSetHelper::ALL
@ ALL
Definition cacheset.h:101
APT::CacheSetHelper::RELEASE
@ RELEASE
Definition cacheset.h:97
APT::CacheSetHelper::VERSIONNUMBER
@ VERSIONNUMBER
Definition cacheset.h:99
APT::CacheSetHelper::canNotFindPackage
virtual void canNotFindPackage(enum PkgSelector const select, PackageContainerInterface *const pci, pkgCacheFile &Cache, std::string const &pattern)
be notified if a package can't be found via pattern
Definition cacheset.cc:697
APT::CacheSetHelper::showPackageSelection
virtual void showPackageSelection(pkgCache::PkgIterator const &pkg, PkgSelector const select, std::string const &pattern)
be notified about the package being selected via pattern
Definition cacheset.cc:849
APT::Container_const_iterator
Definition cacheset.h:241
APT::Container_const_reverse_iterator
Definition cacheset.h:266
APT::Container_iterator_base
Definition cacheset.h:207
APT::Container_iterator
Definition cacheset.h:252
APT::Container_reverse_iterator
Definition cacheset.h:277
APT::PackageContainerInterface::iterator_base
Definition cacheset.h:303
APT::PackageContainerInterface
Definition cacheset.h:292
APT::PackageContainer
Definition cacheset.h:347
APT::PackageContainer::FromString
static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper)
returns all packages specified by a string
Definition cacheset.h:473
APT::PackageContainer::sort
bool sort(Compare)
sort all included versions with given comparer
Definition cacheset.h:419
APT::PackageContainer::FromCommandLine
static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper)
returns all packages specified on the commandline
Definition cacheset.h:490
APT::PackageContainer::GroupedFromCommandLine
static std::map< unsigned short, PackageContainer > GroupedFromCommandLine(pkgCacheFile &Cache, const char **cmdline, std::list< CacheSetHelper::PkgModifier > const &mods, unsigned short const &fallback, CacheSetHelper &helper)
group packages by a action modifiers
Definition cacheset.h:511
APT::PackageContainer::FromTask
static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper)
returns all packages in the cache who belong to the given task
Definition cacheset.h:429
APT::PackageContainer::const_iterator
Container_const_iterator< PackageContainerInterface, Container, PackageContainer > const_iterator
smell like a pkgCache::PkgIterator
Definition cacheset.h:356
APT::PackageContainer::FromRegEx
static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper)
returns all packages in the cache whose name matches a given pattern
Definition cacheset.h:447
APT::PackageUniverse::const_iterator
Definition cacheset.h:645
APT::VersionContainerInterface::iterator_base
smell like a pkgCache::VerIterator
Definition cacheset.h:702
APT::VersionContainerInterface
Definition cacheset.h:696
APT::VersionContainerInterface::getInstalledVer
static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper)
returns the installed version of the package
Definition cacheset.cc:688
APT::VersionContainerInterface::getCandidateVer
static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper)
returns the candidate version of the package
Definition cacheset.cc:672
APT::VersionContainer
Definition cacheset.h:801
APT::VersionContainer::FromPackage
static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper)
returns all versions specified for the package
Definition cacheset.h:918
APT::VersionContainer::sort
bool sort(Compare)
sort all included versions with given comparer
Definition cacheset.h:871
APT::VersionContainer::FromCommandLine
static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper)
returns all versions specified on the commandline
Definition cacheset.h:881
GlobalError::MsgType
MsgType
a message can have one of following severity
Definition error.h:59
GlobalError::ERROR
@ ERROR
An error does hinder the correct execution and should be corrected.
Definition error.h:64
pkgCacheFile
Definition cachefile.h:33
pkgCache::DepIterator
Definition cacheiterators.h:337
pkgCache::DescIterator
Definition cacheiterators.h:311
pkgCache::GrpIterator
Definition cacheiterators.h:106
pkgCache::PkgIterator
Definition cacheiterators.h:147
pkgCache::PrvIterator
Definition cacheiterators.h:423
pkgCache::VerFileIterator
Definition cacheiterators.h:530
pkgCache::VerIterator
Definition cacheiterators.h:218
pkgCache
Definition pkgcache.h:126
pkgcache.h
pkgCache - Structure definitions for the cache file
pkgCache::Package
contains information for a single unique package
Definition pkgcache.h:460
pkgCache::Version
information for a single version of a package
Definition pkgcache.h:652