Tidy up AbstractHandler usage in HTTPClient

This commit is contained in:
Vinnie Falco
2013-10-05 15:38:27 -07:00
parent 55171f42f6
commit 3cf0729878
2 changed files with 11 additions and 6 deletions

View File

@@ -68,7 +68,7 @@ public:
return result; 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 <void (result_type)> handler) AbstractHandler <void (result_type)> handler)
{ {
new Session (*this, io_service, url, new Session (*this, io_service, url,

View File

@@ -45,15 +45,20 @@ public:
virtual result_type get (URL const& url) = 0; virtual result_type get (URL const& url) = 0;
template <typename GetHandler> /** Perform an asynchronous get on the specified URL.
Handler will be called with this signature:
void (result_type)
*/
template <typename Handler>
void async_get (boost::asio::io_service& io_service, 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, async_get (io_service, url,
AbstractHandler <void (result_type)> (handler)); AbstractHandler <void (result_type)> (
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 <void (result_type)> handler) = 0; URL const& url, AbstractHandler <void (result_type)> handler) = 0;
/** Cancel all pending asynchronous operations. */ /** Cancel all pending asynchronous operations. */