]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/signals/connection.hpp
typos
[lyx.git] / boost / boost / signals / connection.hpp
index 1be3c439cd7aed0d8aa9553b6a40ea03aaa5a7e5..48493aabf975c172f15a04830f272ed3aee67460 100644 (file)
@@ -53,6 +53,7 @@ namespace boost {
         void* signal;
         void* signal_data;
         void (*signal_disconnect)(void*, void*);
+        bool blocked_;
 
         std::list<bound_object> bound_objects;
       };
@@ -69,6 +70,12 @@ namespace boost {
       connection(const connection&);
       ~connection();
 
+      // Block he connection: if the connection is still active, there
+      // will be no notification
+      void block(bool should_block = true) { con->blocked_ = should_block; }
+      void unblock() { con->blocked_ = false; }
+      bool blocked() const { return !connected() || con->blocked_; }
+
       // Disconnect the signal and slot, if they are connected
       void disconnect() const;
 
@@ -87,11 +94,11 @@ namespace boost {
 
     public: // TBD: CHANGE THIS
       // Set whether this connection object is controlling or not
-      void set_controlling(bool control = true) 
+      void set_controlling(bool control = true)
       { controlling_connection = control; }
 
       shared_ptr<BOOST_SIGNALS_NAMESPACE::detail::basic_connection>
-      get_connection() const 
+      get_connection() const
       { return con; }
 
     private:
@@ -162,6 +169,18 @@ namespace boost {
         }
       };
 
+      // Determines if the underlying connection is callable, ie if
+      // it is connected and not blocked
+      struct is_callable {
+        typedef connection_slot_pair argument_type;
+        typedef bool result_type;
+
+        inline bool operator()(const argument_type& c) const
+        {
+          return c.first.connected() && !c.first.blocked() ;
+        }
+      };
+
       // Autodisconnects the bound object when it is destroyed unless the
       // release method is invoked.
       class auto_disconnect_bound_object {