]>
Commit | Line | Data |
---|---|---|
e1dbde8d DK |
1 | // -*- mode: cpp; mode: fold -*- |
2 | // Description /*{{{*/ | |
3 | /** \class APT::PackageSet | |
4 | ||
5 | Simple wrapper around a std::set to provide a similar interface to | |
6 | a set of packages as to the complete set of all packages in the | |
7 | pkgCache. | |
8 | */ | |
9 | /*}}}*/ | |
10 | #ifndef APT_PACKAGESET_H | |
11 | #define APT_PACKAGESET_H | |
12 | // Include Files /*{{{*/ | |
13 | #include <string> | |
14 | #include <apt-pkg/pkgcache.h> | |
15 | /*}}}*/ | |
16 | namespace APT { | |
17 | class PackageSet : public std::set<pkgCache::PkgIterator> { /*{{{*/ | |
18 | public: /*{{{*/ | |
19 | /** \brief smell like a pkgCache::PkgIterator */ | |
20 | class const_iterator : public std::set<pkgCache::PkgIterator>::const_iterator { | |
21 | public: | |
22 | const_iterator(std::set<pkgCache::PkgIterator>::const_iterator x) : | |
23 | std::set<pkgCache::PkgIterator>::const_iterator(x) {} | |
24 | ||
25 | inline const char *Name() const {return (*this)->Name(); } | |
26 | inline std::string FullName(bool const &Pretty) const { return (*this)->FullName(Pretty); } | |
27 | inline std::string FullName() const { return (*this)->FullName(); } | |
28 | inline const char *Section() const {return (*this)->Section(); } | |
29 | inline bool Purge() const {return (*this)->Purge(); } | |
30 | inline const char *Arch() const {return (*this)->Arch(); } | |
31 | inline pkgCache::GrpIterator Group() const { return (*this)->Group(); } | |
32 | inline pkgCache::VerIterator VersionList() const { return (*this)->VersionList(); } | |
33 | inline pkgCache::VerIterator CurrentVer() const { return (*this)->CurrentVer(); } | |
34 | inline pkgCache::DepIterator RevDependsList() const { return (*this)->RevDependsList(); } | |
35 | inline pkgCache::PrvIterator ProvidesList() const { return (*this)->ProvidesList(); } | |
36 | inline pkgCache::PkgIterator::OkState State() const { return (*this)->State(); } | |
37 | inline const char *CandVersion() const { return (*this)->CandVersion(); } | |
38 | inline const char *CurVersion() const { return (*this)->CurVersion(); } | |
39 | inline pkgCache *Cache() {return (*this)->Cache();}; | |
40 | ||
41 | friend std::ostream& operator<<(std::ostream& out, const_iterator i) { return operator<<(out, (*i)); } | |
42 | ||
43 | inline pkgCache::PkgIterator const * operator->() const { | |
44 | return &**this; | |
45 | }; | |
46 | }; | |
47 | // 103. set::iterator is required to be modifiable, but this allows modification of keys | |
48 | typedef typename APT::PackageSet::const_iterator iterator; | |
49 | /*}}}*/ | |
50 | }; | |
51 | /*}}}*/ | |
52 | } | |
53 | #endif |