diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-06-16 17:19:21 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-06-16 17:19:21 +0200 |
commit | 8ceeb9d695f7c8fc5d856aa4f8647e88c4a8659f (patch) | |
tree | 16f9cb31725794f592af5e9bb18acf98863a7dd6 /apt-pkg | |
parent | d8276801a1c84582a85ed9ea1f2eb4e66e052e6b (diff) |
add a simple method to VerIterator to check if two Versions are similar
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/cacheiterators.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index f0b40dbb5..51bf6819e 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -30,6 +30,8 @@ #ifndef PKGLIB_CACHEITERATORS_H #define PKGLIB_CACHEITERATORS_H #include<iterator> + +#include<string.h> // abstract Iterator template /*{{{*/ /* This template provides the very basic iterator methods we need to have for doing some walk-over-the-cache magic */ @@ -183,6 +185,13 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> { // Comparison int CompareVer(const VerIterator &B) const; + /** \brief compares two version and returns if they are similar + + This method should be used to identify if two pseudo versions are + refering to the same "real" version */ + inline bool SimilarVer(const VerIterator &B) const { + return (B.end() == false && S->Hash == B->Hash && strcmp(VerStr(), B.VerStr()) == 0); + }; // Accessors inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}; |