squash merge of the feature/apt-binary branch without the changes from experimental
[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>
10
11#include <string>
12
13#include <regex.h>
14 /*}}}*/
15namespace APT {
16namespace CacheFilter {
b9179170
MV
17
18class 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
9ba5aa3b 27// PackageNameMatchesRegEx /*{{{*/
b9179170 28class PackageNameMatchesRegEx : public PackageMatcher {
be9b62f7
MV
29 /** \brief dpointer placeholder (for later in case we need it) */
30 void *d;
9ba5aa3b
DK
31 regex_t* pattern;
32public:
33 PackageNameMatchesRegEx(std::string const &Pattern);
b9179170
MV
34 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
35 virtual bool operator() (pkgCache::GrpIterator const &Grp);
9ba5aa3b
DK
36 ~PackageNameMatchesRegEx();
37};
38 /*}}}*/
b9179170
MV
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;
44public:
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 ~PackageNameMatchesFnmatch() {};
50};
51 /*}}}*/
424ff669
DK
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 */
b9179170 61class PackageArchitectureMatchesSpecification : public PackageMatcher {
424ff669
DK
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;
67public:
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);
b9179170
MV
77 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
78 virtual bool operator() (pkgCache::VerIterator const &Ver);
424ff669
DK
79 ~PackageArchitectureMatchesSpecification();
80};
81 /*}}}*/
9ba5aa3b
DK
82}
83}
84#endif