apt: apt-pkg/cacheset.h Source File

apt 2.3.15 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 <stddef.h>
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 std::iterator<typename std::iterator_traits<container_iterator>::iterator_category, container_value>,
207 public Interface::template iterator_base<iterator_type>
208{
209protected:
210 container_iterator _iter;
211public:
212 explicit Container_iterator_base(container_iterator const &i) : _iter(i) {}
213 inline container_value operator*(void) const { return static_cast<iterator_type const*>(this)->getType(); };
214 operator container_iterator(void) const { return _iter; }
215 inline iterator_type& operator++() { ++_iter; return static_cast<iterator_type&>(*this); }
216 inline iterator_type operator++(int) { iterator_type tmp(*this); operator++(); return tmp; }
217 inline iterator_type operator+(typename container_iterator::difference_type const &n) { return iterator_type(_iter + n); }
218 inline iterator_type operator+=(typename container_iterator::difference_type const &n) { _iter += n; return static_cast<iterator_type&>(*this); }
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 typename container_iterator::difference_type operator-(iterator_type const &b) { return (_iter - b._iter); }
223 inline iterator_type operator-=(typename container_iterator::difference_type const &n) { _iter -= n; return static_cast<iterator_type&>(*this); }
224 inline bool operator!=(iterator_type const &i) const { return _iter != i._iter; }
225 inline bool operator==(iterator_type const &i) const { return _iter == i._iter; }
226 inline bool operator<(iterator_type const &i) const { return _iter < i._iter; }
227 inline bool operator>(iterator_type const &i) const { return _iter > i._iter; }
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 typename container_iterator::reference operator[](typename container_iterator::difference_type const &n) const { return _iter[n]; }
231
232 friend std::ostream& operator<<(std::ostream& out, iterator_type i) { return operator<<(out, *i); }
233 friend Master;
234};
235 template<class Interface, class Container, class Master> class Container_const_iterator :
236 public Container_iterator_base<Interface, Master, Container_const_iterator<Interface, Container, Master>, typename Container::const_iterator, typename Container::value_type>
237{
238 typedef Container_const_iterator<Interface, Container, Master> iterator_type;
239 typedef typename Container::const_iterator container_iterator;
240public:
241 explicit Container_const_iterator(container_iterator i) :
242 Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
243
244 inline typename Container::value_type getType(void) const { return *this->_iter; }
245};
246 template<class Interface, class Container, class Master> class Container_iterator :
247 public Container_iterator_base<Interface, Master, Container_iterator<Interface, Container, Master>, typename Container::iterator, typename Container::value_type>
248{
249 typedef Container_iterator<Interface, Container, Master> iterator_type;
250 typedef typename Container::iterator container_iterator;
251public:
252 explicit Container_iterator(container_iterator const &i) :
253 Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
254
255 operator typename Master::const_iterator() { return typename Master::const_iterator(this->_iter); }
256 inline typename Container::iterator::reference operator*(void) const { return *this->_iter; }
257
258 inline typename Container::value_type getType(void) const { return *this->_iter; }
259};
260 template<class Interface, class Container, class Master> class Container_const_reverse_iterator :
261 public Container_iterator_base<Interface, Master, Container_const_reverse_iterator<Interface, Container, Master>, typename Container::const_reverse_iterator, typename Container::value_type>
262{
263 typedef Container_const_reverse_iterator<Interface, Container, Master> iterator_type;
264 typedef typename Container::const_reverse_iterator container_iterator;
265public:
266 explicit Container_const_reverse_iterator(container_iterator i) :
267 Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
268
269 inline typename Container::value_type getType(void) const { return *this->_iter; }
270};
271 template<class Interface, class Container, class Master> class Container_reverse_iterator :
272 public Container_iterator_base<Interface, Master, Container_reverse_iterator<Interface, Container, Master>, typename Container::reverse_iterator, typename Container::value_type>
273{
274 typedef Container_reverse_iterator<Interface, Container, Master> iterator_type;
275 typedef typename Container::reverse_iterator container_iterator;
276public:
277 explicit Container_reverse_iterator(container_iterator i) :
278 Container_iterator_base<Interface, Master, iterator_type, container_iterator, typename Container::value_type>(i) {}
279
280 operator typename Master::const_iterator() { return typename Master::const_iterator(this->_iter); }
281 inline iterator_type& operator=(iterator_type const &i) { this->_iter = i._iter; return static_cast<iterator_type&>(*this); }
282 inline iterator_type& operator=(container_iterator const &i) { this->_iter = i; return static_cast<iterator_type&>(*this); }
283 inline typename Container::reverse_iterator::reference operator*(void) const { return *this->_iter; }
284
285 inline typename Container::value_type getType(void) const { return *this->_iter; }
286};
287 /*}}}*/
288 class APT_PUBLIC PackageContainerInterface { /*{{{*/
298public:
299 template<class Itr> class iterator_base { /*{{{*/
300 pkgCache::PkgIterator getType() const { return static_cast<Itr const*>(this)->getType(); };
301 public:
302 operator pkgCache::PkgIterator(void) const { return getType(); }
303
304 inline const char *Name() const {return getType().Name(); }
305 inline std::string FullName(bool const Pretty) const { return getType().FullName(Pretty); }
306 inline std::string FullName() const { return getType().FullName(); }
307 inline bool Purge() const {return getType().Purge(); }
308 inline const char *Arch() const {return getType().Arch(); }
309 inline pkgCache::GrpIterator Group() const { return getType().Group(); }
310 inline pkgCache::VerIterator VersionList() const { return getType().VersionList(); }
311 inline pkgCache::VerIterator CurrentVer() const { return getType().CurrentVer(); }
312 inline pkgCache::DepIterator RevDependsList() const { return getType().RevDependsList(); }
313 inline pkgCache::PrvIterator ProvidesList() const { return getType().ProvidesList(); }
314 inline pkgCache::PkgIterator::OkState State() const { return getType().State(); }
315 inline const char *CurVersion() const { return getType().CurVersion(); }
316 inline pkgCache *Cache() const { return getType().Cache(); }
317 inline unsigned long Index() const {return getType().Index();}
318 // we have only valid iterators here
319 inline bool end() const { return false; }
320
321 inline pkgCache::Package const * operator->() const {return &*getType();}
322 };
323 /*}}}*/
324
325 virtual bool insert(pkgCache::PkgIterator const &P) = 0;
326 virtual bool empty() const = 0;
327 virtual void clear() = 0;
328 virtual size_t size() const = 0;
329
330 void setConstructor(CacheSetHelper::PkgSelector const by) { ConstructedBy = by; }
331 CacheSetHelper::PkgSelector getConstructor() const { return ConstructedBy; }
332 PackageContainerInterface();
333 explicit PackageContainerInterface(CacheSetHelper::PkgSelector const by);
334 PackageContainerInterface(PackageContainerInterface const &by);
335 PackageContainerInterface& operator=(PackageContainerInterface const &other);
336 virtual ~PackageContainerInterface();
337
338private:
339 CacheSetHelper::PkgSelector ConstructedBy;
340 void * const d;
341};
342 /*}}}*/
343 template<class Container> class APT_PUBLIC PackageContainer : public PackageContainerInterface {/*{{{*/
349 Container _cont;
350public: /*{{{*/
352 typedef Container_const_iterator<PackageContainerInterface, Container, PackageContainer> const_iterator;
353 typedef Container_iterator<PackageContainerInterface, Container, PackageContainer> iterator;
354 typedef Container_const_reverse_iterator<PackageContainerInterface, Container, PackageContainer> const_reverse_iterator;
355 typedef Container_reverse_iterator<PackageContainerInterface, Container, PackageContainer> reverse_iterator;
356 typedef typename Container::value_type value_type;
357 typedef typename Container::pointer pointer;
358 typedef typename Container::const_pointer const_pointer;
359 typedef typename Container::reference reference;
360 typedef typename Container::const_reference const_reference;
361 typedef typename Container::difference_type difference_type;
362 typedef typename Container::size_type size_type;
363 typedef typename Container::allocator_type allocator_type;
364
365 bool insert(pkgCache::PkgIterator const &P) APT_OVERRIDE { if (P.end() == true) return false; _cont.insert(P); return true; }
366 template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }
367 void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
368
369 bool empty() const APT_OVERRIDE { return _cont.empty(); }
370 void clear() APT_OVERRIDE { return _cont.clear(); }
371 size_t size() const APT_OVERRIDE { return _cont.size(); }
372#if __GNUC__ >= 5 || (__GNUC_MINOR__ >= 9 && __GNUC__ >= 4)
373 iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
374 iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
375#else
376 iterator erase( iterator pos ) { return iterator(_cont.erase(pos._iter)); }
377 iterator erase( iterator first, iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
378#endif
379 const_iterator begin() const { return const_iterator(_cont.begin()); }
380 const_iterator end() const { return const_iterator(_cont.end()); }
381 const_reverse_iterator rbegin() const { return const_reverse_iterator(_cont.rbegin()); }
382 const_reverse_iterator rend() const { return const_reverse_iterator(_cont.rend()); }
383#if __cplusplus >= 201103L
384 const_iterator cbegin() const { return const_iterator(_cont.cbegin()); }
385 const_iterator cend() const { return const_iterator(_cont.cend()); }
386 const_reverse_iterator crbegin() const { return const_reverse_iterator(_cont.crbegin()); }
387 const_reverse_iterator crend() const { return const_reverse_iterator(_cont.crend()); }
388#endif
389 iterator begin() { return iterator(_cont.begin()); }
390 iterator end() { return iterator(_cont.end()); }
391 reverse_iterator rbegin() { return reverse_iterator(_cont.rbegin()); }
392 reverse_iterator rend() { return reverse_iterator(_cont.rend()); }
393 const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); }
394
395 PackageContainer() : PackageContainerInterface(CacheSetHelper::UNKNOWN) {}
396 explicit PackageContainer(CacheSetHelper::PkgSelector const &by) : PackageContainerInterface(by) {}
397 template<typename Itr> PackageContainer(Itr first, Itr last) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(first, last) {}
398#if __cplusplus >= 201103L
399 PackageContainer(std::initializer_list<value_type> list) : PackageContainerInterface(CacheSetHelper::UNKNOWN), _cont(list) {}
400 void push_back(value_type&& P) { _cont.emplace_back(std::move(P)); }
401 template<typename... Args> void emplace_back(Args&&... args) { _cont.emplace_back(std::forward<Args>(args)...); }
402#endif
403 void push_back(const value_type& P) { _cont.push_back(P); }
404
415 template<class Compare> bool sort(Compare /*Comp*/) { return false; }
416
425 static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
426 PackageContainer cont(CacheSetHelper::TASK);
427 helper.PackageFrom(CacheSetHelper::TASK, &cont, Cache, pattern);
428 return cont;
429 }
430 static PackageContainer FromTask(pkgCacheFile &Cache, std::string const &pattern) {
431 CacheSetHelper helper;
432 return FromTask(Cache, pattern, helper);
433 }
434
443 static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
444 PackageContainer cont(CacheSetHelper::REGEX);
445 helper.PackageFrom(CacheSetHelper::REGEX, &cont, Cache, pattern);
446 return cont;
447 }
448
449 static PackageContainer FromRegEx(pkgCacheFile &Cache, std::string const &pattern) {
450 CacheSetHelper helper;
451 return FromRegEx(Cache, pattern, helper);
452 }
453
454 static PackageContainer FromFnmatch(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
455 PackageContainer cont(CacheSetHelper::FNMATCH);
456 helper.PackageFrom(CacheSetHelper::FNMATCH, &cont, Cache, pattern);
457 return cont;
458 }
459 static PackageContainer FromFnMatch(pkgCacheFile &Cache, std::string const &pattern) {
460 CacheSetHelper helper;
461 return FromFnmatch(Cache, pattern, helper);
462 }
463
469 static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
470 PackageContainer cont;
471 helper.PackageFrom(CacheSetHelper::PACKAGENAME, &cont, Cache, pattern);
472 return cont;
473 }
474 static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern) {
475 CacheSetHelper helper;
476 return FromString(Cache, pattern, helper);
477 }
478
486 static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper) {
487 PackageContainer cont;
488 helper.PackageFromCommandLine(&cont, Cache, cmdline);
489 return cont;
490 }
491 static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
492 CacheSetHelper helper;
493 return FromCommandLine(Cache, cmdline, helper);
494 }
495
507 static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
508 pkgCacheFile &Cache,
509 const char **cmdline,
510 std::list<CacheSetHelper::PkgModifier> const &mods,
511 unsigned short const &fallback,
512 CacheSetHelper &helper) {
513 std::map<unsigned short, PackageContainer> pkgsets;
514 for (const char **I = cmdline; *I != 0; ++I) {
515 unsigned short modID = fallback;
516 PackageContainer pkgset;
517 helper.PackageFromModifierCommandLine(modID, &pkgset, Cache, *I, mods);
518 pkgsets[modID].insert(pkgset);
519 }
520 return pkgsets;
521 }
522 static std::map<unsigned short, PackageContainer> GroupedFromCommandLine(
523 pkgCacheFile &Cache,
524 const char **cmdline,
525 std::list<CacheSetHelper::PkgModifier> const &mods,
526 unsigned short const &fallback) {
527 CacheSetHelper helper;
528 return GroupedFromCommandLine(Cache, cmdline,
529 mods, fallback, helper);
530 }
531 /*}}}*/
532}; /*}}}*/
533// various specialisations for PackageContainer /*{{{*/
534template<> template<class Cont> void PackageContainer<std::list<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
535 for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
536 _cont.push_back(*p);
537}
538#if __cplusplus >= 201103L
539template<> template<class Cont> void PackageContainer<std::forward_list<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
540 for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
541 _cont.push_front(*p);
542}
543#endif
544template<> template<class Cont> void PackageContainer<std::deque<pkgCache::PkgIterator> >::insert(PackageContainer<Cont> const &pkgcont) {
545 for (typename PackageContainer<Cont>::const_iterator p = pkgcont.begin(); p != pkgcont.end(); ++p)
546 _cont.push_back(*p);
547}
548template<> template<class Cont> void PackageContainer<std::vector<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}
552// these are 'inline' as otherwise the linker has problems with seeing these untemplated
553// specializations again and again - but we need to see them, so that library users can use them
554template<> inline bool PackageContainer<std::list<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
555 if (P.end() == true)
556 return false;
557 _cont.push_back(P);
558 return true;
559}
560#if __cplusplus >= 201103L
561template<> inline bool PackageContainer<std::forward_list<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
562 if (P.end() == true)
563 return false;
564 _cont.push_front(P);
565 return true;
566}
567#endif
568template<> inline bool PackageContainer<std::deque<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
569 if (P.end() == true)
570 return false;
571 _cont.push_back(P);
572 return true;
573}
574template<> inline bool PackageContainer<std::vector<pkgCache::PkgIterator> >::insert(pkgCache::PkgIterator const &P) {
575 if (P.end() == true)
576 return false;
577 _cont.push_back(P);
578 return true;
579}
580template<> inline void PackageContainer<std::list<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
581 for (const_iterator p = begin; p != end; ++p)
582 _cont.push_back(*p);
583}
584#if __cplusplus >= 201103L
585template<> inline void PackageContainer<std::forward_list<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
586 for (const_iterator p = begin; p != end; ++p)
587 _cont.push_front(*p);
588}
589#endif
590template<> inline void PackageContainer<std::deque<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
591 for (const_iterator p = begin; p != end; ++p)
592 _cont.push_back(*p);
593}
594template<> inline void PackageContainer<std::vector<pkgCache::PkgIterator> >::insert(const_iterator begin, const_iterator end) {
595 for (const_iterator p = begin; p != end; ++p)
596 _cont.push_back(*p);
597}
598#if APT_GCC_VERSION < 0x409
599template<> inline PackageContainer<std::set<pkgCache::PkgIterator> >::iterator PackageContainer<std::set<pkgCache::PkgIterator> >::erase(iterator i) {
600 _cont.erase(i._iter);
601 return end();
602}
603template<> inline PackageContainer<std::set<pkgCache::PkgIterator> >::iterator PackageContainer<std::set<pkgCache::PkgIterator> >::erase(iterator first, iterator last) {
604 _cont.erase(first, last);
605 return end();
606}
607#endif
608template<> template<class Compare> inline bool PackageContainer<std::vector<pkgCache::PkgIterator> >::sort(Compare Comp) {
609 std::sort(_cont.begin(), _cont.end(), Comp);
610 return true;
611}
612template<> template<class Compare> inline bool PackageContainer<std::list<pkgCache::PkgIterator> >::sort(Compare Comp) {
613 _cont.sort(Comp);
614 return true;
615}
616#if __cplusplus >= 201103L
617template<> template<class Compare> inline bool PackageContainer<std::forward_list<pkgCache::PkgIterator> >::sort(Compare Comp) {
618 _cont.sort(Comp);
619 return true;
620}
621#endif
622template<> template<class Compare> inline bool PackageContainer<std::deque<pkgCache::PkgIterator> >::sort(Compare Comp) {
623 std::sort(_cont.begin(), _cont.end(), Comp);
624 return true;
625}
626 /*}}}*/
627
628// class PackageUniverse - pkgCache as PackageContainerInterface /*{{{*/
636 class APT_PUBLIC PackageUniverse : public PackageContainerInterface {
637 pkgCache * const _cont;
638 void * const d;
639public:
640 class const_iterator : public APT::Container_iterator_base<APT::PackageContainerInterface, PackageUniverse, PackageUniverse::const_iterator, pkgCache::PkgIterator, pkgCache::PkgIterator>
641 {
642 public:
643 explicit const_iterator(pkgCache::PkgIterator i):
644 Container_iterator_base<APT::PackageContainerInterface, PackageUniverse, PackageUniverse::const_iterator, pkgCache::PkgIterator, pkgCache::PkgIterator>(i) {}
645
646 inline pkgCache::PkgIterator getType(void) const { return _iter; }
647 };
648 typedef const_iterator iterator;
649 typedef pkgCache::PkgIterator value_type;
650 typedef typename pkgCache::PkgIterator* pointer;
651 typedef typename pkgCache::PkgIterator const* const_pointer;
652 typedef const pkgCache::PkgIterator& const_reference;
653 typedef const_reference reference;
654 typedef const_iterator::difference_type difference_type;
655 typedef std::make_unsigned<const_iterator::difference_type>::type size_type;
656
657
658 bool empty() const APT_OVERRIDE { return false; }
659 size_t size() const APT_OVERRIDE { return _cont->Head().PackageCount; }
660
661 const_iterator begin() const { return const_iterator(_cont->PkgBegin()); }
662 const_iterator end() const { return const_iterator(_cont->PkgEnd()); }
663 const_iterator cbegin() const { return const_iterator(_cont->PkgBegin()); }
664 const_iterator cend() const { return const_iterator(_cont->PkgEnd()); }
665 iterator begin() { return iterator(_cont->PkgBegin()); }
666 iterator end() { return iterator(_cont->PkgEnd()); }
667
668 pkgCache * data() const { return _cont; }
669
670 explicit PackageUniverse(pkgCache * const Owner);
671 explicit PackageUniverse(pkgCacheFile * const Owner);
672 virtual ~PackageUniverse();
673
674private:
675 APT_HIDDEN bool insert(pkgCache::PkgIterator const &) APT_OVERRIDE { return true; }
676 template<class Cont> APT_HIDDEN void insert(PackageContainer<Cont> const &) { }
677 APT_HIDDEN void insert(const_iterator, const_iterator) { }
678
679 APT_HIDDEN void clear() APT_OVERRIDE { }
680 APT_HIDDEN iterator erase( const_iterator pos );
681 APT_HIDDEN iterator erase( const_iterator first, const_iterator last );
682};
683 /*}}}*/
684typedef PackageContainer<std::set<pkgCache::PkgIterator> > PackageSet;
685#if __cplusplus >= 201103L
686typedef PackageContainer<std::unordered_set<pkgCache::PkgIterator> > PackageUnorderedSet;
687typedef PackageContainer<std::forward_list<pkgCache::PkgIterator> > PackageForwardList;
688#endif
689typedef PackageContainer<std::list<pkgCache::PkgIterator> > PackageList;
690typedef PackageContainer<std::deque<pkgCache::PkgIterator> > PackageDeque;
691typedef PackageContainer<std::vector<pkgCache::PkgIterator> > PackageVector;
692
693 class APT_PUBLIC VersionContainerInterface { /*{{{*/
697public:
699 template<class Itr> class iterator_base { /*{{{*/
700 pkgCache::VerIterator getType() const { return static_cast<Itr const*>(this)->getType(); };
701 public:
702 operator pkgCache::VerIterator(void) { return getType(); }
703
704 inline pkgCache *Cache() const { return getType().Cache(); }
705 inline unsigned long Index() const {return getType().Index();}
706 inline int CompareVer(const pkgCache::VerIterator &B) const { return getType().CompareVer(B); }
707 inline const char *VerStr() const { return getType().VerStr(); }
708 inline const char *Section() const { return getType().Section(); }
709 inline const char *Arch() const { return getType().Arch(); }
710 inline pkgCache::PkgIterator ParentPkg() const { return getType().ParentPkg(); }
711 inline pkgCache::DescIterator DescriptionList() const { return getType().DescriptionList(); }
712 inline pkgCache::DescIterator TranslatedDescription() const { return getType().TranslatedDescription(); }
713 inline pkgCache::DepIterator DependsList() const { return getType().DependsList(); }
714 inline pkgCache::PrvIterator ProvidesList() const { return getType().ProvidesList(); }
715 inline pkgCache::VerFileIterator FileList() const { return getType().FileList(); }
716 inline bool Downloadable() const { return getType().Downloadable(); }
717 inline const char *PriorityType() const { return getType().PriorityType(); }
718 inline std::string RelStr() const { return getType().RelStr(); }
719 inline bool Automatic() const { return getType().Automatic(); }
720 inline pkgCache::VerFileIterator NewestFile() const { return getType().NewestFile(); }
721 // we have only valid iterators here
722 inline bool end() const { return false; }
723
724 inline pkgCache::Version const * operator->() const { return &*getType(); }
725 };
726 /*}}}*/
727
728 virtual bool insert(pkgCache::VerIterator const &V) = 0;
729 virtual bool empty() const = 0;
730 virtual void clear() = 0;
731 virtual size_t size() const = 0;
732
733 struct Modifier {
734 unsigned short const ID;
735 const char * const Alias;
736 enum Position { NONE, PREFIX, POSTFIX } const Pos;
737 enum CacheSetHelper::VerSelector const SelectVersion;
738 Modifier (unsigned short const &id, const char * const alias, Position const &pos,
739 enum CacheSetHelper::VerSelector const select) : ID(id), Alias(alias), Pos(pos),
740 SelectVersion(select) {}
741 };
742
743 static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
744 const char **cmdline, CacheSetHelper::VerSelector const fallback,
745 CacheSetHelper &helper);
746
747 static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
748 std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
749 bool const onlyFromName = false);
750
751 static bool FromPattern(VersionContainerInterface *const vci, pkgCacheFile &Cache,
752 std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper);
753
754 static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
755 pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback,
756 CacheSetHelper &helper);
757
758 static bool FromModifierCommandLine(unsigned short &modID,
759 VersionContainerInterface * const vci,
760 pkgCacheFile &Cache, const char * cmdline,
761 std::list<Modifier> const &mods,
762 CacheSetHelper &helper);
763
764
765 static bool FromDependency(VersionContainerInterface * const vci,
766 pkgCacheFile &Cache,
767 pkgCache::DepIterator const &D,
768 CacheSetHelper::VerSelector const selector,
769 CacheSetHelper &helper);
770
771 VersionContainerInterface();
772 VersionContainerInterface(VersionContainerInterface const &other);
773 VersionContainerInterface& operator=(VersionContainerInterface const &other);
774 virtual ~VersionContainerInterface();
775private:
776 void * const d;
777
778protected: /*{{{*/
779
785 static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache,
786 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
787
793 static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
794 pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
795 /*}}}*/
796};
797 /*}}}*/
798 template<class Container> class APT_PUBLIC VersionContainer : public VersionContainerInterface {/*{{{*/
804 Container _cont;
805public: /*{{{*/
806
807 typedef Container_const_iterator<VersionContainerInterface, Container, VersionContainer> const_iterator;
808 typedef Container_iterator<VersionContainerInterface, Container, VersionContainer> iterator;
809 typedef Container_const_reverse_iterator<VersionContainerInterface, Container, VersionContainer> const_reverse_iterator;
810 typedef Container_reverse_iterator<VersionContainerInterface, Container, VersionContainer> reverse_iterator;
811 typedef typename Container::value_type value_type;
812 typedef typename Container::pointer pointer;
813 typedef typename Container::const_pointer const_pointer;
814 typedef typename Container::reference reference;
815 typedef typename Container::const_reference const_reference;
816 typedef typename Container::difference_type difference_type;
817 typedef typename Container::size_type size_type;
818 typedef typename Container::allocator_type allocator_type;
819
820 bool insert(pkgCache::VerIterator const &V) APT_OVERRIDE { if (V.end() == true) return false; _cont.insert(V); return true; }
821 template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }
822 void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
823 bool empty() const APT_OVERRIDE { return _cont.empty(); }
824 void clear() APT_OVERRIDE { return _cont.clear(); }
825 size_t size() const APT_OVERRIDE { return _cont.size(); }
826#if APT_GCC_VERSION >= 0x409
827 iterator erase( const_iterator pos ) { return iterator(_cont.erase(pos._iter)); }
828 iterator erase( const_iterator first, const_iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
829#else
830 iterator erase( iterator pos ) { return iterator(_cont.erase(pos._iter)); }
831 iterator erase( iterator first, iterator last ) { return iterator(_cont.erase(first._iter, last._iter)); }
832#endif
833 const_iterator begin() const { return const_iterator(_cont.begin()); }
834 const_iterator end() const { return const_iterator(_cont.end()); }
835 const_reverse_iterator rbegin() const { return const_reverse_iterator(_cont.rbegin()); }
836 const_reverse_iterator rend() const { return const_reverse_iterator(_cont.rend()); }
837#if __cplusplus >= 201103L
838 const_iterator cbegin() const { return const_iterator(_cont.cbegin()); }
839 const_iterator cend() const { return const_iterator(_cont.cend()); }
840 const_reverse_iterator crbegin() const { return const_reverse_iterator(_cont.crbegin()); }
841 const_reverse_iterator crend() const { return const_reverse_iterator(_cont.crend()); }
842#endif
843 iterator begin() { return iterator(_cont.begin()); }
844 iterator end() { return iterator(_cont.end()); }
845 reverse_iterator rbegin() { return reverse_iterator(_cont.rbegin()); }
846 reverse_iterator rend() { return reverse_iterator(_cont.rend()); }
847 const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }
848
849 VersionContainer() : VersionContainerInterface() {}
850 template<typename Itr> VersionContainer(Itr first, Itr last) : VersionContainerInterface(), _cont(first, last) {}
851#if __cplusplus >= 201103L
852 VersionContainer(std::initializer_list<value_type> list) : VersionContainerInterface(), _cont(list) {}
853 void push_back(value_type&& P) { _cont.emplace_back(std::move(P)); }
854 template<typename... Args> void emplace_back(Args&&... args) { _cont.emplace_back(std::forward<Args>(args)...); }
855#endif
856 void push_back(const value_type& P) { _cont.push_back(P); }
857
868 template<class Compare> bool sort(Compare /*Comp*/) { return false; }
869
878 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
879 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper) {
880 VersionContainer vercon;
881 VersionContainerInterface::FromCommandLine(&vercon, Cache, cmdline, fallback, helper);
882 return vercon;
883 }
884 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
885 CacheSetHelper::VerSelector const fallback) {
886 CacheSetHelper helper;
887 return FromCommandLine(Cache, cmdline, fallback, helper);
888 }
889 static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline) {
890 return FromCommandLine(Cache, cmdline, CacheSetHelper::CANDINST);
891 }
892 static VersionContainer FromString(pkgCacheFile &Cache, std::string const &pkg,
893 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
894 bool const /*onlyFromName = false*/) {
895 VersionContainer vercon;
896 VersionContainerInterface::FromString(&vercon, Cache, pkg, fallback, helper);
897 return vercon;
898 }
899 static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg,
900 CacheSetHelper::VerSelector const fallback) {
901 CacheSetHelper helper;
902 return FromString(Cache, pkg, fallback, helper);
903 }
904 static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg) {
905 return FromString(Cache, pkg, CacheSetHelper::CANDINST);
906 }
907
908
915 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
916 CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper) {
917 VersionContainer vercon;
918 VersionContainerInterface::FromPackage(&vercon, Cache, P, fallback, helper);
919 return vercon;
920 }
921 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
922 CacheSetHelper::VerSelector const fallback) {
923 CacheSetHelper helper;
924 return FromPackage(Cache, P, fallback, helper);
925 }
926 static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P) {
927 return FromPackage(Cache, P, CacheSetHelper::CANDIDATE);
928 }
929
930 static std::map<unsigned short, VersionContainer> GroupedFromCommandLine(
931 pkgCacheFile &Cache,
932 const char **cmdline,
933 std::list<Modifier> const &mods,
934 unsigned short const fallback,
935 CacheSetHelper &helper) {
936 std::map<unsigned short, VersionContainer> versets;
937 for (const char **I = cmdline; *I != 0; ++I) {
938 unsigned short modID = fallback;
939 VersionContainer verset;
940 VersionContainerInterface::FromModifierCommandLine(modID, &verset, Cache, *I, mods, helper);
941 versets[modID].insert(verset);
942 }
943 return versets;
944
945 }
946 static std::map<unsigned short, VersionContainer> GroupedFromCommandLine(
947 pkgCacheFile &Cache, const char **cmdline,
948 std::list<Modifier> const &mods,
949 unsigned short const fallback) {
950 CacheSetHelper helper;
951 return GroupedFromCommandLine(Cache, cmdline,
952 mods, fallback, helper);
953 }
954
955 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
956 CacheSetHelper::VerSelector const selector, CacheSetHelper &helper) {
957 VersionContainer vercon;
958 VersionContainerInterface::FromDependency(&vercon, Cache, D, selector, helper);
959 return vercon;
960 }
961 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
962 CacheSetHelper::VerSelector const selector) {
963 CacheSetHelper helper;
964 return FromDependency(Cache, D, selector, helper);
965 }
966 static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D) {
967 return FromDependency(Cache, D, CacheSetHelper::CANDIDATE);
968 }
969 /*}}}*/
970}; /*}}}*/
971// various specialisations for VersionContainer /*{{{*/
972template<> template<class Cont> void VersionContainer<std::list<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
973 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
974 _cont.push_back(*v);
975}
976#if __cplusplus >= 201103L
977template<> template<class Cont> void VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
978 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
979 _cont.push_front(*v);
980}
981#endif
982template<> template<class Cont> void VersionContainer<std::deque<pkgCache::VerIterator> >::insert(VersionContainer<Cont> const &vercont) {
983 for (typename VersionContainer<Cont>::const_iterator v = vercont.begin(); v != vercont.end(); ++v)
984 _cont.push_back(*v);
985}
986template<> template<class Cont> void VersionContainer<std::vector<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}
990// these are 'inline' as otherwise the linker has problems with seeing these untemplated
991// specializations again and again - but we need to see them, so that library users can use them
992template<> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
993 if (V.end() == true)
994 return false;
995 _cont.push_back(V);
996 return true;
997}
998#if __cplusplus >= 201103L
999template<> inline bool VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1000 if (V.end() == true)
1001 return false;
1002 _cont.push_front(V);
1003 return true;
1004}
1005#endif
1006template<> inline bool VersionContainer<std::deque<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1007 if (V.end() == true)
1008 return false;
1009 _cont.push_back(V);
1010 return true;
1011}
1012template<> inline bool VersionContainer<std::vector<pkgCache::VerIterator> >::insert(pkgCache::VerIterator const &V) {
1013 if (V.end() == true)
1014 return false;
1015 _cont.push_back(V);
1016 return true;
1017}
1018template<> inline void VersionContainer<std::list<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1019 for (const_iterator v = begin; v != end; ++v)
1020 _cont.push_back(*v);
1021}
1022#if __cplusplus >= 201103L
1023template<> inline void VersionContainer<std::forward_list<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1024 for (const_iterator v = begin; v != end; ++v)
1025 _cont.push_front(*v);
1026}
1027#endif
1028template<> inline void VersionContainer<std::deque<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1029 for (const_iterator v = begin; v != end; ++v)
1030 _cont.push_back(*v);
1031}
1032template<> inline void VersionContainer<std::vector<pkgCache::VerIterator> >::insert(const_iterator begin, const_iterator end) {
1033 for (const_iterator v = begin; v != end; ++v)
1034 _cont.push_back(*v);
1035}
1036#if APT_GCC_VERSION < 0x409
1037template<> inline VersionContainer<std::set<pkgCache::VerIterator> >::iterator VersionContainer<std::set<pkgCache::VerIterator> >::erase(iterator i) {
1038 _cont.erase(i._iter);
1039 return end();
1040}
1041template<> inline VersionContainer<std::set<pkgCache::VerIterator> >::iterator VersionContainer<std::set<pkgCache::VerIterator> >::erase(iterator first, iterator last) {
1042 _cont.erase(first, last);
1043 return end();
1044}
1045#endif
1046template<> template<class Compare> inline bool VersionContainer<std::vector<pkgCache::VerIterator> >::sort(Compare Comp) {
1047 std::sort(_cont.begin(), _cont.end(), Comp);
1048 return true;
1049}
1050template<> template<class Compare> inline bool VersionContainer<std::list<pkgCache::VerIterator> >::sort(Compare Comp) {
1051 _cont.sort(Comp);
1052 return true;
1053}
1054#if __cplusplus >= 201103L
1055template<> template<class Compare> inline bool VersionContainer<std::forward_list<pkgCache::VerIterator> >::sort(Compare Comp) {
1056 _cont.sort(Comp);
1057 return true;
1058}
1059#endif
1060template<> template<class Compare> inline bool VersionContainer<std::deque<pkgCache::VerIterator> >::sort(Compare Comp) {
1061 std::sort(_cont.begin(), _cont.end(), Comp);
1062 return true;
1063}
1064 /*}}}*/
1065
1066typedef VersionContainer<std::set<pkgCache::VerIterator> > VersionSet;
1067#if __cplusplus >= 201103L
1068typedef VersionContainer<std::unordered_set<pkgCache::VerIterator> > VersionUnorderedSet;
1069typedef VersionContainer<std::forward_list<pkgCache::VerIterator> > VersionForwardList;
1070#endif
1071typedef VersionContainer<std::list<pkgCache::VerIterator> > VersionList;
1072typedef VersionContainer<std::deque<pkgCache::VerIterator> > VersionDeque;
1073typedef VersionContainer<std::vector<pkgCache::VerIterator> > VersionVector;
1074}
1075#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:237
APT::Container_const_reverse_iterator
Definition: cacheset.h:262
APT::Container_iterator_base
Definition: cacheset.h:208
APT::Container_iterator
Definition: cacheset.h:248
APT::Container_reverse_iterator
Definition: cacheset.h:273
APT::PackageContainerInterface::iterator_base
Definition: cacheset.h:299
APT::PackageContainerInterface
Definition: cacheset.h:288
APT::PackageContainer
Definition: cacheset.h:343
APT::PackageContainer::FromString
static PackageContainer FromString(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper)
returns all packages specified by a string
Definition: cacheset.h:469
APT::PackageContainer::sort
bool sort(Compare)
sort all included versions with given comparer
Definition: cacheset.h:415
APT::PackageContainer::FromCommandLine
static PackageContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline, CacheSetHelper &helper)
returns all packages specified on the commandline
Definition: cacheset.h:486
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:507
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:425
APT::PackageContainer::const_iterator
Container_const_iterator< PackageContainerInterface, Container, PackageContainer > const_iterator
smell like a pkgCache::PkgIterator
Definition: cacheset.h:352
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:443
APT::PackageUniverse::const_iterator
Definition: cacheset.h:641
APT::PackageUniverse
Definition: cacheset.h:636
APT::VersionContainerInterface::iterator_base
smell like a pkgCache::VerIterator
Definition: cacheset.h:699
APT::VersionContainerInterface
Definition: cacheset.h:693
APT::VersionContainer
Definition: cacheset.h:798
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:915
APT::VersionContainer::sort
bool sort(Compare)
sort all included versions with given comparer
Definition: cacheset.h:868
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:878
GlobalError::MsgType
MsgType
a message can have one of following severity
Definition: error.h:55
GlobalError::ERROR
@ ERROR
An error does hinder the correct execution and should be corrected.
Definition: error.h:60
pkgCacheFile
Definition: cachefile.h:33
pkgCache
Definition: cacheiterators.h:48
pkgcache.h
pkgCache - Structure definitions for the cache file
APT::CacheSetHelper::PkgModifier
Definition: cacheset.h:61
APT::VersionContainerInterface::Modifier
Definition: cacheset.h:733
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