X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/b790b130ad0a43be5738c467c16bbc2dd657ca66..ef1dff93202fa61e0b8cda761906bbca31e217bc:/apt-pkg/cacheiterators.h diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index d5a9c7b0d..3d35e4298 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -31,11 +31,8 @@ #ifndef PKGLIB_CACHEITERATORS_H #define PKGLIB_CACHEITERATORS_H -#ifdef __GNUG__ -#pragma interface "apt-pkg/cacheiterators.h" -#endif -// Package Iterator +// Package Iterator /*{{{*/ class pkgCache::PkgIterator { friend class pkgCache; @@ -83,7 +80,13 @@ class pkgCache::PkgIterator inline PrvIterator ProvidesList() const; inline unsigned long Index() const {return Pkg - Owner->PkgP;}; OkState State() const; - + + //Nice printable representation + friend std::ostream& operator<<(std::ostream& out, pkgCache::PkgIterator Pkg); + + const char *CandVersion() const; + const char *CurVersion() const; + // Constructors inline PkgIterator(pkgCache &Owner,Package *Trg) : Pkg(Trg), Owner(&Owner), HashIndex(0) @@ -93,8 +96,8 @@ class pkgCache::PkgIterator }; inline PkgIterator() : Pkg(0), Owner(0), HashIndex(0) {}; }; - -// Version Iterator + /*}}}*/ +// Version Iterator /*{{{*/ class pkgCache::VerIterator { Version *Ver; @@ -114,7 +117,10 @@ class pkgCache::VerIterator inline bool operator ==(const VerIterator &B) const {return Ver == B.Ver;}; inline bool operator !=(const VerIterator &B) const {return Ver != B.Ver;}; int CompareVer(const VerIterator &B) const; - + + // Testing + inline bool IsGood() const { return Ver && Owner && ! end();}; + // Accessors inline Version *operator ->() {return Ver;}; inline Version const *operator ->() const {return Ver;}; @@ -149,8 +155,8 @@ class pkgCache::VerIterator Ver = Owner.VerP; }; }; - -// Description Iterator + /*}}}*/ +// Description Iterator /*{{{*/ class pkgCache::DescIterator { Description *Desc; @@ -193,8 +199,8 @@ class pkgCache::DescIterator Desc = Owner.DescP; }; }; - -// Dependency iterator + /*}}}*/ +// Dependency iterator /*{{{*/ class pkgCache::DepIterator { Dependency *Dep; @@ -252,8 +258,8 @@ class pkgCache::DepIterator }; inline DepIterator() : Dep(0), Type(DepVer), Owner(0) {}; }; - -// Provides iterator + /*}}}*/ +// Provides iterator /*{{{*/ class pkgCache::PrvIterator { Provides *Prv; @@ -305,8 +311,8 @@ class pkgCache::PrvIterator Prv = Owner.ProvideP; }; }; - -// Package file + /*}}}*/ +// Package file /*{{{*/ class pkgCache::PkgFileIterator { pkgCache *Owner; @@ -336,6 +342,7 @@ class pkgCache::PkgFileIterator inline const char *Component() const {return File->Component == 0?0:Owner->StrP + File->Component;}; inline const char *Version() const {return File->Version == 0?0:Owner->StrP + File->Version;}; inline const char *Origin() const {return File->Origin == 0?0:Owner->StrP + File->Origin;}; + inline const char *Codename() const {return File->Codename ==0?0:Owner->StrP + File->Codename;}; inline const char *Label() const {return File->Label == 0?0:Owner->StrP + File->Label;}; inline const char *Site() const {return File->Site == 0?0:Owner->StrP + File->Site;}; inline const char *Architecture() const {return File->Architecture == 0?0:Owner->StrP + File->Architecture;}; @@ -351,8 +358,8 @@ class pkgCache::PkgFileIterator inline PkgFileIterator(pkgCache &Owner) : Owner(&Owner), File(Owner.PkgFileP) {}; inline PkgFileIterator(pkgCache &Owner,PackageFile *Trg) : Owner(&Owner), File(Trg) {}; }; - -// Version File + /*}}}*/ +// Version File /*{{{*/ class pkgCache::VerFileIterator { pkgCache *Owner; @@ -383,8 +390,8 @@ class pkgCache::VerFileIterator inline VerFileIterator() : Owner(0), FileP(0) {}; inline VerFileIterator(pkgCache &Owner,VerFile *Trg) : Owner(&Owner), FileP(Trg) {}; }; - -// Description File + /*}}}*/ +// Description File /*{{{*/ class pkgCache::DescFileIterator { pkgCache *Owner; @@ -415,8 +422,8 @@ class pkgCache::DescFileIterator inline DescFileIterator() : Owner(0), FileP(0) {}; inline DescFileIterator(pkgCache &Owner,DescFile *Trg) : Owner(&Owner), FileP(Trg) {}; }; - -// Inlined Begin functions cant be in the class because of order problems + /*}}}*/ +// Inlined Begin functions cant be in the class because of order problems /*{{{*/ inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const {return VerIterator(*Owner,Owner->VerP + Pkg->VersionList);}; inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const @@ -435,5 +442,5 @@ inline pkgCache::VerFileIterator pkgCache::VerIterator::FileList() const {return VerFileIterator(*Owner,Owner->VerFileP + Ver->FileList);}; inline pkgCache::DescFileIterator pkgCache::DescIterator::FileList() const {return DescFileIterator(*Owner,Owner->DescFileP + Desc->FileList);}; - + /*}}}*/ #endif