]> git.saurik.com Git - apt.git/blob - apt-pkg/cachefilter.h
Merge branch 'debian/sid' into debian/experimental
[apt.git] / apt-pkg / cachefilter.h
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /** \file cachefilter.h
4 Collection of functor classes */
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 class PackageMatcher {
19 public:
20 virtual bool operator() (pkgCache::PkgIterator const &Pkg) { return false; };
21 virtual bool operator() (pkgCache::GrpIterator const &Grp) { return false; };
22 virtual bool operator() (pkgCache::VerIterator const &Ver) { return false; };
23
24 virtual ~PackageMatcher() {};
25 };
26
27 // PackageNameMatchesRegEx /*{{{*/
28 class PackageNameMatchesRegEx : public PackageMatcher {
29 /** \brief dpointer placeholder (for later in case we need it) */
30 void *d;
31 regex_t* pattern;
32 public:
33 PackageNameMatchesRegEx(std::string const &Pattern);
34 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
35 virtual bool operator() (pkgCache::GrpIterator const &Grp);
36 virtual ~PackageNameMatchesRegEx();
37 };
38 /*}}}*/
39 // PackageNameMatchesFnmatch /*{{{*/
40 class PackageNameMatchesFnmatch : public PackageMatcher{
41 /** \brief dpointer placeholder (for later in case we need it) */
42 void *d;
43 const std::string Pattern;
44 public:
45 PackageNameMatchesFnmatch(std::string const &Pattern)
46 : Pattern(Pattern) {};
47 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
48 virtual bool operator() (pkgCache::GrpIterator const &Grp);
49 virtual ~PackageNameMatchesFnmatch() {};
50 };
51 /*}}}*/
52 // PackageArchitectureMatchesSpecification /*{{{*/
53 /** \class PackageArchitectureMatchesSpecification
54 \brief matching against architecture specification strings
55
56 The strings are of the format <kernel>-<cpu> where either component,
57 or the whole string, can be the wildcard "any" as defined in
58 debian-policy ยง11.1 "Architecture specification strings".
59
60 Examples: i386, mipsel, linux-any, any-amd64, any */
61 class PackageArchitectureMatchesSpecification : public PackageMatcher {
62 std::string literal;
63 std::string complete;
64 bool isPattern;
65 /** \brief dpointer placeholder (for later in case we need it) */
66 void *d;
67 public:
68 /** \brief matching against architecture specification strings
69 *
70 * @param pattern is the architecture specification string
71 * @param isPattern defines if the given \b pattern is a
72 * architecture specification pattern to match others against
73 * or if it is the fixed string and matched against patterns
74 */
75 PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
76 bool operator() (char const * const &arch);
77 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
78 virtual bool operator() (pkgCache::VerIterator const &Ver);
79 virtual ~PackageArchitectureMatchesSpecification();
80 };
81 /*}}}*/
82 }
83 }
84 #endif