diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-10-30 16:34:25 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-11-04 18:04:05 +0100 |
commit | 294a80209a0c6ea617a14fb2ae650d4fd329eab5 (patch) | |
tree | 6430408a0b5ceaae3bb862fb144c265adb116b46 /apt-pkg/depcache.h | |
parent | 51818f26c784bb574dafc545e8ae320845e5e8fc (diff) |
sanify API to get 'the' candidate version
This was discussed a while ago on #debian-apt and now that I see myself
making this mistake lets bite the bullet and fix it in the easy way out
version: Using a new name which fits with a similar named setter and
deprecate the old method instead of 'hostily' changing API.
Closes: #803471
Diffstat (limited to 'apt-pkg/depcache.h')
-rw-r--r-- | apt-pkg/depcache.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index ba997c8a6..a1be56bb2 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -360,9 +360,10 @@ class pkgDepCache : protected pkgCache::Namespace inline pkgCache &GetCache() {return *Cache;}; inline pkgVersioningSystem &VS() {return *Cache->VS;}; - + // Policy implementation - inline VerIterator GetCandidateVer(PkgIterator const &Pkg) {return LocalPolicy->GetCandidateVer(Pkg);}; + APT_DEPRECATED inline VerIterator GetCandidateVer(PkgIterator const &Pkg) {return /* GetCandidateVersion(Pkg); but for API compat: */ LocalPolicy->GetCandidateVer(Pkg);}; + inline bool IsImportantDep(DepIterator Dep) const {return LocalPolicy->IsImportantDep(Dep);}; inline Policy &GetPolicy() {return *LocalPolicy;}; @@ -413,6 +414,16 @@ class pkgDepCache : protected pkgCache::Namespace void MarkProtected(PkgIterator const &Pkg) { PkgState[Pkg->ID].iFlags |= Protected; }; void SetReInstall(PkgIterator const &Pkg,bool To); + + /** @return 'the' candidate version of a package + * + * The version returned is the version previously set explicitly via + * SetCandidate* methods like #SetCandidateVersion or if there wasn't one + * set the version as choosen via #Policy. + * + * @param Pkg is the package to return the candidate for + */ + pkgCache::VerIterator GetCandidateVersion(pkgCache::PkgIterator const &Pkg); void SetCandidateVersion(VerIterator TargetVer); bool SetCandidateRelease(pkgCache::VerIterator TargetVer, std::string const &TargetRel); |