}
private:
+
static const string cleanup_algorithm;
- string snapper_cfg;
+ const string snapper_cfg;
DBus::Connection dbus_conn;
unsigned int pre_snapshot_num;
for (auto matcher: solvable_matchers) {
if (matcher.match(s)) {
found = true;
- important = important || matcher.important;
+ important = important || matcher.is_important();
if (found && important)
return; // short circuit
}
#include <vector>
#include <string>
-struct SolvableMatcher {
- enum class Kind {
- GLOB,
- REGEX
- };
- std::string pattern;
- Kind kind;
- bool important = false;
+class SolvableMatcher
+{
+public:
+
+ enum class Kind { GLOB, REGEX };
static std::ostream& log;
- SolvableMatcher(const std::string& apattern, Kind akind, bool aimportant)
- : pattern(apattern)
- , kind(akind)
- , important(aimportant)
+
+ SolvableMatcher(const std::string& pattern, Kind kind, bool important)
+ : pattern(pattern), kind(kind), important(important)
{}
+ bool is_important() const { return important; }
+
bool match(const std::string& solvable) const;
+
static std::vector<SolvableMatcher> load_config(const std::string& cfg_filename);
+
+private:
+
+ const std::string pattern;
+ const Kind kind;
+ const bool important;
+
};
-#endif //SOLVABLE_MATCHER_H
+#endif