Skip to content

Commit

Permalink
Merge pull request #950 from aschnell/master
Browse files Browse the repository at this point in the history
- move more functions to snapper namespace
  • Loading branch information
aschnell authored Nov 4, 2024
2 parents 6ea1e59 + a7ab5f6 commit 2fcbc21
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 24 deletions.
5 changes: 5 additions & 0 deletions client/cleanup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#include "cleanup.h"


namespace snapper
{

using namespace std;


Expand Down Expand Up @@ -887,3 +890,5 @@ do_cleanup_empty_pre_post(ProxySnapper* snapper, bool verbose, std::function<boo
EmptyPrePostCleaner cleaner(snapper, verbose, parameters);
cleaner.cleanup(condition, report);
}

}
5 changes: 5 additions & 0 deletions client/cleanup.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#include "proxy/proxy.h"


namespace snapper
{

/*
* The following three functions do the cleanup based on the conditionals defined in the
* config, that are hard limit, quota and free space.
Expand Down Expand Up @@ -57,3 +60,5 @@ do_cleanup_timeline(ProxySnapper* snapper, bool verbose, std::function<bool()> c
void
do_cleanup_empty_pre_post(ProxySnapper* snapper, bool verbose, std::function<bool()> condition,
Plugins::Report& report);

}
5 changes: 5 additions & 0 deletions client/misc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#include "misc.h"


namespace snapper
{

unsigned int
read_num(const string& str)
{
Expand Down Expand Up @@ -213,3 +216,5 @@ Differ::run(const string& f1, const string& f2) const
for (const string& line : cmd.get_stderr())
cerr << line << endl;
}

}
8 changes: 2 additions & 6 deletions client/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
#include "proxy/proxy.h"


using namespace snapper;
using namespace std;

namespace snapper
{

unsigned int
read_num(const string& str);
Expand Down Expand Up @@ -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<Ambit>().
Expand Down
10 changes: 8 additions & 2 deletions client/proxy/commands.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<XConfigInfo>
command_list_xconfigs(DBus::Connection& conn)
{
Expand Down Expand Up @@ -744,3 +748,5 @@ command_debug(DBus::Connection& conn)

return lines;
}

}
13 changes: 5 additions & 8 deletions client/proxy/commands.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@
*/


#include <string>
#include <vector>
#include <map>

using std::string;
using std::vector;
using std::map;

#include "types.h"


namespace snapper
{

vector<XConfigInfo>
command_list_xconfigs(DBus::Connection& conn);

Expand Down Expand Up @@ -163,3 +158,5 @@ command_get_plugins_report(DBus::Connection& conn);

vector<string>
command_debug(DBus::Connection& conn);

}
5 changes: 5 additions & 0 deletions client/proxy/proxy-dbus.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include "../utils/text.h"


namespace snapper
{

using namespace std;


Expand Down Expand Up @@ -487,3 +490,5 @@ ProxySnappers::createDbus()
{
return ProxySnappers(new ProxySnappersDbus());
}

}
5 changes: 5 additions & 0 deletions client/proxy/proxy-dbus.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#include "proxy.h"


namespace snapper
{

class ProxySnapshotDbus;
class ProxySnapshotsDbus;
class ProxySnapperDbus;
Expand Down Expand Up @@ -229,5 +232,7 @@ class ProxyComparisonDbus : public ProxyComparison::Impl

};

}


#endif
5 changes: 5 additions & 0 deletions client/proxy/proxy-lib.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#include "proxy-lib.h"


namespace snapper
{

using namespace std;


Expand Down Expand Up @@ -228,3 +231,5 @@ to_lib(const ProxySnapshot& proxy_snapshot)
{
return dynamic_cast<const ProxySnapshotLib&>(proxy_snapshot.get_impl());
}

}
4 changes: 4 additions & 0 deletions client/proxy/proxy-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#include <snapper/Comparison.h>


namespace snapper
{

class ProxySnapshotLib : public ProxySnapshot::Impl
{

Expand Down Expand Up @@ -203,5 +206,6 @@ class ProxyComparisonLib : public ProxyComparison::Impl
const ProxySnapshotLib&
to_lib(const ProxySnapshot& proxy_snapshot);

}

#endif
5 changes: 5 additions & 0 deletions client/proxy/proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
#include "proxy.h"


namespace snapper
{

using namespace std;


Expand Down Expand Up @@ -207,3 +210,5 @@ ProxySnapshots::findPost(const_iterator pre) const

return end();
}

}
6 changes: 4 additions & 2 deletions client/proxy/proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
#include <snapper/File.h>


using namespace snapper;

namespace snapper
{

/**
* The proxy classes here allow clients, so far only the snapper command line
Expand Down Expand Up @@ -360,5 +360,7 @@ class ProxyComparison

};

}


#endif
14 changes: 9 additions & 5 deletions client/proxy/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,20 @@
#include <vector>
#include <map>

using std::string;
using std::vector;
using std::map;

#include "dbus/DBusMessage.h"
#include "dbus/DBusConnection.h"
#include "snapper/Snapshot.h"
#include "snapper/File.h"
#include "snapper/SnapperTmpl.h"
#include "snapper/Snapper.h"

using namespace snapper;

namespace snapper
{

using std::string;
using std::vector;
using std::map;


struct XConfigInfo
Expand Down Expand Up @@ -102,6 +104,8 @@ struct XReport
int exit_status;
};

}


namespace DBus
{
Expand Down
2 changes: 1 addition & 1 deletion zypp-plugin/snapper-zypp-plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <boost/algorithm/string.hpp>

#include <json.h>
// a collision with client/errors.h
// a collision with client/proxy/errors.h
#ifdef error_description
#undef error_description
#endif
Expand Down

0 comments on commit 2fcbc21

Please sign in to comment.