diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-06-26 13:29:24 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-06-26 13:29:24 +0200 |
commit | 1f2933a8de0f3a26f51b4a0a2112cbdfd4461e9b (patch) | |
tree | f3276dc8ca70d3648af677251943b789a5c55abb /apt-pkg/depcache.h | |
parent | 9f9717fa6bca13817cf9cf84d513e59d258af154 (diff) | |
download | apt-1f2933a8de0f3a26f51b4a0a2112cbdfd4461e9b.tar.gz |
- use the new MatchAgainstConfig for the DefaultRootSetFunc
* apt-pkg/contrib/configuration.{cc,h}:
- add a wrapper to match strings against configurable regex patterns
Diffstat (limited to 'apt-pkg/depcache.h')
-rw-r--r-- | apt-pkg/depcache.h | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 72d7cce5..66c099b8 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -38,11 +38,10 @@ #ifndef PKGLIB_DEPCACHE_H #define PKGLIB_DEPCACHE_H - +#include <apt-pkg/configuration.h> #include <apt-pkg/pkgcache.h> #include <apt-pkg/progress.h> - -#include <regex.h> +#include <apt-pkg/error.h> #include <vector> #include <memory> @@ -184,22 +183,13 @@ class pkgDepCache : protected pkgCache::Namespace /** \brief Returns \b true for packages matching a regular * expression in APT::NeverAutoRemove. */ - class DefaultRootSetFunc : public InRootSetFunc + class DefaultRootSetFunc : public InRootSetFunc, public Configuration::MatchAgainstConfig { - std::vector<regex_t *> rootSetRegexp; - bool constructedSuccessfully; - public: - DefaultRootSetFunc(); - ~DefaultRootSetFunc(); - - /** \return \b true if the class initialized successfully, \b - * false otherwise. Used to avoid throwing an exception, since - * APT classes generally don't. - */ - bool wasConstructedSuccessfully() const { return constructedSuccessfully; } + DefaultRootSetFunc() : Configuration::MatchAgainstConfig("APT::NeverRemove") {}; + virtual ~DefaultRootSetFunc() {}; - bool InRootSet(const pkgCache::PkgIterator &pkg); + bool InRootSet(const pkgCache::PkgIterator &pkg) { return pkg.end() == true && Match(pkg.Name()); }; }; struct StateCache |