Convenience class for safe disconnection.
More...
#include <sigc++/connection.h>
|
| connection () noexcept |
| Constructs an empty connection object.
|
| connection (const connection & c) |
| Constructs a connection object copying an existing one.
|
template<typename T_slot> |
| connection (const slot_iterator< T_slot > & it) |
| Constructs a connection object from a slot list iterator.
|
| connection (slot_base & sl) |
| 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 () noexcept |
| Returns whether the connection is still active.
|
connection & | operator= (const connection & c) |
| Overrides this connection object copying another one.
|
template<typename T_slot> |
connection & | operator= (const slot_iterator< T_slot > & it) |
| Overrides this connection object with another slot list iterator.
|
bool | unblock () noexcept |
| Unsets the blocking state of this connection.
|
|
static void * | notify (void * data) |
| Callback that is executed when the referred slot is destroyed.
|
Convenience class for safe disconnection.
sigc::signal::connect() returns a slot list iterator. 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.
mem_functor0< T_return, T_obj > mem_fun(T_return(T_obj::*_A_func)())
Creates a functor of type sigc::mem_functor0 which wraps a method.
Definition mem_fun.h:5797
Convenience class for safe disconnection.
Definition connection.h:44
The connection may safely be used to disconnect the referred slot at any time (disconnect()). If the slot has already been destroyed, disconnect() does nothing. This is possible because the connection object gets notified when the referred slot dies (notify()). empty() or operator bool() can be used to test whether the connection is still active. The connection can be blocked (block(), unblock()).
◆ connection() [1/4]
sigc::connection::connection |
( |
| ) |
|
|
noexcept |
Constructs an empty connection object.
◆ connection() [2/4]
sigc::connection::connection |
( |
const connection & | c | ) |
|
Constructs a connection object copying an existing one.
- Parameters
-
c | The connection object to make a copy from. |
◆ connection() [3/4]
template <typename T_slot>
sigc::connection::connection |
( |
const slot_iterator< T_slot > & | it | ) |
|
|
inline |
Constructs a connection object from a slot list iterator.
- Parameters
-
it | The slot list iterator to take the slot from. |
◆ connection() [4/4]
sigc::connection::connection |
( |
slot_base & | sl | ) |
|
|
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. |
◆ ~connection()
sigc::connection::~connection |
( |
| ) |
|
◆ block()
bool sigc::connection::block |
( |
bool | should_block = true | ) |
|
|
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
true
if the connection has been in blocking state before.
◆ blocked()
bool sigc::connection::blocked |
( |
| ) |
const |
|
noexcept |
Returns whether the connection is blocked.
- Returns
true
if the connection is blocked.
◆ connected()
bool sigc::connection::connected |
( |
| ) |
const |
|
noexcept |
Returns whether the connection is still active.
- Returns
true
if the connection is still active.
◆ disconnect()
void sigc::connection::disconnect |
( |
| ) |
|
Disconnects the referred slot.
◆ empty()
bool sigc::connection::empty |
( |
| ) |
const |
|
noexcept |
Returns whether the connection is still active.
- Returns
false
if the connection is still active.
◆ notify()
void * sigc::connection::notify |
( |
void * | data | ) |
|
|
static |
Callback that is executed when the referred slot is destroyed.
- Parameters
-
data | The connection object notified (this ). |
◆ operator bool()
sigc::connection::operator bool |
( |
| ) |
|
|
explicitnoexcept |
Returns whether the connection is still active.
- Returns
true
if the connection is still active.
◆ operator=() [1/2]
Overrides this connection object copying another one.
- Parameters
-
c | The connection object to make a copy from. |
◆ operator=() [2/2]
template <typename T_slot>
Overrides this connection object with another slot list iterator.
- Parameters
-
it | The new slot list iterator to take the slot from. |
◆ unblock()
bool sigc::connection::unblock |
( |
| ) |
|
|
noexcept |
Unsets the blocking state of this connection.
- Returns
true
if the connection has been in blocking state before.