CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::EventConnection Class Referencefinal

Scoped connection class. More...

#include <CeresEngine/Foundation/Event.hpp>

Public Member Functions

 EventConnection () noexcept=default
 Scoped are default constructible.
 
 EventConnection (EventConnection const &)=delete
 Scoped connections are not copy constructible.
 
EventConnectionoperator= (EventConnection const &)=delete
 Scoped connections are not copy assingable.
 
 EventConnection (EventConnection &&other) noexcept
 Move constructor.
 
EventConnectionoperator= (EventConnection &&other) noexcept
 Move assign operator.
 
 EventConnection (WeakEventConnection &&c) noexcept
 Construct a scoped connection from a connection object.
 
 ~EventConnection ()
 destructor
 
EventConnectionoperator= (WeakEventConnection &&c)
 Assignment operator moving a new connection into the instance.
 
void reset (WeakEventConnection &&c={})
 Reset the underlying connection to another connection.
 
WeakEventConnection release () noexcept
 Release the underlying connection, without disconnecting it.
 
bool connected () const noexcept
 
void disconnect ()
 Disconnect the slot from the connection.
 

Private Attributes

WeakEventConnection connection
 Underlying connection object.
 

Detailed Description

Scoped connection class.

This type of connection is automatically disconnected when the connection object is destructed.

Constructor & Destructor Documentation

◆ EventConnection() [1/4]

CeresEngine::EventConnection::EventConnection ( )
defaultnoexcept

Scoped are default constructible.

◆ EventConnection() [2/4]

CeresEngine::EventConnection::EventConnection ( EventConnection const )
delete

Scoped connections are not copy constructible.

◆ EventConnection() [3/4]

CeresEngine::EventConnection::EventConnection ( EventConnection &&  other)
inlinenoexcept

Move constructor.

◆ EventConnection() [4/4]

CeresEngine::EventConnection::EventConnection ( WeakEventConnection &&  c)
inlinenoexcept

Construct a scoped connection from a connection object.

Parameters
cThe connection object to manage

◆ ~EventConnection()

CeresEngine::EventConnection::~EventConnection ( )
inline

destructor

Member Function Documentation

◆ connected()

bool CeresEngine::EventConnection::connected ( ) const
inlinenoexcept
Returns
true if the connection is connected to a event object, and false otherwise.

◆ disconnect()

void CeresEngine::EventConnection::disconnect ( )
inline

Disconnect the slot from the connection.

If the connection represents a slot that is connected to a event object, calling this method will disconnect the slot from that object. The result of this operation is that the slot will stop receiving calls when the event is invoked.

◆ operator=() [1/3]

EventConnection & CeresEngine::EventConnection::operator= ( EventConnection &&  other)
inlinenoexcept

Move assign operator.

Parameters
otherThe instance to move from.

◆ operator=() [2/3]

EventConnection & CeresEngine::EventConnection::operator= ( EventConnection const )
delete

Scoped connections are not copy assingable.

◆ operator=() [3/3]

EventConnection & CeresEngine::EventConnection::operator= ( WeakEventConnection &&  c)
inline

Assignment operator moving a new connection into the instance.

Note
If the ScopedSonnection instance already contains a connection, that connection will be disconnected as if the ScopedSonnection was destroyed.
Parameters
cNew connection to manage

◆ release()

WeakEventConnection CeresEngine::EventConnection::release ( )
inlinenoexcept

Release the underlying connection, without disconnecting it.

Returns
The newly released connection instance is returned.

◆ reset()

void CeresEngine::EventConnection::reset ( WeakEventConnection &&  c = {})
inline

Reset the underlying connection to another connection.

Note
The connection currently managed by the ScopedSonnection instance will be disconnected when resetting.
Parameters
cNew connection to manage

Member Data Documentation

◆ connection

WeakEventConnection CeresEngine::EventConnection::connection
private

Underlying connection object.


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