diff options
| author | Julian Andres Klode <julian.klode@canonical.com> | 2024-07-16 13:54:11 +0200 |
|---|---|---|
| committer | Julian Andres Klode <julian.klode@canonical.com> | 2024-07-16 13:55:07 +0200 |
| commit | 62573e3ca6b45b0d12b9be8b02da116ce0d91b75 (patch) | |
| tree | 3ee03fc2e484ed0d787d42c46d400bd5401c1ac3 /apt-pkg/solver3.h | |
| parent | a8367745eac915281cc2b9fb98813e9225d1e55c (diff) | |
solver3: Refactor Reason.Pkg()/Reason.Ver() use with iterator
More code but nicer to read
Diffstat (limited to 'apt-pkg/solver3.h')
| -rw-r--r-- | apt-pkg/solver3.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h index d460c95d9..96faaa605 100644 --- a/apt-pkg/solver3.h +++ b/apt-pkg/solver3.h @@ -219,6 +219,16 @@ struct APT::Solver::Reason { return IsVersion ? map_pointer<pkgCache::Version>{(uint32_t)MapPtr} : 0; } + // \brief Return the package iterator if storing a package, or an empty one + pkgCache::PkgIterator Pkg(pkgCache &cache) const + { + return IsVersion ? pkgCache::PkgIterator() : pkgCache::PkgIterator(cache, cache.PkgP + Pkg()); + } + // \brief Return the version iterator if storing a package, or an empty end. + pkgCache::VerIterator Ver(pkgCache &cache) const + { + return IsVersion ? pkgCache::VerIterator(cache, cache.VerP + Ver()) : pkgCache::VerIterator(); + } // \brief Check if there is no reason. bool empty() const { |
