]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/cachefilter.cc
rework cachesets API to allow future extension
[apt.git] / apt-pkg / cachefilter.cc
index 64cde41d18526a468a4b85ef011a18f17af77a3c..e388f2450cfa0f665ea44b34a3dd9b6f9e06d86d 100644 (file)
@@ -9,10 +9,12 @@
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
 #include <apt-pkg/strutl.h>
+#include <apt-pkg/macros.h>
 
 #include <string>
-
+#include <string.h>
 #include <regex.h>
 #include <fnmatch.h>
 
@@ -55,6 +57,17 @@ PackageNameMatchesRegEx::~PackageNameMatchesRegEx() {                        /*{{{*/
 }
                                                                        /*}}}*/
 
+// Fnmatch support                                     /*{{{*/
+//----------------------------------------------------------------------
+bool PackageNameMatchesFnmatch::operator() (pkgCache::PkgIterator const &Pkg) {/*{{{*/
+   return fnmatch(Pattern.c_str(), Pkg.Name(), FNM_CASEFOLD) == 0;
+}
+                                                                       /*}}}*/
+bool PackageNameMatchesFnmatch::operator() (pkgCache::GrpIterator const &Grp) {/*{{{*/
+   return fnmatch(Pattern.c_str(), Grp.Name(), FNM_CASEFOLD) == 0;
+}
+                                                                       /*}}}*/
+
 // CompleteArch to <kernel>-<cpu> tuple                                        /*{{{*/
 //----------------------------------------------------------------------
 /* The complete architecture, consisting of <kernel>-<cpu>. */