Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::Signal< Args >::ConnectionGuard Class Reference

Core class that represents a RAII for a connection attached to a signal. More...

Public Member Functions

 ConnectionGuard (const Connection &connection)
 Constructs a Signal::ConnectionGuard object with a connection. More...
 
 ConnectionGuard (const ConnectionGuard &connection)=delete
 
 ConnectionGuard (Connection &&connection)
 Constructs a Signal::ConnectionGuard object with a connection by move semantic. More...
 
 ConnectionGuard (ConnectionGuard &&connection) noexcept=default
 
 ~ConnectionGuard ()
 Destructs the object and disconnects the connection.
 
template<typename... ConnectArgs>
void Connect (BaseClass &signal, ConnectArgs &&... args)
 Connects to a signal with arguments. More...
 
void Disconnect () noexcept
 Disconnects the connection from the signal.
 
Connection & GetConnection ()
 Gets the connection attached to the signal. More...
 
bool IsConnected () const
 Checks whether the connection is still active with the signal. More...
 
ConnectionGuardoperator= (const Connection &connection)
 Assigns the connection into this. More...
 
ConnectionGuardoperator= (const ConnectionGuard &connection)=delete
 
ConnectionGuardoperator= (Connection &&connection)
 Moves the Connection into this. More...
 
ConnectionGuardoperator= (ConnectionGuard &&connection) noexcept
 Moves the ConnectionGuard into this. More...
 

Detailed Description

template<typename... Args>
class Nz::Signal< Args >::ConnectionGuard

Core class that represents a RAII for a connection attached to a signal.

Constructor & Destructor Documentation

◆ ConnectionGuard() [1/2]

template<typename... Args>
Nz::Signal< Args >::ConnectionGuard::ConnectionGuard ( const Connection &  connection)

Constructs a Signal::ConnectionGuard object with a connection.

Parameters
connectionConnection for the scope

◆ ConnectionGuard() [2/2]

template<typename... Args>
Nz::Signal< Args >::ConnectionGuard::ConnectionGuard ( Connection &&  connection)

Constructs a Signal::ConnectionGuard object with a connection by move semantic.

Parameters
connectionConnection for the scope

Member Function Documentation

◆ Connect()

template<typename... Args>
template<typename... ConnectArgs>
void Nz::Signal< Args >::ConnectionGuard::Connect ( BaseClass signal,
ConnectArgs &&...  args 
)

Connects to a signal with arguments.

Parameters
signalNew signal to listen
argsArguments for the signal

◆ GetConnection()

template<typename... Args>
Signal< Args... >::Connection & Nz::Signal< Args >::ConnectionGuard::GetConnection ( )

Gets the connection attached to the signal.

Returns
Connection of the signal

◆ IsConnected()

template<typename... Args>
bool Nz::Signal< Args >::ConnectionGuard::IsConnected ( ) const

Checks whether the connection is still active with the signal.

Returns
true if signal is still active

◆ operator=() [1/3]

template<typename... Args>
Signal< Args... >::ConnectionGuard & Nz::Signal< Args >::ConnectionGuard::operator= ( const Connection &  connection)

Assigns the connection into this.

Returns
A reference to this
Parameters
connectionConnection to assign into this

◆ operator=() [2/3]

template<typename... Args>
Signal< Args... >::ConnectionGuard & Nz::Signal< Args >::ConnectionGuard::operator= ( Connection &&  connection)

Moves the Connection into this.

Returns
A reference to this
Parameters
connectionConnection to move in this

◆ operator=() [3/3]

template<typename... Args>
Signal< Args... >::ConnectionGuard & Nz::Signal< Args >::ConnectionGuard::operator= ( ConnectionGuard &&  connection)
noexcept

Moves the ConnectionGuard into this.

Returns
A reference to this
Parameters
connectionConnectionGuard to move in this

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