Core/Signal: Add default constructor and operators to ConnectionGuard
Former-commit-id: 0080c6bf19cab972945bf978c3d5461ee4228fce
This commit is contained in:
parent
0b14711cbf
commit
991c1af1ca
|
|
@ -66,6 +66,7 @@ class NzSignal<Args...>::Connection
|
|||
friend BaseClass;
|
||||
|
||||
public:
|
||||
Connection() = default;
|
||||
Connection(const Connection& connection) = default;
|
||||
Connection(Connection&& connection) = default;
|
||||
~Connection() = default;
|
||||
|
|
@ -90,14 +91,19 @@ class NzSignal<Args...>::ConnectionGuard
|
|||
using Connection = BaseClass::Connection;
|
||||
|
||||
public:
|
||||
ConnectionGuard() = default;
|
||||
ConnectionGuard(const Connection& connection);
|
||||
ConnectionGuard(const ConnectionGuard& connection) = delete;
|
||||
ConnectionGuard(Connection&& connection);
|
||||
ConnectionGuard(ConnectionGuard&& connection) = default;
|
||||
~ConnectionGuard();
|
||||
|
||||
Connection& GetConnection();
|
||||
|
||||
Connection& operator=(const Connection& connection) = delete;
|
||||
Connection& operator=(Connection&& connection) = delete;
|
||||
ConnectionGuard& operator=(const Connection& connection);
|
||||
ConnectionGuard& operator=(const ConnectionGuard& connection) = delete;
|
||||
ConnectionGuard& operator=(Connection&& connection);
|
||||
ConnectionGuard& operator=(ConnectionGuard&& connection);
|
||||
|
||||
private:
|
||||
Connection m_connection;
|
||||
|
|
|
|||
|
|
@ -138,4 +138,31 @@ typename NzSignal<Args...>::Connection& NzSignal<Args...>::ConnectionGuard::GetC
|
|||
return m_connection;
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
typename NzSignal<Args...>::ConnectionGuard& NzSignal<Args...>::ConnectionGuard::operator=(const Connection& connection)
|
||||
{
|
||||
m_connection.Disconnect();
|
||||
m_connection = connection;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
typename NzSignal<Args...>::ConnectionGuard& NzSignal<Args...>::ConnectionGuard::operator=(Connection&& connection)
|
||||
{
|
||||
m_connection.Disconnect();
|
||||
m_connection = std::move(connection);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename... Args>
|
||||
typename NzSignal<Args...>::ConnectionGuard& NzSignal<Args...>::ConnectionGuard::operator=(ConnectionGuard&& connection)
|
||||
{
|
||||
m_connection.Disconnect();
|
||||
m_connection = std::move(connection.m_connection);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
#include <Nazara/Core/DebugOff.hpp>
|
||||
|
|
|
|||
Loading…
Reference in New Issue