summaryrefslogtreecommitdiff
path: root/apt-pkg/cacheiterators.h
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-01-17 12:53:20 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-01-17 12:53:20 +0100
commit8ebabf3d9026d1a738a4e8988e168902af7446e3 (patch)
treefd53dd025b002f418e45749d6cf1be3c20f2aa39 /apt-pkg/cacheiterators.h
parent25353dc6646e5b9fff55059a5c85183589cf472d (diff)
Allow querying all binaries built by a source package
This adds a simple way to lookup binaries by a source package, but this adds all binaries into one list, even with different source versions. Be careful.
Diffstat (limited to 'apt-pkg/cacheiterators.h')
-rw-r--r--apt-pkg/cacheiterators.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 5c3ad9bbb..ff2b65cdf 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -116,6 +116,7 @@ class pkgCache::GrpIterator: public Iterator<Group, GrpIterator> {
inline const char *Name() const {return S->Name == 0?0:Owner->StrP + S->Name;}
inline PkgIterator PackageList() const;
+ inline VerIterator VersionsInSource() const;
PkgIterator FindPkg(APT::StringView Arch = APT::StringView("any", 3)) const;
/** \brief find the package with the "best" architecture
@@ -193,6 +194,13 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
inline VerIterator& operator++() {if (S != Owner->VerP) S = Owner->VerP + S->NextVer; return *this;}
inline VerIterator operator++(int) { VerIterator const tmp(*this); operator++(); return tmp; }
+ inline VerIterator NextInSource()
+ {
+ if (S != Owner->VerP)
+ S = Owner->VerP + S->NextInSource;
+ return *this;
+ }
+
// Comparison
int CompareVer(const VerIterator &B) const;
/** \brief compares two version and returns if they are similar
@@ -494,6 +502,10 @@ class pkgCache::DescFileIterator : public Iterator<DescFile, DescFileIterator> {
// Inlined Begin functions can't be in the class because of order problems /*{{{*/
inline pkgCache::PkgIterator pkgCache::GrpIterator::PackageList() const
{return PkgIterator(*Owner,Owner->PkgP + S->FirstPackage);}
+ inline pkgCache::VerIterator pkgCache::GrpIterator::VersionsInSource() const
+ {
+ return VerIterator(*Owner, Owner->VerP + S->VersionsInSource);
+ }
inline pkgCache::VerIterator pkgCache::PkgIterator::VersionList() const
{return VerIterator(*Owner,Owner->VerP + S->VersionList);}
inline pkgCache::VerIterator pkgCache::PkgIterator::CurrentVer() const