Changeset View
Changeset View
Standalone View
Standalone View
src/interfaces/handler.cpp
- This file was moved from src/interface/handler.cpp.
// Copyright (c) 2018 The Bitcoin Core developers | // Copyright (c) 2018 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <interface/handler.h> | #include <interfaces/handler.h> | ||||
#include <util.h> | #include <util.h> | ||||
#include <boost/signals2/connection.hpp> | #include <boost/signals2/connection.hpp> | ||||
#include <memory> | #include <memory> | ||||
#include <utility> | #include <utility> | ||||
namespace interface { | namespace interfaces { | ||||
namespace { | namespace { | ||||
class HandlerImpl : public Handler { | class HandlerImpl : public Handler { | ||||
public: | public: | ||||
HandlerImpl(boost::signals2::connection connection) | HandlerImpl(boost::signals2::connection connection) | ||||
: m_connection(std::move(connection)) {} | : m_connection(std::move(connection)) {} | ||||
void disconnect() override { m_connection.disconnect(); } | void disconnect() override { m_connection.disconnect(); } | ||||
boost::signals2::scoped_connection m_connection; | boost::signals2::scoped_connection m_connection; | ||||
}; | }; | ||||
} // namespace | } // namespace | ||||
std::unique_ptr<Handler> MakeHandler(boost::signals2::connection connection) { | std::unique_ptr<Handler> MakeHandler(boost::signals2::connection connection) { | ||||
return std::make_unique<HandlerImpl>(std::move(connection)); | return std::make_unique<HandlerImpl>(std::move(connection)); | ||||
} | } | ||||
} // namespace interface | } // namespace interfaces |