libsigc++: sigc::connection Struct Reference

libsigc++ 2.2.10

- Main Page
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# sigc::connection Struct Reference
Signals

Convinience class for safe disconnection. More...

`#include <sigc++/connection.h>`

List of all members.

## Public Member Functions
| connection ()
| 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& | 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 | empty () const
| Returns whether the connection is still active.
bool | connected () const
| Returns whether the connection is still active.
bool | blocked () const
| Returns whether the connection is blocked.
bool | block (bool should_block=true)
| Sets or unsets the blocking state of this connection.
bool | unblock ()
| Unsets the blocking state of this connection.
void | disconnect ()
| Disconnects the referred slot.
| operator bool ()
| Returns whether the connection is still active.
## Static Public Member Functions
static void* | notify (void* data)
| Callback that is executed when the referred slot is destroyed.

## 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

sigc::connection::connection | ( |  | ) |

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.

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.

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.

## Member Function Documentation

bool sigc::connection::block | ( | bool | should_block = `true` | ) |

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.

bool sigc::connection::blocked | ( |  | ) | const

Returns whether the connection is blocked.

Returns:
  `true` if the connection is blocked.

bool sigc::connection::connected | ( |  | ) | const

Returns whether the connection is still active.

Returns:
  `true` if the connection is still active.

bool sigc::connection::empty | ( |  | ) | const

Returns whether the connection is still active.

Returns:
  `false` if the connection is still active.

static void* sigc::connection::notify | ( | void * | data | ) | `[static]`

Callback that is executed when the referred slot is destroyed.

Parameters:

  d | The connection object notified (`this`).

sigc::connection::operator bool | ( |  | ) |

Returns whether the connection is still active.

Returns:
  `true` if the connection is still active.

template <typename T_slot >

connection& sigc::connection::operator= | ( | const slot_iterator< T_slot >& | it | ) | `[inline]`

Overrides this connection object with another slot list iterator.

Parameters:

  it | The new slot list iterator to take the slot from.

connection& sigc::connection::operator= | ( | const connection& | c | ) |

Overrides this connection object copying another one.

Parameters:

  c | The connection object to make a copy from.

bool sigc::connection::unblock | ( |  | ) |

Unsets the blocking state of this connection.

Returns:
  `true` if the connection has been in blocking state before.