libsigc++: sigc::connection Struct Reference
Convinience class for safe disconnection. More...
#include <sigc++/connection.h>
Public Member Functions | |
| connection () noexcept | |
| Constructs an empty connection object. More... | |
| connection (const connection& c) | |
| Constructs a connection object copying an existing one. More... | |
| template<typename T_slot > | |
| connection (const slot_iterator< T_slot >& it) | |
| Constructs a connection object from a slot list iterator. More... | |
| connection (slot_base& sl) | |
| Constructs a connection object from a slot object. More... | |
| ~connection () | |
| bool | block (bool should_block=true) noexcept |
| Sets or unsets the blocking state of this connection. More... | |
| bool | blocked () const noexcept |
| Returns whether the connection is blocked. More... | |
| bool | connected () const noexcept |
| Returns whether the connection is still active. More... | |
| void | disconnect () |
| Disconnects the referred slot. More... | |
| bool | empty () const noexcept |
| Returns whether the connection is still active. More... | |
| operator bool () noexcept | |
| Returns whether the connection is still active. More... | |
| connection& | operator= (const connection& c) |
| Overrides this connection object copying another one. More... | |
| template<typename T_slot > | |
| connection& | operator= (const slot_iterator< T_slot >& it) |
| Overrides this connection object with another slot list iterator. More... | |
| bool | unblock () noexcept |
| Unsets the blocking state of this connection. More... | |
Static Public Member Functions | |
| static void* | notify (void* data) |
| Callback that is executed when the referred slot is destroyed. More... | |
Detailed Description
Convinience class for safe disconnection.
Iterators must not be used beyond the lifetime of the list they work on. A connection object can be created from a slot list iterator and may safely be used to disconnect the referred slot at any time (disconnect()). 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()).
This is possible because the connection object gets notified when the referred slot dies (notify()).
Constructor & Destructor Documentation
|
noexcept |
Constructs an empty connection object.
| sigc::connection::connection | ( | const connection& | c | ) |
Constructs a connection object copying an existing one.
- Parameters
-
c The connection object to make a copy from.
|
inline |
Constructs a connection object from a slot list iterator.
- Parameters
-
it The slot list iterator to take the slot from.
|
explicit |
Constructs a connection object from a slot object.
This is only useful if you create your own slot list.
- Parameters
-
sl The slot to operate on.
| sigc::connection::~connection | ( | ) |
Member Function Documentation
|
noexcept |
Sets or unsets the blocking state of this connection.
See slot_base::block() for details.
- Parameters
-
should_block Indicates whether the blocking state should be set or unset.
- Returns
trueif the connection has been in blocking state before.
|
noexcept |
Returns whether the connection is blocked.
- Returns
trueif the connection is blocked.
|
noexcept |
Returns whether the connection is still active.
- Returns
trueif the connection is still active.
| void sigc::connection::disconnect | ( | ) |
Disconnects the referred slot.
|
noexcept |
Returns whether the connection is still active.
- Returns
falseif the connection is still active.
|
static |
Callback that is executed when the referred slot is destroyed.
- Parameters
-
data The connection object notified ( this).
|
explicitnoexcept |
Returns whether the connection is still active.
- Returns
trueif the connection is still active.
| connection& sigc::connection::operator= | ( | const connection& | c | ) |
Overrides this connection object copying another one.
- Parameters
-
c The connection object to make a copy from.
|
inline |
Overrides this connection object with another slot list iterator.
- Parameters
-
it The new slot list iterator to take the slot from.
|
noexcept |
Unsets the blocking state of this connection.
- Returns
trueif the connection has been in blocking state before.
