]> git.saurik.com Git - apt.git/blame_incremental - apt-pkg/cachefilter.h
Merge branch 'debian/sid' into debian/experimental
[apt.git] / apt-pkg / cachefilter.h
... / ...
CommitLineData
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#include <apt-pkg/cacheiterators.h>
11
12#include <string>
13
14#include <regex.h>
15 /*}}}*/
16namespace APT {
17namespace CacheFilter {
18
19class PackageMatcher {
20 public:
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; };
27
28 virtual ~PackageMatcher() {};
29};
30
31// PackageNameMatchesRegEx /*{{{*/
32class PackageNameMatchesRegEx : public PackageMatcher {
33 /** \brief dpointer placeholder (for later in case we need it) */
34 void *d;
35 regex_t* pattern;
36public:
37 PackageNameMatchesRegEx(std::string const &Pattern);
38 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
39 virtual bool operator() (pkgCache::GrpIterator const &Grp);
40 virtual ~PackageNameMatchesRegEx();
41};
42 /*}}}*/
43// PackageNameMatchesFnmatch /*{{{*/
44 class PackageNameMatchesFnmatch : public PackageMatcher{
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);
53 virtual ~PackageNameMatchesFnmatch() {};
54};
55 /*}}}*/
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 */
65class PackageArchitectureMatchesSpecification : public PackageMatcher {
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);
81 virtual bool operator() (pkgCache::PkgIterator const &Pkg);
82 virtual bool operator() (pkgCache::VerIterator const &Ver);
83 virtual ~PackageArchitectureMatchesSpecification();
84};
85 /*}}}*/
86}
87}
88#endif