]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added const 774/head
authorArvin Schnell <aschnell@suse.de>
Tue, 24 Jan 2023 10:38:41 +0000 (11:38 +0100)
committerArvin Schnell <aschnell@suse.de>
Tue, 24 Jan 2023 10:38:41 +0000 (11:38 +0100)
zypp-plugin/snapper-zypp-plugin.cc
zypp-plugin/solvable-matcher.h

index 511d527ccb429276e33a4a06fb0bb40c439252cb..59abcdeed5413694281726de848aff936218c57c 100644 (file)
@@ -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<string>& 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
            }
index b345ed07ab6a524028dc7a2636e9b2c675eacad0..4d588d96e55dab0af0ed155421870aa29a34d452 100644 (file)
 #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