apt-key del: Ignore case when checking if a keyid exists in a keyring.
[ntk/apt.git] / apt-pkg / cachefilter.h
CommitLineData
9ba5aa3b
DK
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>
453b82a3 10#include <apt-pkg/cacheiterators.h>
9ba5aa3b
DK
11
12#include <string>
13
14#include <regex.h>
15 /*}}}*/
16namespace APT {
17namespace CacheFilter {
b9179170 18
dd4d9729
MV
19#define PACKAGE_MATCHER_ABI_COMPAT 1
20#ifdef PACKAGE_MATCHER_ABI_COMPAT
21
22// PackageNameMatchesRegEx /*{{{*/
23class PackageNameMatchesRegEx {
24 /** \brief dpointer placeholder (for later in case we need it) */
25 void *d;
26 regex_t* pattern;
27public:
28 PackageNameMatchesRegEx(std::string const &Pattern);
29 bool operator() (pkgCache::PkgIterator const &Pkg);
30 bool operator() (pkgCache::GrpIterator const &Grp);
31 ~PackageNameMatchesRegEx();
32};
33 /*}}}*/
34// PackageNameMatchesFnmatch /*{{{*/
35 class PackageNameMatchesFnmatch {
36 /** \brief dpointer placeholder (for later in case we need it) */
37 void *d;
38 const std::string Pattern;
39public:
40 PackageNameMatchesFnmatch(std::string const &Pattern)
41 : Pattern(Pattern) {};
42 bool operator() (pkgCache::PkgIterator const &Pkg);
43 bool operator() (pkgCache::GrpIterator const &Grp);
44 ~PackageNameMatchesFnmatch() {};
45};
46 /*}}}*/
47// PackageArchitectureMatchesSpecification /*{{{*/
48/** \class PackageArchitectureMatchesSpecification
49 \brief matching against architecture specification strings
50
255c9e4b 51 The strings are of the format \<kernel\>-\<cpu\> where either component,
dd4d9729
MV
52 or the whole string, can be the wildcard "any" as defined in
53 debian-policy §11.1 "Architecture specification strings".
54
55 Examples: i386, mipsel, linux-any, any-amd64, any */
56class PackageArchitectureMatchesSpecification {
57 std::string literal;
58 std::string complete;
59 bool isPattern;
60 /** \brief dpointer placeholder (for later in case we need it) */
61 void *d;
62public:
63 /** \brief matching against architecture specification strings
64 *
65 * @param pattern is the architecture specification string
66 * @param isPattern defines if the given \b pattern is a
67 * architecture specification pattern to match others against
68 * or if it is the fixed string and matched against patterns
69 */
70 PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
71 bool operator() (char const * const &arch);
72 bool operator() (pkgCache::PkgIterator const &Pkg);
73 bool operator() (pkgCache::VerIterator const &Ver);
74 ~PackageArchitectureMatchesSpecification();
75};
25594bb5 76 /*}}}*/
dd4d9729
MV
77
78#else
79
b9179170
MV
80class PackageMatcher {
81 public:
82 virtual bool operator() (pkgCache::PkgIterator const &Pkg) { return false; };
83 virtual bool operator() (pkgCache::GrpIterator const &Grp) { return false; };
84 virtual bool operator() (pkgCache::VerIterator const &Ver) { return false; };
85
86 virtual ~PackageMatcher() {};
87};
88
9ba5aa3b 89// PackageNameMatchesRegEx /*{{{*/
b9179170 90class PackageNameMatchesRegEx : public PackageMatcher {
be9b62f7
MV
91 /** \brief dpointer placeholder (for later in case we need it) */
92 void *d;
9ba5aa3b
DK
93 regex_t* pattern;
94public:
95 PackageNameMatchesRegEx(std::string const &Pattern);
b9179170
MV
96 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
97 virtual bool operator() (pkgCache::GrpIterator const &Grp);
314a3f88 98 virtual ~PackageNameMatchesRegEx();
9ba5aa3b
DK
99};
100 /*}}}*/
b9179170 101// PackageNameMatchesFnmatch /*{{{*/
dd4d9729 102 class PackageNameMatchesFnmatch : public PackageMatcher{
b9179170
MV
103 /** \brief dpointer placeholder (for later in case we need it) */
104 void *d;
105 const std::string Pattern;
106public:
107 PackageNameMatchesFnmatch(std::string const &Pattern)
108 : Pattern(Pattern) {};
109 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
110 virtual bool operator() (pkgCache::GrpIterator const &Grp);
314a3f88 111 virtual ~PackageNameMatchesFnmatch() {};
b9179170
MV
112};
113 /*}}}*/
424ff669
DK
114// PackageArchitectureMatchesSpecification /*{{{*/
115/** \class PackageArchitectureMatchesSpecification
116 \brief matching against architecture specification strings
117
118 The strings are of the format <kernel>-<cpu> where either component,
119 or the whole string, can be the wildcard "any" as defined in
120 debian-policy §11.1 "Architecture specification strings".
121
122 Examples: i386, mipsel, linux-any, any-amd64, any */
b9179170 123class PackageArchitectureMatchesSpecification : public PackageMatcher {
424ff669
DK
124 std::string literal;
125 std::string complete;
126 bool isPattern;
127 /** \brief dpointer placeholder (for later in case we need it) */
128 void *d;
129public:
130 /** \brief matching against architecture specification strings
131 *
132 * @param pattern is the architecture specification string
133 * @param isPattern defines if the given \b pattern is a
134 * architecture specification pattern to match others against
135 * or if it is the fixed string and matched against patterns
136 */
137 PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
138 bool operator() (char const * const &arch);
b9179170
MV
139 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
140 virtual bool operator() (pkgCache::VerIterator const &Ver);
314a3f88 141 virtual ~PackageArchitectureMatchesSpecification();
424ff669 142};
dd4d9729 143#endif
424ff669 144 /*}}}*/
9ba5aa3b
DK
145}
146}
147#endif