libsigc++ 3.6.0
|
Convenience class for safe disconnection. More...
#include <sigc++/connection.h>
Public Member Functions | |
connection () noexcept | |
Constructs an empty connection object. | |
connection (const connection & c) | |
Constructs a connection object copying an existing one. | |
connection (slot_base & slot) | |
Constructs a connection object from a slot object. | |
~connection () | |
bool | block (bool should_block=true) noexcept |
Sets or unsets the blocking state of this connection. | |
bool | blocked () const noexcept |
Returns whether the connection is blocked. | |
bool | connected () const noexcept |
Returns whether the connection is still active. | |
void | disconnect () |
Disconnects the referred slot. | |
bool | empty () const noexcept |
Returns whether the connection is still active. | |
operator bool () const noexcept | |
Returns whether the connection is still active. | |
connection & | operator= (const connection &src) |
Overrides this connection object copying another one. | |
bool | unblock () noexcept |
Unsets the blocking state of this connection. | |
Convenience class for safe disconnection.
This may be used to disconnect the referred slot at any time (disconnect()). sigc::signal::connect() and sigc::signal::connect_first() return a sigc::connection.
If the slot has already been destroyed, disconnect() does nothing. empty() or operator bool() can be used to test whether the connection is still active. The connection can be blocked (block(), unblock()).
sigc::connection doesnʼt disconnect the slot automatically upon destruction. You do not need to keep the sigc::connection object to retain the connection of the slot to the signal. See also sigc::scoped_connection, which does disconnect automatically when the connection object is destroyed or replaced.
|
noexcept |
Constructs an empty connection object.
sigc::connection::connection | ( | const connection & | c | ) |
Constructs a connection object copying an existing one.
c | The connection object to make a copy from. |
|
explicit |
Constructs a connection object from a slot object.
slot | The slot to operate on. |
sigc::connection::~connection | ( | ) |
|
noexcept |
Sets or unsets the blocking state of this connection.
See slot_base::block() for details.
should_block | Indicates whether the blocking state should be set or unset. |
true
if the connection has been in blocking state before.
|
noexcept |
Returns whether the connection is blocked.
true
if the connection is blocked.
|
noexcept |
Returns whether the connection is still active.
true
if the connection is still active. void sigc::connection::disconnect | ( | ) |
Disconnects the referred slot.
|
noexcept |
Returns whether the connection is still active.
false
if the connection is still active.
|
explicitnoexcept |
Returns whether the connection is still active.
true
if the connection is still active. connection & sigc::connection::operator= | ( | const connection & | src | ) |
Overrides this connection object copying another one.
src | The connection object to make a copy from. |
|
noexcept |
Unsets the blocking state of this connection.
true
if the connection has been in blocking state before.