add helper class to tmp. block a boost signal/slot connection
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <boost/signals.hpp>
|
||||
#include <QString>
|
||||
|
||||
namespace Base
|
||||
@@ -146,6 +147,8 @@ private:
|
||||
Private* d;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
template<typename Status, class Object>
|
||||
class ObjectStatusLocker
|
||||
{
|
||||
@@ -162,6 +165,23 @@ private:
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class ConnectionBlocker {
|
||||
typedef boost::BOOST_SIGNALS_NAMESPACE::connection Connection;
|
||||
bool b;
|
||||
Connection& c;
|
||||
|
||||
public:
|
||||
ConnectionBlocker(Connection& c) : c(c) {
|
||||
b = c.blocked();
|
||||
c.block(true);
|
||||
}
|
||||
~ConnectionBlocker() {
|
||||
c.block(b);
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
struct BaseExport Tools
|
||||
{
|
||||
static std::string getUniqueName(const std::string&, const std::vector<std::string>&,int d=0);
|
||||
|
||||
Reference in New Issue
Block a user