From c37f3bb687fdd76e173d4e770ec2ef49e93ef852 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 22 Sep 2008 14:56:35 +0200 Subject: * apt-pkg/cacheiterators.h: - add missing checks for Owner == 0 in end() --- apt-pkg/cacheiterators.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apt-pkg/cacheiterators.h') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 08eafca0f..bbbcb7753 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -104,7 +104,7 @@ class pkgCache::VerIterator // Iteration void operator ++(int) {if (Ver != Owner->VerP) Ver = Owner->VerP + Ver->NextVer;}; inline void operator ++() {operator ++(0);}; - inline bool end() const {return Owner == NULL || (Ver == Owner->VerP?true:false);}; + inline bool end() const {return Owner == 0 || (Ver == Owner->VerP?true:false);}; inline void operator =(const VerIterator &B) {Ver = B.Ver; Owner = B.Owner;}; // Comparison @@ -160,7 +160,7 @@ class pkgCache::DescIterator // Iteration void operator ++(int) {if (Desc != Owner->DescP) Desc = Owner->DescP + Desc->NextDesc;}; inline void operator ++() {operator ++(0);}; - inline bool end() const {return Desc == Owner->DescP?true:false;}; + inline bool end() const {return Owner == 0 || Desc == Owner->DescP?true:false;}; inline void operator =(const DescIterator &B) {Desc = B.Desc; Owner = B.Owner;}; // Comparison @@ -314,7 +314,7 @@ class pkgCache::PkgFileIterator // Iteration void operator ++(int) {if (File!= Owner->PkgFileP) File = Owner->PkgFileP + File->NextFile;}; inline void operator ++() {operator ++(0);}; - inline bool end() const {return File == Owner->PkgFileP?true:false;}; + inline bool end() const {return Owner == 0 || File == Owner->PkgFileP?true:false;}; // Comparison inline bool operator ==(const PkgFileIterator &B) const {return File == B.File;}; @@ -360,7 +360,7 @@ class pkgCache::VerFileIterator // Iteration void operator ++(int) {if (FileP != Owner->VerFileP) FileP = Owner->VerFileP + FileP->NextFile;}; inline void operator ++() {operator ++(0);}; - inline bool end() const {return FileP == Owner->VerFileP?true:false;}; + inline bool end() const {return Owner == 0 || FileP == Owner->VerFileP?true:false;}; // Comparison inline bool operator ==(const VerFileIterator &B) const {return FileP == B.FileP;}; @@ -392,7 +392,7 @@ class pkgCache::DescFileIterator // Iteration void operator ++(int) {if (FileP != Owner->DescFileP) FileP = Owner->DescFileP + FileP->NextFile;}; inline void operator ++() {operator ++(0);}; - inline bool end() const {return FileP == Owner->DescFileP?true:false;}; + inline bool end() const {return Owner == 0 || FileP == Owner->DescFileP?true:false;}; // Comparison inline bool operator ==(const DescFileIterator &B) const {return FileP == B.FileP;}; -- cgit v1.2.3 From efc487fbd46905f5f3efc4f31d7df15625bcbecf Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 7 May 2009 12:04:21 +0200 Subject: [apt-pkg] allow also codenames for specifying a release * MatchType::Release checks first for archive than for codename equality * new n= option in apt_preference to be able to pin based on a codeName --- apt-pkg/cacheiterators.h | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg/cacheiterators.h') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 08eafca0f..63f9de8fc 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -333,6 +333,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;}; -- cgit v1.2.3 From af29ffb44d95dfb0f7b0c1835e2e501313f74723 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 29 Jun 2009 18:00:54 +0200 Subject: * add depth information to the debug output and show what depends type triggers a autoinst (closes: #458389) * add debug::pkgDepCache::Marker with more detailed debug output (closes: #87520) --- apt-pkg/cacheiterators.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'apt-pkg/cacheiterators.h') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 63f9de8fc..cf79b3a6b 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -80,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) @@ -111,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;}; -- cgit v1.2.3 From 92fcbfc16396d9a2fbde0edb0902d4ebe7ff0090 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 30 Jun 2009 21:37:30 +0200 Subject: add the various foldmarkers in apt-pkg & cmdline (no code change) --- apt-pkg/cacheiterators.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'apt-pkg/cacheiterators.h') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index cf79b3a6b..3d35e4298 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -32,7 +32,7 @@ #define PKGLIB_CACHEITERATORS_H -// Package Iterator +// Package Iterator /*{{{*/ class pkgCache::PkgIterator { friend class pkgCache; @@ -96,8 +96,8 @@ class pkgCache::PkgIterator }; inline PkgIterator() : Pkg(0), Owner(0), HashIndex(0) {}; }; - -// Version Iterator + /*}}}*/ +// Version Iterator /*{{{*/ class pkgCache::VerIterator { Version *Ver; @@ -155,8 +155,8 @@ class pkgCache::VerIterator Ver = Owner.VerP; }; }; - -// Description Iterator + /*}}}*/ +// Description Iterator /*{{{*/ class pkgCache::DescIterator { Description *Desc; @@ -199,8 +199,8 @@ class pkgCache::DescIterator Desc = Owner.DescP; }; }; - -// Dependency iterator + /*}}}*/ +// Dependency iterator /*{{{*/ class pkgCache::DepIterator { Dependency *Dep; @@ -258,8 +258,8 @@ class pkgCache::DepIterator }; inline DepIterator() : Dep(0), Type(DepVer), Owner(0) {}; }; - -// Provides iterator + /*}}}*/ +// Provides iterator /*{{{*/ class pkgCache::PrvIterator { Provides *Prv; @@ -311,8 +311,8 @@ class pkgCache::PrvIterator Prv = Owner.ProvideP; }; }; - -// Package file + /*}}}*/ +// Package file /*{{{*/ class pkgCache::PkgFileIterator { pkgCache *Owner; @@ -358,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; @@ -390,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; @@ -422,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 @@ -442,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 -- cgit v1.2.3