mirror of
https://forgejo.xatacraft.ru/Sunshine/mkxp-sunshine.git
synced 2026-08-19 13:29:54 +00:00
36 lines
847 B
C++
36 lines
847 B
C++
#pragma once
|
|
#include <sigc++/connection.h>
|
|
#include "debugwriter.h"
|
|
|
|
class SignalConnection{
|
|
public:
|
|
SignalConnection() = default;
|
|
SignalConnection(sigc::connection conn)
|
|
: connection(std::move(conn))
|
|
{}
|
|
|
|
void Disconnect()
|
|
{
|
|
if (&connection != nullptr)
|
|
//if (connection.connected())
|
|
connection.disconnect();
|
|
//else
|
|
// Debug() << "Double disconnect!";
|
|
else
|
|
Debug() << "Couldn't disconnect nullptr connection!";
|
|
}
|
|
|
|
bool Connected() const
|
|
{
|
|
if (&connection == nullptr)
|
|
Debug() << "nullptr connection!";
|
|
return false;
|
|
return connection.connected();
|
|
}
|
|
|
|
private:
|
|
sigc::connection connection;
|
|
|
|
template<typename>
|
|
friend class Signal;
|
|
};
|