From: Arvin Schnell Date: Tue, 24 Jan 2023 10:38:41 +0000 (+0100) Subject: - added const X-Git-Tag: v0.10.5~63^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F774%2Fhead;p=thirdparty%2Fsnapper.git - added const --- diff --git a/zypp-plugin/snapper-zypp-plugin.cc b/zypp-plugin/snapper-zypp-plugin.cc index 511d527c..59abcdee 100644 --- a/zypp-plugin/snapper-zypp-plugin.cc +++ b/zypp-plugin/snapper-zypp-plugin.cc @@ -229,9 +229,10 @@ public: } private: + static const string cleanup_algorithm; - string snapper_cfg; + const string snapper_cfg; DBus::Connection dbus_conn; unsigned int pre_snapshot_num; @@ -386,7 +387,7 @@ SnapperZyppPlugin::match_solvables(const set& solvables, bool& found, bo 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 } diff --git a/zypp-plugin/solvable-matcher.h b/zypp-plugin/solvable-matcher.h index b345ed07..4d588d96 100644 --- a/zypp-plugin/solvable-matcher.h +++ b/zypp-plugin/solvable-matcher.h @@ -26,24 +26,30 @@ #include #include -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 load_config(const std::string& cfg_filename); + +private: + + const std::string pattern; + const Kind kind; + const bool important; + }; -#endif //SOLVABLE_MATCHER_H +#endif