From 3cf072987805f3b543e47322b105384d7541b1a0 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Sat, 5 Oct 2013 15:38:27 -0700 Subject: [PATCH] Tidy up AbstractHandler usage in HTTPClient --- modules/beast_asio/http/HTTPClientType.cpp | 2 +- modules/beast_asio/http/HTTPClientType.h | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/modules/beast_asio/http/HTTPClientType.cpp b/modules/beast_asio/http/HTTPClientType.cpp index aaee4052a1..6a85eb77f0 100644 --- a/modules/beast_asio/http/HTTPClientType.cpp +++ b/modules/beast_asio/http/HTTPClientType.cpp @@ -68,7 +68,7 @@ public: return result; } - void abstract_async_get (boost::asio::io_service& io_service, URL const& url, + void async_get (boost::asio::io_service& io_service, URL const& url, AbstractHandler handler) { new Session (*this, io_service, url, diff --git a/modules/beast_asio/http/HTTPClientType.h b/modules/beast_asio/http/HTTPClientType.h index e02cb81e71..364b409000 100644 --- a/modules/beast_asio/http/HTTPClientType.h +++ b/modules/beast_asio/http/HTTPClientType.h @@ -45,15 +45,20 @@ public: virtual result_type get (URL const& url) = 0; - template + /** Perform an asynchronous get on the specified URL. + Handler will be called with this signature: + void (result_type) + */ + template void async_get (boost::asio::io_service& io_service, - URL const& url, GetHandler handler) + URL const& url, BEAST_MOVE_ARG(Handler) handler) { - abstract_async_get (io_service, url, - AbstractHandler (handler)); + async_get (io_service, url, + AbstractHandler ( + BEAST_MOVE_CAST(Handler)(handler))); } - virtual void abstract_async_get (boost::asio::io_service& io_service, + virtual void async_get (boost::asio::io_service& io_service, URL const& url, AbstractHandler handler) = 0; /** Cancel all pending asynchronous operations. */