From a7ab5f6ec20d7088420f2a26184dee4f48734c3a Mon Sep 17 00:00:00 2001 From: Arvin Schnell Date: Mon, 4 Nov 2024 16:20:56 +0100 Subject: [PATCH] - move more functions to snapper namespace --- client/cleanup.cc | 5 +++++ client/cleanup.h | 5 +++++ client/misc.cc | 5 +++++ client/misc.h | 8 ++------ client/proxy/commands.cc | 10 ++++++++-- client/proxy/commands.h | 13 +++++-------- client/proxy/proxy-dbus.cc | 5 +++++ client/proxy/proxy-dbus.h | 5 +++++ client/proxy/proxy-lib.cc | 5 +++++ client/proxy/proxy-lib.h | 4 ++++ client/proxy/proxy.cc | 5 +++++ client/proxy/proxy.h | 6 ++++-- client/proxy/types.h | 14 +++++++++----- zypp-plugin/snapper-zypp-plugin.cc | 2 +- 14 files changed, 68 insertions(+), 24 deletions(-) diff --git a/client/cleanup.cc b/client/cleanup.cc index 33151fd1..ded455c4 100644 --- a/client/cleanup.cc +++ b/client/cleanup.cc @@ -37,6 +37,9 @@ #include "cleanup.h" +namespace snapper +{ + using namespace std; @@ -887,3 +890,5 @@ do_cleanup_empty_pre_post(ProxySnapper* snapper, bool verbose, std::function c void do_cleanup_empty_pre_post(ProxySnapper* snapper, bool verbose, std::function condition, Plugins::Report& report); + +} diff --git a/client/misc.cc b/client/misc.cc index 0dfd222a..73b33b53 100644 --- a/client/misc.cc +++ b/client/misc.cc @@ -36,6 +36,9 @@ #include "misc.h" +namespace snapper +{ + unsigned int read_num(const string& str) { @@ -213,3 +216,5 @@ Differ::run(const string& f1, const string& f2) const for (const string& line : cmd.get_stderr()) cerr << line << endl; } + +} diff --git a/client/misc.h b/client/misc.h index a87d7603..5a62deb8 100644 --- a/client/misc.h +++ b/client/misc.h @@ -33,9 +33,8 @@ #include "proxy/proxy.h" -using namespace snapper; -using namespace std; - +namespace snapper +{ unsigned int read_num(const string& str); @@ -67,9 +66,6 @@ struct Differ }; -namespace snapper -{ - /** * Return a string listing the possible enum values. E.g. "Use auto, classic or * transactional." for possible_enum_values(). diff --git a/client/proxy/commands.cc b/client/proxy/commands.cc index 3aece4ac..4fbe863e 100644 --- a/client/proxy/commands.cc +++ b/client/proxy/commands.cc @@ -30,14 +30,18 @@ #include "dbus/DBusPipe.h" #include "snapper/AppUtil.h" -using namespace std; - #define SERVICE "org.opensuse.Snapper" #define OBJECT "/org/opensuse/Snapper" #define INTERFACE "org.opensuse.Snapper" +namespace snapper +{ + +using namespace std; + + vector command_list_xconfigs(DBus::Connection& conn) { @@ -744,3 +748,5 @@ command_debug(DBus::Connection& conn) return lines; } + +} diff --git a/client/proxy/commands.h b/client/proxy/commands.h index f5139be7..7c7a63a6 100644 --- a/client/proxy/commands.h +++ b/client/proxy/commands.h @@ -21,17 +21,12 @@ */ -#include -#include -#include - -using std::string; -using std::vector; -using std::map; - #include "types.h" +namespace snapper +{ + vector command_list_xconfigs(DBus::Connection& conn); @@ -163,3 +158,5 @@ command_get_plugins_report(DBus::Connection& conn); vector command_debug(DBus::Connection& conn); + +} diff --git a/client/proxy/proxy-dbus.cc b/client/proxy/proxy-dbus.cc index 2722f78d..6c3a9186 100644 --- a/client/proxy/proxy-dbus.cc +++ b/client/proxy/proxy-dbus.cc @@ -25,6 +25,9 @@ #include "../utils/text.h" +namespace snapper +{ + using namespace std; @@ -487,3 +490,5 @@ ProxySnappers::createDbus() { return ProxySnappers(new ProxySnappersDbus()); } + +} diff --git a/client/proxy/proxy-dbus.h b/client/proxy/proxy-dbus.h index 205fc92c..1b0cd8a3 100644 --- a/client/proxy/proxy-dbus.h +++ b/client/proxy/proxy-dbus.h @@ -30,6 +30,9 @@ #include "proxy.h" +namespace snapper +{ + class ProxySnapshotDbus; class ProxySnapshotsDbus; class ProxySnapperDbus; @@ -229,5 +232,7 @@ class ProxyComparisonDbus : public ProxyComparison::Impl }; +} + #endif diff --git a/client/proxy/proxy-lib.cc b/client/proxy/proxy-lib.cc index cb8f973f..6b8b42cc 100644 --- a/client/proxy/proxy-lib.cc +++ b/client/proxy/proxy-lib.cc @@ -23,6 +23,9 @@ #include "proxy-lib.h" +namespace snapper +{ + using namespace std; @@ -228,3 +231,5 @@ to_lib(const ProxySnapshot& proxy_snapshot) { return dynamic_cast(proxy_snapshot.get_impl()); } + +} diff --git a/client/proxy/proxy-lib.h b/client/proxy/proxy-lib.h index e17fd84f..6fe7c1f6 100644 --- a/client/proxy/proxy-lib.h +++ b/client/proxy/proxy-lib.h @@ -30,6 +30,9 @@ #include +namespace snapper +{ + class ProxySnapshotLib : public ProxySnapshot::Impl { @@ -203,5 +206,6 @@ class ProxyComparisonLib : public ProxyComparison::Impl const ProxySnapshotLib& to_lib(const ProxySnapshot& proxy_snapshot); +} #endif diff --git a/client/proxy/proxy.cc b/client/proxy/proxy.cc index 08a6a5e6..de1213e9 100644 --- a/client/proxy/proxy.cc +++ b/client/proxy/proxy.cc @@ -31,6 +31,9 @@ #include "proxy.h" +namespace snapper +{ + using namespace std; @@ -207,3 +210,5 @@ ProxySnapshots::findPost(const_iterator pre) const return end(); } + +} diff --git a/client/proxy/proxy.h b/client/proxy/proxy.h index 1b070f1e..3f24358f 100644 --- a/client/proxy/proxy.h +++ b/client/proxy/proxy.h @@ -34,8 +34,8 @@ #include -using namespace snapper; - +namespace snapper +{ /** * The proxy classes here allow clients, so far only the snapper command line @@ -360,5 +360,7 @@ class ProxyComparison }; +} + #endif diff --git a/client/proxy/types.h b/client/proxy/types.h index 585f57b2..dad283be 100644 --- a/client/proxy/types.h +++ b/client/proxy/types.h @@ -25,10 +25,6 @@ #include #include -using std::string; -using std::vector; -using std::map; - #include "dbus/DBusMessage.h" #include "dbus/DBusConnection.h" #include "snapper/Snapshot.h" @@ -36,7 +32,13 @@ using std::map; #include "snapper/SnapperTmpl.h" #include "snapper/Snapper.h" -using namespace snapper; + +namespace snapper +{ + +using std::string; +using std::vector; +using std::map; struct XConfigInfo @@ -102,6 +104,8 @@ struct XReport int exit_status; }; +} + namespace DBus { diff --git a/zypp-plugin/snapper-zypp-plugin.cc b/zypp-plugin/snapper-zypp-plugin.cc index 2909a301..230548a7 100644 --- a/zypp-plugin/snapper-zypp-plugin.cc +++ b/zypp-plugin/snapper-zypp-plugin.cc @@ -31,7 +31,7 @@ #include #include -// a collision with client/errors.h +// a collision with client/proxy/errors.h #ifdef error_description #undef error_description #endif