summaryrefslogtreecommitdiff
path: root/apt-pkg/cachefilter-patterns.h
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2019-08-21 22:13:27 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2019-11-25 11:32:19 +0100
commit8428114608627fe0a08dcf1589931f6db025f0b4 (patch)
treeef9b08a5ead347d47418046001f5f7d2b4aa09f3 /apt-pkg/cachefilter-patterns.h
parent887b07aa284af75516fbf54e3db88acbf7e51b0c (diff)
patterns: Add ?version
Diffstat (limited to 'apt-pkg/cachefilter-patterns.h')
-rw-r--r--apt-pkg/cachefilter-patterns.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h
index f13edbbc2..4959b0f14 100644
--- a/apt-pkg/cachefilter-patterns.h
+++ b/apt-pkg/cachefilter-patterns.h
@@ -244,6 +244,31 @@ struct PackageIsVirtual : public PackageMatcher
return Pkg->VersionList == 0;
}
};
+
+struct VersionAnyMatcher : public Matcher
+{
+ bool operator()(pkgCache::GrpIterator const &Grp) override { return false; }
+ bool operator()(pkgCache::VerIterator const &Ver) override = 0;
+ bool operator()(pkgCache::PkgIterator const &Pkg) override
+ {
+ for (auto Ver = Pkg.VersionList(); not Ver.end(); Ver++)
+ {
+ if ((*this)(Ver))
+ return true;
+ }
+ return false;
+ }
+};
+
+struct VersionIsVersion : public VersionAnyMatcher
+{
+ BaseRegexMatcher matcher;
+ VersionIsVersion(std::string const &pattern) : matcher(pattern) {}
+ bool operator()(pkgCache::VerIterator const &Ver) override
+ {
+ return matcher(Ver.VerStr());
+ }
+};
} // namespace Patterns
} // namespace Internal
} // namespace APT