From 1b936f59264a4f4a867baece1e0ee4ec02f73cee Mon Sep 17 00:00:00 2001 From: practicalswift Date: Sat, 13 May 2017 17:52:14 +0200 Subject: Replace boost::function with std::function (C++11) --- src/rpc/server.cpp | 8 ++++---- src/rpc/server.h | 12 +++++------- 2 files changed, 9 insertions(+), 11 deletions(-) (limited to 'src/rpc') diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 5c493428d8..0bda331e97 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -42,17 +42,17 @@ static struct CRPCSignals boost::signals2::signal PreCommand; } g_rpcSignals; -void RPCServer::OnStarted(boost::function slot) +void RPCServer::OnStarted(std::function slot) { g_rpcSignals.Started.connect(slot); } -void RPCServer::OnStopped(boost::function slot) +void RPCServer::OnStopped(std::function slot) { g_rpcSignals.Stopped.connect(slot); } -void RPCServer::OnPreCommand(boost::function slot) +void RPCServer::OnPreCommand(std::function slot) { g_rpcSignals.PreCommand.connect(boost::bind(slot, _1)); } @@ -526,7 +526,7 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface) timerInterface = NULL; } -void RPCRunLater(const std::string& name, boost::function func, int64_t nSeconds) +void RPCRunLater(const std::string& name, std::function func, int64_t nSeconds) { if (!timerInterface) throw JSONRPCError(RPC_INTERNAL_ERROR, "No timer handler registered for RPC"); diff --git a/src/rpc/server.h b/src/rpc/server.h index 34a9d3c24c..1e984cbc0d 100644 --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -15,8 +15,6 @@ #include #include -#include - #include static const unsigned int DEFAULT_RPC_SERIALIZE_VERSION = 1; @@ -25,9 +23,9 @@ class CRPCCommand; namespace RPCServer { - void OnStarted(boost::function slot); - void OnStopped(boost::function slot); - void OnPreCommand(boost::function slot); + void OnStarted(std::function slot); + void OnStopped(std::function slot); + void OnPreCommand(std::function slot); } class CBlockIndex; @@ -115,7 +113,7 @@ public: * This is needed to cope with the case in which there is no HTTP server, but * only GUI RPC console, and to break the dependency of pcserver on httprpc. */ - virtual RPCTimerBase* NewTimer(boost::function& func, int64_t millis) = 0; + virtual RPCTimerBase* NewTimer(std::function& func, int64_t millis) = 0; }; /** Set the factory function for timers */ @@ -129,7 +127,7 @@ void RPCUnsetTimerInterface(RPCTimerInterface *iface); * Run func nSeconds from now. * Overrides previous timer (if any). */ -void RPCRunLater(const std::string& name, boost::function func, int64_t nSeconds); +void RPCRunLater(const std::string& name, std::function func, int64_t nSeconds); typedef UniValue(*rpcfn_type)(const JSONRPCRequest& jsonRequest); -- cgit v1.2.3