Bromeon
Public Member Functions
thor::ScopedConnection Class Reference

Class that manages the connection between an event and a listener and disconnects it at destruction. More...

Inheritance diagram for thor::ScopedConnection:
Inheritance graph

List of all members.

Public Member Functions

 ScopedConnection (const Connection &connection)
 Constructor: Initializes the instance with a given Connection.
 ~ScopedConnection ()
 Destructor: Disconnects the event-listener connection.
bool IsConnected () const
 Checks whether the instance currently references a listener.

Detailed Description

Class that manages the connection between an event and a listener and disconnects it at destruction.

In contrast to thor::Connection, the thor::ScopedConnection class disconnects its referenced listener in the destructor. You can use ScopedConnection for temporary listeners that aren't needed after the end of scope.
ScopedConnection is noncopyable.


Constructor & Destructor Documentation

thor::ScopedConnection::ScopedConnection ( const Connection connection) [explicit]

Constructor: Initializes the instance with a given Connection.

Scoped connections must be initialized in the constructor. You cannot assign a new value later.

Parameters:
connectionConnection which is copied. It may be invalid.

Destructor: Disconnects the event-listener connection.

In case the instance isn't connected, nothing happens.


Member Function Documentation

Checks whether the instance currently references a listener.

Returns:
true if this instance is currently connected.

The documentation for this class was generated from the following file: