diff options
author | Michael Vogt <mvo@debian.org> | 2010-07-09 19:10:28 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2010-07-09 19:10:28 +0200 |
commit | 358f10d9d47a88cbf0568f042caccfef8678cbc8 (patch) | |
tree | 711c7ddc538476e8b88dfb8b6d76361db5754c1e /apt-pkg/contrib/configuration.h | |
parent | fd3b761e8cba6ed626639b50b1221246098c7b3a (diff) | |
parent | a9fe592842bfa17d91f4904d7fb0e3af3adebb17 (diff) |
merged from donkult
Diffstat (limited to 'apt-pkg/contrib/configuration.h')
-rw-r--r-- | apt-pkg/contrib/configuration.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h index 2494c1d7c..cbe18e4e5 100644 --- a/apt-pkg/contrib/configuration.h +++ b/apt-pkg/contrib/configuration.h @@ -28,7 +28,7 @@ #ifndef PKGLIB_CONFIGURATION_H #define PKGLIB_CONFIGURATION_H - +#include <regex.h> #include <string> #include <vector> @@ -104,6 +104,23 @@ class Configuration Configuration(const Item *Root); Configuration(); ~Configuration(); + + /** \brief match a string against a configurable list of patterns */ + class MatchAgainstConfig + { + std::vector<regex_t *> patterns; + + public: + MatchAgainstConfig(char const * Config); + virtual ~MatchAgainstConfig(); + + /** \brief Returns \b true for a string matching one of the patterns */ + bool Match(char const * str) const; + bool Match(std::string const &str) const { return Match(str.c_str()); }; + + /** \brief returns if the matcher setup was successful */ + bool wasConstructedSuccessfully() const { return patterns.empty() == false; } + }; }; extern Configuration *_config; |