summaryrefslogtreecommitdiff
path: root/apt-pkg/depcache.h
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-06-26 13:29:24 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-06-26 13:29:24 +0200
commit1f2933a8de0f3a26f51b4a0a2112cbdfd4461e9b (patch)
treef3276dc8ca70d3648af677251943b789a5c55abb /apt-pkg/depcache.h
parent9f9717fa6bca13817cf9cf84d513e59d258af154 (diff)
- 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.h22
1 files changed, 6 insertions, 16 deletions
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 72d7cce5d..66c099b80 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