remove the Section member from package struct
[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
MV
18
19class PackageMatcher {
20 public:
38d2959f
MV
21 virtual bool operator() (pkgCache::PkgIterator const &/*Pkg*/) {
22 return false; };
23 virtual bool operator() (pkgCache::GrpIterator const &/*Grp*/) {
24 return false; };
25 virtual bool operator() (pkgCache::VerIterator const &/*Ver*/) {
26 return false; };
b9179170
MV
27
28 virtual ~PackageMatcher() {};
29};
30
9ba5aa3b 31// PackageNameMatchesRegEx /*{{{*/
b9179170 32class PackageNameMatchesRegEx : public PackageMatcher {
be9b62f7
MV
33 /** \brief dpointer placeholder (for later in case we need it) */
34 void *d;
9ba5aa3b
DK
35 regex_t* pattern;
36public:
37 PackageNameMatchesRegEx(std::string const &Pattern);
b9179170
MV
38 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
39 virtual bool operator() (pkgCache::GrpIterator const &Grp);
314a3f88 40 virtual ~PackageNameMatchesRegEx();
9ba5aa3b
DK
41};
42 /*}}}*/
b9179170 43// PackageNameMatchesFnmatch /*{{{*/
dd4d9729 44 class PackageNameMatchesFnmatch : public PackageMatcher{
b9179170
MV
45 /** \brief dpointer placeholder (for later in case we need it) */
46 void *d;
47 const std::string Pattern;
48public:
49 PackageNameMatchesFnmatch(std::string const &Pattern)
50 : Pattern(Pattern) {};
51 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
52 virtual bool operator() (pkgCache::GrpIterator const &Grp);
314a3f88 53 virtual ~PackageNameMatchesFnmatch() {};
b9179170
MV
54};
55 /*}}}*/
424ff669
DK
56// PackageArchitectureMatchesSpecification /*{{{*/
57/** \class PackageArchitectureMatchesSpecification
58 \brief matching against architecture specification strings
59
60 The strings are of the format <kernel>-<cpu> where either component,
61 or the whole string, can be the wildcard "any" as defined in
62 debian-policy ยง11.1 "Architecture specification strings".
63
64 Examples: i386, mipsel, linux-any, any-amd64, any */
b9179170 65class PackageArchitectureMatchesSpecification : public PackageMatcher {
424ff669
DK
66 std::string literal;
67 std::string complete;
68 bool isPattern;
69 /** \brief dpointer placeholder (for later in case we need it) */
70 void *d;
71public:
72 /** \brief matching against architecture specification strings
73 *
74 * @param pattern is the architecture specification string
75 * @param isPattern defines if the given \b pattern is a
76 * architecture specification pattern to match others against
77 * or if it is the fixed string and matched against patterns
78 */
79 PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true);
80 bool operator() (char const * const &arch);
b9179170
MV
81 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
82 virtual bool operator() (pkgCache::VerIterator const &Ver);
314a3f88 83 virtual ~PackageArchitectureMatchesSpecification();
424ff669
DK
84};
85 /*}}}*/
9ba5aa3b
DK
86}
87}
88#endif