apt  0.9.12.1
cachefilter.h
Go to the documentation of this file.
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
5  /*}}}*/
6 #ifndef APT_CACHEFILTER_H
7 #define APT_CACHEFILTER_H
8 // Include Files /*{{{*/
9 #include <apt-pkg/pkgcache.h>
10 
11 #include <string>
12 
13 #include <regex.h>
14  /*}}}*/
15 namespace APT {
16 namespace CacheFilter {
17 
18 #define PACKAGE_MATCHER_ABI_COMPAT 1
19 #ifdef PACKAGE_MATCHER_ABI_COMPAT
20 
21 // PackageNameMatchesRegEx /*{{{*/
24  void *d;
25  regex_t* pattern;
26 public:
27  PackageNameMatchesRegEx(std::string const &Pattern);
28  bool operator() (pkgCache::PkgIterator const &Pkg);
29  bool operator() (pkgCache::GrpIterator const &Grp);
31 };
32  /*}}}*/
33 // PackageNameMatchesFnmatch /*{{{*/
36  void *d;
37  const std::string Pattern;
38 public:
39  PackageNameMatchesFnmatch(std::string const &Pattern)
40  : Pattern(Pattern) {};
41  bool operator() (pkgCache::PkgIterator const &Pkg);
42  bool operator() (pkgCache::GrpIterator const &Grp);
44 };
45  /*}}}*/
46 // PackageArchitectureMatchesSpecification /*{{{*/
56  std::string literal;
57  std::string complete;
58  bool isPattern;
60  void *d;
61 public:
69  PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
70  bool operator() (char const * const &arch);
71  bool operator() (pkgCache::PkgIterator const &Pkg);
72  bool operator() (pkgCache::VerIterator const &Ver);
74 };
75 
76 #else
77 
78 class PackageMatcher {
79  public:
80  virtual bool operator() (pkgCache::PkgIterator const &Pkg) { return false; };
81  virtual bool operator() (pkgCache::GrpIterator const &Grp) { return false; };
82  virtual bool operator() (pkgCache::VerIterator const &Ver) { return false; };
83 
84  virtual ~PackageMatcher() {};
85 };
86 
87 // PackageNameMatchesRegEx /*{{{*/
88 class PackageNameMatchesRegEx : public PackageMatcher {
90  void *d;
91  regex_t* pattern;
92 public:
93  PackageNameMatchesRegEx(std::string const &Pattern);
94  virtual bool operator() (pkgCache::PkgIterator const &Pkg);
95  virtual bool operator() (pkgCache::GrpIterator const &Grp);
96  virtual ~PackageNameMatchesRegEx();
97 };
98  /*}}}*/
99 // PackageNameMatchesFnmatch /*{{{*/
100  class PackageNameMatchesFnmatch : public PackageMatcher{
102  void *d;
103  const std::string Pattern;
104 public:
105  PackageNameMatchesFnmatch(std::string const &Pattern)
106  : Pattern(Pattern) {};
107  virtual bool operator() (pkgCache::PkgIterator const &Pkg);
108  virtual bool operator() (pkgCache::GrpIterator const &Grp);
109  virtual ~PackageNameMatchesFnmatch() {};
110 };
111  /*}}}*/
112 // PackageArchitectureMatchesSpecification /*{{{*/
121 class PackageArchitectureMatchesSpecification : public PackageMatcher {
122  std::string literal;
123  std::string complete;
124  bool isPattern;
126  void *d;
127 public:
135  PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
136  bool operator() (char const * const &arch);
137  virtual bool operator() (pkgCache::PkgIterator const &Pkg);
138  virtual bool operator() (pkgCache::VerIterator const &Ver);
140 };
141 #endif
142  /*}}}*/
143 }
144 }
145 #endif
Definition: cacheiterators.h:136
PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern=true)
matching against architecture specification strings
Definition: cachefilter.cc:84
Definition: cacheiterators.h:95
pkgCache - Structure definitions for the cache file
Definition: cachefilter.h:22
Definition: cacheiterators.h:185
matching against architecture specification strings
Definition: cachefilter.h:55