76
81
virtual pkgCache::VerIterator canNotFindInstalledVer(pkgCacheFile &Cache,
77
82
pkgCache::PkgIterator const &Pkg);
79
bool showErrors() const { return ShowError; };
80
bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); };
81
GlobalError::MsgType errorType() const { return ErrorType; };
84
bool showErrors() const { return ShowError; }
85
bool showErrors(bool const newValue) { if (ShowError == newValue) return ShowError; else return ((ShowError = newValue) == false); }
86
GlobalError::MsgType errorType() const { return ErrorType; }
82
87
GlobalError::MsgType errorType(GlobalError::MsgType const &newValue)
84
89
if (ErrorType == newValue) return ErrorType;
124
129
inline pkgCache::PkgIterator::OkState State() const { return getPkg().State(); }
125
130
inline const char *CandVersion() const { return getPkg().CandVersion(); }
126
131
inline const char *CurVersion() const { return getPkg().CurVersion(); }
127
inline pkgCache *Cache() const { return getPkg().Cache(); };
128
inline unsigned long Index() const {return getPkg().Index();};
132
inline pkgCache *Cache() const { return getPkg().Cache(); }
133
inline unsigned long Index() const {return getPkg().Index();}
129
134
// we have only valid iterators here
130
inline bool end() const { return false; };
135
inline bool end() const { return false; }
132
inline pkgCache::Package const * operator->() const {return &*getPkg();};
137
inline pkgCache::Package const * operator->() const {return &*getPkg();}
178
183
const_iterator(typename Container::const_iterator i) : _iter(i) {}
179
184
pkgCache::PkgIterator getPkg(void) const { return *_iter; }
180
inline pkgCache::PkgIterator operator*(void) const { return *_iter; };
185
inline pkgCache::PkgIterator operator*(void) const { return *_iter; }
181
186
operator typename Container::const_iterator(void) const { return _iter; }
182
187
inline const_iterator& operator++() { ++_iter; return *this; }
183
188
inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; }
184
inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; };
185
inline bool operator==(const_iterator const &i) const { return _iter == i._iter; };
189
inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }
190
inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }
186
191
friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); }
188
193
class iterator : public PackageContainerInterface::const_iterator,
192
197
iterator(typename Container::iterator i) : _iter(i) {}
193
198
pkgCache::PkgIterator getPkg(void) const { return *_iter; }
194
inline pkgCache::PkgIterator operator*(void) const { return *_iter; };
199
inline pkgCache::PkgIterator operator*(void) const { return *_iter; }
195
200
operator typename Container::iterator(void) const { return _iter; }
196
201
operator typename PackageContainer<Container>::const_iterator() { return typename PackageContainer<Container>::const_iterator(_iter); }
197
202
inline iterator& operator++() { ++_iter; return *this; }
198
203
inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
199
inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
200
inline bool operator==(iterator const &i) const { return _iter == i._iter; };
201
inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; };
202
inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; };
204
inline bool operator!=(iterator const &i) const { return _iter != i._iter; }
205
inline bool operator==(iterator const &i) const { return _iter == i._iter; }
206
inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }
207
inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }
203
208
friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); }
207
bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; };
208
template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); };
209
void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); };
212
bool insert(pkgCache::PkgIterator const &P) { if (P.end() == true) return false; _cont.insert(P); return true; }
213
template<class Cont> void insert(PackageContainer<Cont> const &pkgcont) { _cont.insert((typename Cont::const_iterator)pkgcont.begin(), (typename Cont::const_iterator)pkgcont.end()); }
214
void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
211
bool empty() const { return _cont.empty(); };
212
void clear() { return _cont.clear(); };
216
bool empty() const { return _cont.empty(); }
217
void clear() { return _cont.clear(); }
213
218
//FIXME: on ABI break, replace the first with the second without bool
214
void erase(iterator position) { _cont.erase((typename Container::iterator)position); };
215
iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); };
216
size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); };
217
void erase(iterator first, iterator last) { _cont.erase(first, last); };
218
size_t size() const { return _cont.size(); };
220
const_iterator begin() const { return const_iterator(_cont.begin()); };
221
const_iterator end() const { return const_iterator(_cont.end()); };
222
iterator begin() { return iterator(_cont.begin()); };
223
iterator end() { return iterator(_cont.end()); };
224
const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); };
226
void setConstructor(Constructor const &by) { ConstructedBy = by; };
227
Constructor getConstructor() const { return ConstructedBy; };
229
PackageContainer() : ConstructedBy(UNKNOWN) {};
230
PackageContainer(Constructor const &by) : ConstructedBy(by) {};
219
void erase(iterator position) { _cont.erase((typename Container::iterator)position); }
220
iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }
221
size_t erase(const pkgCache::PkgIterator x) { return _cont.erase(x); }
222
void erase(iterator first, iterator last) { _cont.erase(first, last); }
223
size_t size() const { return _cont.size(); }
225
const_iterator begin() const { return const_iterator(_cont.begin()); }
226
const_iterator end() const { return const_iterator(_cont.end()); }
227
iterator begin() { return iterator(_cont.begin()); }
228
iterator end() { return iterator(_cont.end()); }
229
const_iterator find(pkgCache::PkgIterator const &P) const { return const_iterator(_cont.find(P)); }
231
void setConstructor(Constructor const &by) { ConstructedBy = by; }
232
Constructor getConstructor() const { return ConstructedBy; }
234
PackageContainer() : ConstructedBy(UNKNOWN) {}
235
PackageContainer(Constructor const &by) : ConstructedBy(by) {}
232
237
/** \brief returns all packages in the cache who belong to the given task
392
397
virtual pkgCache::VerIterator getVer() const = 0;
393
398
operator pkgCache::VerIterator(void) { return getVer(); }
395
inline pkgCache *Cache() const { return getVer().Cache(); };
396
inline unsigned long Index() const {return getVer().Index();};
397
inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); };
398
inline const char *VerStr() const { return getVer().VerStr(); };
399
inline const char *Section() const { return getVer().Section(); };
400
inline const char *Arch() const { return getVer().Arch(); };
401
inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); };
402
inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); };
403
inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); };
404
inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); };
405
inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); };
406
inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); };
407
inline bool Downloadable() const { return getVer().Downloadable(); };
408
inline const char *PriorityType() const { return getVer().PriorityType(); };
409
inline std::string RelStr() const { return getVer().RelStr(); };
410
inline bool Automatic() const { return getVer().Automatic(); };
411
inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); };
400
inline pkgCache *Cache() const { return getVer().Cache(); }
401
inline unsigned long Index() const {return getVer().Index();}
402
inline int CompareVer(const pkgCache::VerIterator &B) const { return getVer().CompareVer(B); }
403
inline const char *VerStr() const { return getVer().VerStr(); }
404
inline const char *Section() const { return getVer().Section(); }
405
inline const char *Arch() const { return getVer().Arch(); }
406
inline pkgCache::PkgIterator ParentPkg() const { return getVer().ParentPkg(); }
407
inline pkgCache::DescIterator DescriptionList() const { return getVer().DescriptionList(); }
408
inline pkgCache::DescIterator TranslatedDescription() const { return getVer().TranslatedDescription(); }
409
inline pkgCache::DepIterator DependsList() const { return getVer().DependsList(); }
410
inline pkgCache::PrvIterator ProvidesList() const { return getVer().ProvidesList(); }
411
inline pkgCache::VerFileIterator FileList() const { return getVer().FileList(); }
412
inline bool Downloadable() const { return getVer().Downloadable(); }
413
inline const char *PriorityType() const { return getVer().PriorityType(); }
414
inline std::string RelStr() const { return getVer().RelStr(); }
415
inline bool Automatic() const { return getVer().Automatic(); }
416
inline pkgCache::VerFileIterator NewestFile() const { return getVer().NewestFile(); }
412
417
// we have only valid iterators here
413
inline bool end() const { return false; };
418
inline bool end() const { return false; }
415
inline pkgCache::Version const * operator->() const { return &*getVer(); };
420
inline pkgCache::Version const * operator->() const { return &*getVer(); }
479
484
/** \brief returns the candidate version of the package
481
486
\param Cache to be used to query for information
482
\param Pkg we want the candidate version from this package */
487
\param Pkg we want the candidate version from this package
488
\param helper used in this container instance */
483
489
static pkgCache::VerIterator getCandidateVer(pkgCacheFile &Cache,
484
490
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
486
492
/** \brief returns the installed version of the package
488
494
\param Cache to be used to query for information
489
\param Pkg we want the installed version from this package */
495
\param Pkg we want the installed version from this package
496
\param helper used in this container instance */
490
497
static pkgCache::VerIterator getInstalledVer(pkgCacheFile &Cache,
491
498
pkgCache::PkgIterator const &Pkg, CacheSetHelper &helper);
508
515
const_iterator(typename Container::const_iterator i) : _iter(i) {}
509
516
pkgCache::VerIterator getVer(void) const { return *_iter; }
510
inline pkgCache::VerIterator operator*(void) const { return *_iter; };
517
inline pkgCache::VerIterator operator*(void) const { return *_iter; }
511
518
operator typename Container::const_iterator(void) const { return _iter; }
512
519
inline const_iterator& operator++() { ++_iter; return *this; }
513
520
inline const_iterator operator++(int) { const_iterator tmp(*this); operator++(); return tmp; }
514
inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; };
515
inline bool operator==(const_iterator const &i) const { return _iter == i._iter; };
521
inline bool operator!=(const_iterator const &i) const { return _iter != i._iter; }
522
inline bool operator==(const_iterator const &i) const { return _iter == i._iter; }
516
523
friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, *i); }
518
525
class iterator : public VersionContainerInterface::const_iterator,
522
529
iterator(typename Container::iterator i) : _iter(i) {}
523
530
pkgCache::VerIterator getVer(void) const { return *_iter; }
524
inline pkgCache::VerIterator operator*(void) const { return *_iter; };
531
inline pkgCache::VerIterator operator*(void) const { return *_iter; }
525
532
operator typename Container::iterator(void) const { return _iter; }
526
533
operator typename VersionContainer<Container>::const_iterator() { return typename VersionContainer<Container>::const_iterator(_iter); }
527
534
inline iterator& operator++() { ++_iter; return *this; }
528
535
inline iterator operator++(int) { iterator tmp(*this); operator++(); return tmp; }
529
inline bool operator!=(iterator const &i) const { return _iter != i._iter; };
530
inline bool operator==(iterator const &i) const { return _iter == i._iter; };
531
inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; };
532
inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; };
536
inline bool operator!=(iterator const &i) const { return _iter != i._iter; }
537
inline bool operator==(iterator const &i) const { return _iter == i._iter; }
538
inline iterator& operator=(iterator const &i) { _iter = i._iter; return *this; }
539
inline iterator& operator=(typename Container::iterator const &i) { _iter = i; return *this; }
533
540
friend std::ostream& operator<<(std::ostream& out, iterator i) { return operator<<(out, *i); }
537
bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; };
538
template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); };
539
void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); };
540
bool empty() const { return _cont.empty(); };
541
void clear() { return _cont.clear(); };
544
bool insert(pkgCache::VerIterator const &V) { if (V.end() == true) return false; _cont.insert(V); return true; }
545
template<class Cont> void insert(VersionContainer<Cont> const &vercont) { _cont.insert((typename Cont::const_iterator)vercont.begin(), (typename Cont::const_iterator)vercont.end()); }
546
void insert(const_iterator begin, const_iterator end) { _cont.insert(begin, end); }
547
bool empty() const { return _cont.empty(); }
548
void clear() { return _cont.clear(); }
542
549
//FIXME: on ABI break, replace the first with the second without bool
543
void erase(iterator position) { _cont.erase((typename Container::iterator)position); };
544
iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); };
545
size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); };
546
void erase(iterator first, iterator last) { _cont.erase(first, last); };
547
size_t size() const { return _cont.size(); };
550
void erase(iterator position) { _cont.erase((typename Container::iterator)position); }
551
iterator& erase(iterator &position, bool) { return position = _cont.erase((typename Container::iterator)position); }
552
size_t erase(const pkgCache::VerIterator x) { return _cont.erase(x); }
553
void erase(iterator first, iterator last) { _cont.erase(first, last); }
554
size_t size() const { return _cont.size(); }
549
const_iterator begin() const { return const_iterator(_cont.begin()); };
550
const_iterator end() const { return const_iterator(_cont.end()); };
551
iterator begin() { return iterator(_cont.begin()); };
552
iterator end() { return iterator(_cont.end()); };
553
const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); };
556
const_iterator begin() const { return const_iterator(_cont.begin()); }
557
const_iterator end() const { return const_iterator(_cont.end()); }
558
iterator begin() { return iterator(_cont.begin()); }
559
iterator end() { return iterator(_cont.end()); }
560
const_iterator find(pkgCache::VerIterator const &V) const { return const_iterator(_cont.find(V)); }
555
562
/** \brief returns all versions specified on the commandline