apt: apt-pkg/cacheset.h Source File

apt 2.9.8 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) : 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) { 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) { 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 APT_PUBLIC 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) APT_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 bool empty() const APT_OVERRIDE { return _cont.empty(); }
374 void clear() APT_OVERRIDE { return _cont.clear(); }
375 size_t size() const APT_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
662 bool empty() const APT_OVERRIDE { return false; }
663 size_t size() const APT_OVERRIDE { return _cont->Head().PackageCount; }
664
665 const_iterator begin() const { return const_iterator(_cont->PkgBegin()); }
666 const_iterator end() const { return const_iterator(_cont->PkgEnd()); }
667 const_iterator cbegin() const { return const_iterator(_cont->PkgBegin()); }
668 const_iterator cend() const { return const_iterator(_cont->PkgEnd()); }
669 iterator begin() { return iterator(_cont->PkgBegin()); }
670 iterator end() { return iterator(_cont->PkgEnd()); }
671
672 pkgCache * data() const { return _cont; }
673
674 explicit PackageUniverse(pkgCache * const Owner);
675 explicit PackageUniverse(pkgCacheFile * const Owner);
676 virtual ~PackageUniverse();
677
678private:
679 APT_HIDDEN bool insert(pkgCache::PkgIterator const &) APT_OVERRIDE { return true; }
680 template<class Cont> APT_HIDDEN void insert(PackageContainer<Cont> const &) { }
681 APT_HIDDEN void insert(const_iterator, const_iterator) { }
682
683 APT_HIDDEN void clear() APT_OVERRIDE { }
684 APT_HIDDEN iterator erase( const_iterator pos );
685 APT_HIDDEN iterator erase( const_iterator first, const_iterator last );
686};
687 /*}}}*/
688typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet;
689#if __cplusplus >= 201103L
690typedef PackageContainer<std::unordered_set<pkgCache::PkgIterator> > PackageUnorderedSet;
691typedef PackageContainer<std::forward_list<pkgCache::PkgIterator> > PackageForwardList;
692#endif
693typedef PackageContainer<std::list<pkgCache::PkgIterator> > PackageList;
694typedef PackageContainer<std::deque<pkgCache::PkgIterator> > PackageDeque;
695typedef PackageContainer<std::vector<pkgCache::PkgIterator> > PackageVector;
696
697 class APT_PUBLIC VersionContainerInterface { /*{{{*/
701public:
703 template<class Itr> class iterator_base { /*{{{*/
704 pkgCache::VerIterator getType() const { return static_cast<Itr const*>(this)->getType(); };
705 public:
706 operator pkgCache::VerIterator(void) { return getType(); }
707
708 inline pkgCache *Cache() const { return getType().Cache(); }
709 inline unsigned long Index() const {return getType().Index();}
710 inline int CompareVer(const pkgCache::VerIterator &B) const { return getType().CompareVer(B); }
711 inline const char *VerStr() const { return getType().VerStr(); }
712 inline const char *Section() const { return getType().Section(); }
713 inline const char *Arch() const { return getType().Arch(); }
714 inline pkgCache::PkgIterator ParentPkg() const { return getType().ParentPkg(); }
715 inline pkgCache::DescIterator DescriptionList() const { return getType().DescriptionList(); }
716 inline pkgCache::DescIterator TranslatedDescription() const { return getType().TranslatedDescription(); }
717 inline pkgCache::DepIterator DependsList() const { return getType().DependsList(); }
718 inline pkgCache::PrvIterator ProvidesList() const { return getType().ProvidesList(); }
719 inline pkgCache::VerFileIterator FileList() const { return getType().FileList(); }
720 inline bool Downloadable() const { return getType().Downloadable(); }
721 inline const char *PriorityType() const { return getType().PriorityType(); }
722 inline std::string RelStr() const { return getType().RelStr(); }
723 inline bool Automatic() const { return getType().Automatic(); }
724 inline pkgCache::VerFileIterator NewestFile() const { return getType().NewestFile(); }
725 // we have only valid iterators here
726 inline bool end() const { return false; }
727
728 inline pkgCache::Version const * operator->() const { return &*getType(); }
729 };
730 /*}}}*/
731
732 virtual bool insert(pkgCache::VerIterator const &V) = 0;
733 virtual bool empty() const = 0;
734 virtual void clear() = 0;
735 virtual size_t size() const = 0;
736
737 struct Modifier {
738 unsigned short const ID;
739 const char * const Alias;
740 enum Position { NONE, PREFIX, POSTFIX } const Pos;
741 enum CacheSetHelper::VerSelector const SelectVersion;
742 Modifier (unsigned short const &id, const char * const alias, Position const &pos,
743 enum CacheSetHelper::VerSelector const select) : ID(id), Alias(alias), Pos(pos),
744 SelectVersion(select) {}
745 };
746
747 static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
748 const char **cmdline, CacheSetHelper::VerSelector const fallback,
749 CacheSetHelper &helper);
750
751 static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
752 std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
753 bool const onlyFromName = false);
754
755 static bool FromPattern(VersionContainerInterface *const vci, pkgCacheFile &Cache,
756 std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper);
757
758 static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
759 pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback,
760 CacheSetHelper &helper);
761
762 static bool FromModifierCommandLine(unsigned short &modID,
763 VersionContainerInterface * const vci,
764 pkgCacheFile &Cache, const char * cmdline,
765 std::list<Modifier> const &mods,
766 CacheSetHelper &helper);
767
768
769 static bool FromDependency(VersionContainerInterface * const vci,
770 pkgCacheFile &Cache,
771 pkgCache::DepIterator const &D,
772 CacheSetHelper::VerSelector const selector,
773 CacheSetHelper &helper);
774
775 VersionContainerInterface();
776 VersionContainerInterface(VersionContainerInterface const &other);
777 VersionContainerInterface& operator=(VersionContainerInterface const &other);
778 virtual ~VersionContainerInterface();
779private:
780 void * const d;
781
782protected: /*{{{*/
783
789 static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache,
790 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
791
797 static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
798 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
799 /*}}}*/
800};
801 /*}}}*/
802 template<class Container> class APT_PUBLIC VersionContainer : public VersionContainerInterface {/*{{{*/
808 Container _cont;
809public: /*{{{*/
810
811 typedef Container_const_iterator<VersionContainerInterface, Container, VersionContainer> const_iterator;
812 typedef Container_iterator<VersionContainerInterface, Container, VersionContainer> iterator;
813 typedef Container_const_reverse_iterator<VersionContainerInterface, Container, VersionContainer> const_reverse_iterator;
814 typedef Container_reverse_iterator<VersionContainerInterface, Container, VersionContainer> reverse_iterator;
815 typedef typename Container::value_type value_type;
816 typedef typename Container::pointer pointer;
817 typedef typename Container::const_pointer const_pointer;
818 typedef typename Container::reference reference;
819 typedef typename Container::const_reference const_reference;
820 typedef typename Container::difference_type difference_type;
821 typedef typename Container::size_type size_type;
822 typedef typename Container::allocator_type allocator_type;
823
824 bool insert(pkgCache::VerIterator const &V) APT_OVERRIDE { if (V.end() == true) return false; _cont.insert(V); return true; }
825 template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }
826 void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
827 bool empty() const APT_OVERRIDE { return _cont.empty(); }
828 void clear() APT_OVERRIDE { return _cont.clear(); }
829 size_t size() const APT_OVERRIDE { return _cont.size(); }
830#if APT_GCC_VERSION >= 0x409
831 iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
832 iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
833#else
834 iterator erase( iterator pos ) { return iterator(_cont.erase(pos._iter)); }
835 iterator erase( iterator first, iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
836#endif
837 const_iterator begin() const { return const_iterator(_cont.begin()); }
838 const_iterator end() const { return const_iterator(_cont.end()); }
839 const_reverse_iterator rbegin() const { return const_reverse_iterator(_cont.rbegin()); }
840 const_reverse_iterator rend() const { return const_reverse_iterator(_cont.rend()); }
841#if __cplusplus >= 201103L
842 const_iterator cbegin() const { return const_iterator(_cont.cbegin()); }
843 const_iterator cend() const { return const_iterator(_cont.cend()); }
844 const_reverse_iterator crbegin() const { return const_reverse_iterator(_cont.crbegin()); }
845 const_reverse_iterator crend() const { return const_reverse_iterator(_cont.crend()); }
846#endif
847 iterator begin() { return iterator(_cont.begin()); }
848 iterator end() { return iterator(_cont.end()); }
849 reverse_iterator rbegin() { return reverse_iterator(_cont.rbegin()); }
850 reverse_iterator rend() { return reverse_iterator(_cont.rend()); }
851 const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }
852
853 VersionContainer() : VersionContainerInterface() {}
854 template<typename Itr> VersionContainer(Itr first, Itr last) : VersionContainerInterface(), _cont(first, last) {}
855#if __cplusplus >= 201103L
856 VersionContainer(std::initializer_list<value_type> list) : VersionContainerInterface(), _cont(list) {}
857 void push_back(value_type&& P) { _cont.emplace_back(std::move(P)); }
858 template<typename... Args> void emplace_back(Args&&... args) { _cont.emplace_back(std::forward<Args>(args)...); }
859#endif
860 void push_back(const value_type& P) { _cont.push_back(P); }
861
872 template<class Compare> bool sort(Compare /*Comp*/) { return false; }
873
882 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
883 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper) {
884 VersionContainer vercon;
885 VersionContainerInterface::FromCommandLine(&vercon, Cache, cmdline, fallback, helper);
886 return vercon;
887 }
888 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
889 CacheSetHelper::VerSelector const fallback) {
890 CacheSetHelper helper;
891 return FromCommandLine(Cache, cmdline, fallback, helper);
892 }
893 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
894 return FromCommandLine(Cache, cmdline, CacheSetHelper::CANDINST);
895 }
896 static VersionContainer FromString(pkgCacheFile &Cache, std::string const &pkg,
897 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
898 bool const /*onlyFromName = false*/) {
899 VersionContainer vercon;
900 VersionContainerInterface::FromString(&vercon, Cache, pkg, fallback, helper);
901 return vercon;
902 }
903 static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg,
904 CacheSetHelper::VerSelector const fallback) {
905 CacheSetHelper helper;
906 return FromString(Cache, pkg, fallback, helper);
907 }
908 static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg) {
909 return FromString(Cache, pkg, CacheSetHelper::CANDINST);
910 }
911
912
919 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
920 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper) {
921 VersionContainer vercon;
922 VersionContainerInterface::FromPackage(&vercon, Cache, P, fallback, helper);
923 return vercon;
924 }
925 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
926 CacheSetHelper::VerSelector const fallback) {
927 CacheSetHelper helper;
928 return FromPackage(Cache, P, fallback, helper);
929 }
930 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P) {
931 return FromPackage(Cache, P, CacheSetHelper::CANDIDATE);
932 }
933
934 static std::map<unsigned short, VersionContainer> GroupedFromCommandLine(
935 pkgCacheFile &Cache,
936 const char **cmdline,
937 std::list<Modifier> const &mods,
938 unsigned short const fallback,
939 CacheSetHelper &helper) {
940 std::map<unsigned short, VersionContainer> versets;
941 for (const char **I = cmdline; *I != 0; ++I) {
942 unsigned short modID = fallback;
943 VersionContainer verset;
944 VersionContainerInterface::FromModifierCommandLine(modID, &verset, Cache, *I, mods, helper);
945 versets[modID].insert(verset);
946 }
947 return versets;
948
949 }
950 static std::map<unsigned short, VersionContainer> GroupedFromCommandLine(
951 pkgCacheFile &Cache, const char **cmdline,
952 std::list<Modifier> const &mods,
953 unsigned short const fallback) {
954 CacheSetHelper helper;
955 return GroupedFromCommandLine(Cache, cmdline,
956 mods, fallback, helper);
957 }
958
959 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
960 CacheSetHelper::VerSelector const selector, CacheSetHelper &helper) {
961 VersionContainer vercon;
962 VersionContainerInterface::FromDependency(&vercon, Cache, D, selector, helper);
963 return vercon;
964 }
965 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
966 CacheSetHelper::VerSelector const selector) {
967 CacheSetHelper helper;
968 return FromDependency(Cache, D, selector, helper);
969 }
970 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D) {
971 return FromDependency(Cache, D, CacheSetHelper::CANDIDATE);
972 }
973 /*}}}*/
974}; /*}}}*/
975// various specialisations for VersionContainer /*{{{*/
976template<> template<class Cont> void VersionContainer<std::list<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
977 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
978 _cont.push_back(*v);
979}
980#if __cplusplus >= 201103L
981template<> template<class Cont> void VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
982 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
983 _cont.push_front(*v);
984}
985#endif
986template<> template<class Cont> void VersionContainer<std::deque<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
987 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
988 _cont.push_back(*v);
989}
990template<> template<class Cont> void VersionContainer<std::vector<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
991 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
992 _cont.push_back(*v);
993}
994// these are 'inline' as otherwise the linker has problems with seeing these untemplated
995// specializations again and again - but we need to see them, so that library users can use them
996template<> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
997 if (V.end() == true)
998 return false;
999 _cont.push_back(V);
1000 return true;
1001}
1002#if __cplusplus >= 201103L
1003template<> inline bool VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1004 if (V.end() == true)
1005 return false;
1006 _cont.push_front(V);
1007 return true;
1008}
1009#endif
1010template<> inline bool VersionContainer<std::deque<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1011 if (V.end() == true)
1012 return false;
1013 _cont.push_back(V);
1014 return true;
1015}
1016template<> inline bool VersionContainer<std::vector<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1017 if (V.end() == true)
1018 return false;
1019 _cont.push_back(V);
1020 return true;
1021}
1022template<> inline void VersionContainer<std::list<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1023 for (const_iterator v = begin; v != end; ++v)
1024 _cont.push_back(*v);
1025}
1026#if __cplusplus >= 201103L
1027template<> inline void VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1028 for (const_iterator v = begin; v != end; ++v)
1029 _cont.push_front(*v);
1030}
1031#endif
1032template<> inline void VersionContainer<std::deque<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1033 for (const_iterator v = begin; v != end; ++v)
1034 _cont.push_back(*v);
1035}
1036template<> inline void VersionContainer<std::vector<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1037 for (const_iterator v = begin; v != end; ++v)
1038 _cont.push_back(*v);
1039}
1040#if APT_GCC_VERSION < 0x409
1041template<> inline VersionContainer<std::set<pkgCache::VerIterator> >::iterator VersionContainer<std::set<pkgCache::VerIterator> >::erase(iterator i) {
1042 _cont.erase(i._iter);
1043 return end();
1044}
1045template<> inline VersionContainer<std::set<pkgCache::VerIterator> >::iterator VersionContainer<std::set<pkgCache::VerIterator> >::erase(iterator first, iterator last) {
1046 _cont.erase(first, last);
1047 return end();
1048}
1049#endif
1050template<> template<class Compare> inline bool VersionContainer<std::vector<pkgCache::VerIterator> >::sort(Compare Comp) {
1051 std::sort(_cont.begin(), _cont.end(), Comp);
1052 return true;
1053}
1054template<> template<class Compare> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::sort(Compare Comp) {
1055 _cont.sort(Comp);
1056 return true;
1057}
1058#if __cplusplus >= 201103L
1059template<> template<class Compare> inline bool VersionContainer<std::forward_list<pkgCache::VerIterator> >::sort(Compare Comp) {
1060 _cont.sort(Comp);
1061 return true;
1062}
1063#endif
1064template<> template<class Compare> inline bool VersionContainer<std::deque<pkgCache::VerIterator> >::sort(Compare Comp) {
1065 std::sort(_cont.begin(), _cont.end(), Comp);
1066 return true;
1067}
1068 /*}}}*/
1069
1070typedef VersionContainer<std::set<pkgCache::VerIterator> > VersionSet;
1071#if __cplusplus >= 201103L
1072typedef VersionContainer<std::unordered_set<pkgCache::VerIterator> > VersionUnorderedSet;
1073typedef VersionContainer<std::forward_list<pkgCache::VerIterator> > VersionForwardList;
1074#endif
1075typedef VersionContainer<std::list<pkgCache::VerIterator> > VersionList;
1076typedef VersionContainer<std::deque<pkgCache::VerIterator> > VersionDeque;
1077typedef VersionContainer<std::vector<pkgCache::VerIterator> > VersionVector;
1078}
1079#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::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::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::PackageUniverse
Definition cacheset.h:640
APT::VersionContainerInterface::iterator_base
smell like a pkgCache::VerIterator
Definition cacheset.h:703
APT::VersionContainerInterface
Definition cacheset.h:697
APT::VersionContainer
Definition cacheset.h:802
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:919
APT::VersionContainer::sort
bool sort(Compare)
sort all included versions with given comparer
Definition cacheset.h:872
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:882
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
Definition cacheiterators.h:47
pkgcache.h
pkgCache - Structure definitions for the cache file
APT::CacheSetHelper::PkgModifier
Definition cacheset.h:61
APT::VersionContainerInterface::Modifier
Definition cacheset.h:737
pkgCache::Package
contains information for a single unique package
Definition pkgcache.h:450
pkgCache::Version
information for a single version of a package
Definition pkgcache.h:625