Clean up rvalues in arguments and call sites

This commit is contained in:
Vinnie Falco
2013-08-08 00:21:59 -07:00
parent 01af51308e
commit 5171a00569
3 changed files with 78 additions and 63 deletions

View File

@@ -158,8 +158,7 @@ public:
return read_some (MutableBuffers (buffers), ec);
}
virtual std::size_t read_some (BOOST_ASIO_MOVE_ARG(MutableBuffers) buffers,
boost::system::error_code& ec) = 0;
virtual std::size_t read_some (MutableBuffers const& buffers, boost::system::error_code& ec) = 0;
// SyncWriteStream
//
@@ -171,7 +170,7 @@ public:
return write_some (BOOST_ASIO_MOVE_CAST(ConstBuffers)(ConstBuffers (buffers)), ec);
}
virtual std::size_t write_some (BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, boost::system::error_code& ec) = 0;
virtual std::size_t write_some (ConstBuffers const& buffers, boost::system::error_code& ec) = 0;
// AsyncReadStream
//
@@ -181,13 +180,13 @@ public:
BOOST_ASIO_INITFN_RESULT_TYPE(ReadHandler, void (boost::system::error_code, std::size_t))
async_read_some (MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler)
{
return async_read_some (BOOST_ASIO_MOVE_CAST(MutableBuffers)(MutableBuffers (buffers)),
BOOST_ASIO_MOVE_CAST(TransferCall)(TransferCall(handler)));
return async_read_some (MutableBuffers (buffers),
TransferCall (BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)));
}
virtual
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
async_read_some (BOOST_ASIO_MOVE_ARG(MutableBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call) = 0;
async_read_some (MutableBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler) = 0;
// AsyncWriteStream
//
@@ -197,13 +196,13 @@ public:
BOOST_ASIO_INITFN_RESULT_TYPE(WriteHandler, void (boost::system::error_code, std::size_t))
async_write_some (ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler)
{
return async_write_some (BOOST_ASIO_MOVE_CAST(ConstBuffers)(ConstBuffers (buffers)),
BOOST_ASIO_MOVE_CAST(TransferCall)(TransferCall(handler)));
return async_write_some (ConstBuffers (buffers),
TransferCall(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)));
}
virtual
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
async_write_some (BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call) = 0;
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler) = 0;
//--------------------------------------------------------------------------
//
@@ -214,16 +213,16 @@ public:
// ssl::stream::handshake (1 of 4)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload1.html
//
void handshake (handshake_type role)
void handshake (handshake_type type)
{
boost::system::error_code ec;
throw_error (handshake (role, ec));
throw_error (handshake (type, ec));
}
// ssl::stream::handshake (2 of 4)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload2.html
//
virtual boost::system::error_code handshake (handshake_type role,
virtual boost::system::error_code handshake (handshake_type type,
boost::system::error_code& ec) = 0;
// ssl::stream::async_handshake (1 of 2)
@@ -231,56 +230,62 @@ public:
//
template <typename HandshakeHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(HandshakeHandler, void (boost::system::error_code))
async_handshake (handshake_type role, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler)
{
return async_handshake (role, BOOST_ASIO_MOVE_CAST(ErrorCall)(ErrorCall (handler)));
return async_handshake (type,
ErrorCall (BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler)));
}
virtual
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
async_handshake (handshake_type role, BOOST_ASIO_MOVE_ARG(ErrorCall) call) = 0;
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ErrorCall) handler) = 0;
//--------------------------------------------------------------------------
#if BOOST_ASIO_HAS_BUFFEREDHANDSHAKE
// ssl::stream::handshake (3 of 4)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload3.html
//
template <class ConstBufferSequence>
void handshake (handshake_type role, ConstBufferSequence const& buffers)
void handshake (handshake_type type, ConstBufferSequence const& buffers)
{
boost::system::error_code ec;
throw_error (handshake (role, buffers, ec));
throw_error (handshake (type, buffers, ec));
}
// ssl::stream::handshake (4 of 4)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/handshake/overload4.html
//
template <class ConstBufferSequence>
boost::system::error_code handshake (handshake_type role,
boost::system::error_code handshake (handshake_type type,
ConstBufferSequence const& buffers, boost::system::error_code& ec)
{
return handshake (role, BOOST_ASIO_MOVE_CAST(ConstBuffers)(ConstBuffers (buffers)), ec);
return handshake (type, ConstBuffers (buffers), ec);
}
virtual boost::system::error_code handshake (handshake_type role,
BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, boost::system::error_code& ec) = 0;
virtual boost::system::error_code handshake (handshake_type type,
ConstBuffers const& buffers, boost::system::error_code& ec) = 0;
// ssl::stream::async_handshake (2 of 2)
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/async_handshake/overload2.html
//
template <class ConstBufferSequence, class BufferedHandshakeHandler>
BOOST_ASIO_INITFN_RESULT_TYPE(BufferedHandshakeHandler, void (boost::system::error_code, std::size_t))
async_handshake (handshake_type role, ConstBufferSequence const& buffers,
async_handshake (handshake_type type, ConstBufferSequence const& buffers,
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler)
{
return async_handshake (role, BOOST_ASIO_MOVE_CAST(ConstBuffers)(ConstBuffers (buffers)),
BOOST_ASIO_MOVE_CAST(TransferCall)(TransferCall (handler)));
return async_handshake (type, ConstBuffers (buffers),
TransferCall (BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler)));
}
virtual
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
async_handshake (handshake_type role, BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call) = 0;
async_handshake (handshake_type type, ConstBuffers const& buffers,
BOOST_ASIO_MOVE_ARG(TransferCall) handler) = 0;
#endif
//--------------------------------------------------------------------------
// ssl::stream::shutdown
// http://www.boost.org/doc/libs/1_54_0/doc/html/boost_asio/reference/ssl__stream/shutdown.html
//
@@ -298,12 +303,12 @@ public:
template <class ShutdownHandler>
void async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler)
{
return async_shutdown (BOOST_ASIO_MOVE_CAST(ErrorCall)(ErrorCall (handler)));
return async_shutdown (ErrorCall (BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler)));
}
virtual
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) call) = 0;
async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) handler) = 0;
};
#endif

View File

@@ -127,8 +127,7 @@ protected:
template <class Handler>
CompletionCall (BOOST_ASIO_MOVE_ARG(Handler) handler)
: m_call (new CallType <Handler> (
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
: m_call (new CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler)))
{
}
@@ -189,8 +188,7 @@ protected:
template <class Handler>
ErrorCall (BOOST_ASIO_MOVE_ARG(Handler) handler)
: m_call (new CallType <Handler> (
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
: m_call (new CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler)))
{
}
@@ -248,8 +246,7 @@ protected:
template <class Handler>
TransferCall (BOOST_ASIO_MOVE_ARG(Handler) handler)
: m_call (new CallType <Handler> (
BOOST_ASIO_MOVE_CAST(Handler)(handler)))
: m_call (new CallType <Handler> (BOOST_ASIO_MOVE_CAST(Handler)(handler)))
{
}

View File

@@ -182,8 +182,7 @@ private:
//--------------------------------------------------------------------------
public:
std::size_t read_some (BOOST_ASIO_MOVE_ARG(MutableBuffers) buffers,
boost::system::error_code& ec)
std::size_t read_some (MutableBuffers const& buffers, boost::system::error_code& ec)
{
return read_some (buffers, ec,
HasInterface <ObjectT, SocketInterface::SyncStream> ());
@@ -206,7 +205,7 @@ private:
}
public:
std::size_t write_some (BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, boost::system::error_code& ec)
std::size_t write_some (ConstBuffers const& buffers, boost::system::error_code& ec)
{
return write_some (buffers, ec,
HasInterface <ObjectT, SocketInterface::SyncStream> ());
@@ -230,9 +229,9 @@ private:
public:
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
async_read_some (BOOST_ASIO_MOVE_ARG(MutableBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call)
async_read_some (MutableBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler)
{
return async_read_some (buffers, call,
return async_read_some (buffers, BOOST_ASIO_MOVE_CAST(TransferCall)(handler),
HasInterface <ObjectT, SocketInterface::AsyncStream> ());
}
@@ -242,7 +241,8 @@ private:
async_read_some (MutableBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(ReadHandler) handler,
boost::true_type)
{
return get_object ().async_read_some (buffers, handler);
return get_object ().async_read_some (buffers,
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
}
template <typename MutableBufferSequence, typename ReadHandler>
@@ -256,20 +256,20 @@ private:
BOOST_ASIO_MOVE_CAST(ReadHandler)(handler));
system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec, 0));
get_io_service ().post (boost::bind (BOOST_ASIO_MOVE_CAST(ReadHandler)(handler), ec, 0));
return init.result.get();
#else
boost::system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec, 0));
get_io_service ().post (boost::bind (BOOST_ASIO_MOVE_CAST(ReadHandler)(handler), ec, 0));
#endif
}
public:
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
async_write_some (BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, BOOST_ASIO_MOVE_ARG(TransferCall) call)
async_write_some (ConstBuffers const& buffers, BOOST_ASIO_MOVE_ARG(TransferCall) handler)
{
return async_write_some (buffers, call,
return async_write_some (buffers, BOOST_ASIO_MOVE_CAST(TransferCall)(handler),
HasInterface <ObjectT, SocketInterface::AsyncStream> ());
}
@@ -279,7 +279,8 @@ private:
async_write_some (ConstBufferSequence const& buffers, BOOST_ASIO_MOVE_ARG(WriteHandler) handler,
boost::true_type)
{
return get_object ().async_write_some (buffers, handler);
return get_object ().async_write_some (buffers,
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
}
template <typename ConstBufferSequence, typename WriteHandler>
@@ -293,12 +294,14 @@ private:
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler));
system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec, 0));
get_io_service ().post (boost::bind (
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler), ec, 0));
return init.result.get();
#else
boost::system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec, 0));
get_io_service ().post (boost::bind (
BOOST_ASIO_MOVE_CAST(WriteHandler)(handler), ec, 0));
#endif
}
@@ -330,9 +333,9 @@ private:
public:
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(ErrorCall, void (boost::system::error_code))
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ErrorCall) call)
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
{
return async_handshake (type, call,
return async_handshake (type, BOOST_ASIO_MOVE_CAST(ErrorCall)(handler),
HasInterface <ObjectT, SocketInterface::AsyncHandshake> ());
}
@@ -342,7 +345,8 @@ private:
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(HandshakeHandler) handler,
boost::true_type)
{
return get_object ().async_handshake (type, handler);
return get_object ().async_handshake (type,
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
}
template <typename HandshakeHandler>
@@ -356,19 +360,21 @@ private:
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler));
system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec));
get_io_service ().post (boost::bind (
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler), ec));
return init.result.get();
#else
boost::system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec));
get_io_service ().post (boost::bind (
BOOST_ASIO_MOVE_CAST(HandshakeHandler)(handler), ec));
#endif
}
public:
#if BOOST_ASIO_HAS_BUFFEREDHANDSHAKE
boost::system::error_code handshake (handshake_type type,
BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers, boost::system::error_code& ec)
ConstBuffers const& buffers, boost::system::error_code& ec)
{
return handshake (type, buffers, ec,
HasInterface <ObjectT, SocketInterface::SyncBufferedHandshake> ());
@@ -393,10 +399,11 @@ private:
public:
BOOST_ASIO_INITFN_RESULT_TYPE_MEMBER(TransferCall, void (boost::system::error_code, std::size_t))
async_handshake (handshake_type type, BOOST_ASIO_MOVE_ARG(ConstBuffers) buffers,
BOOST_ASIO_MOVE_ARG(TransferCall) call)
async_handshake (handshake_type type, ConstBuffers const& buffers,
BOOST_ASIO_MOVE_ARG(TransferCall) handler)
{
return async_handshake (type, buffers, call,
return async_handshake (type, buffers,
BOOST_ASIO_MOVE_CAST(TransferCall)(handler),
HasInterface <ObjectT, SocketInterface::AsyncBufferedHandshake> ());
}
@@ -407,7 +414,8 @@ private:
BOOST_ASIO_MOVE_ARG(BufferedHandshakeHandler) handler,
boost::true_type)
{
return get_object ().async_handshake (type, buffers, handler);
return get_object ().async_handshake (type, buffers,
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler));
}
template <typename ConstBufferSequence, typename BufferedHandshakeHandler>
@@ -422,12 +430,14 @@ private:
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler));
boost::system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec, 0));
get_io_service ().post (boost::bind (
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler), ec, 0));
return init.result.get();
#else
boost::system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec, 0));
get_io_service ().post (boost::bind (
BOOST_ASIO_MOVE_CAST(BufferedHandshakeHandler)(handler), ec, 0));
#endif
}
#endif
@@ -453,9 +463,9 @@ private:
}
public:
void async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) call)
void async_shutdown (BOOST_ASIO_MOVE_ARG(ErrorCall) handler)
{
async_shutdown (call,
async_shutdown (BOOST_ASIO_MOVE_CAST(ErrorCall)(handler),
HasInterface <ObjectT, SocketInterface::AsyncHandshake> ());
}
@@ -465,7 +475,8 @@ private:
async_shutdown (BOOST_ASIO_MOVE_ARG(ShutdownHandler) handler,
boost::true_type)
{
return get_object ().async_shutdown (handler);
return get_object ().async_shutdown (
BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler));
}
template <typename ShutdownHandler>
@@ -479,12 +490,14 @@ private:
BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler));
system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec));
get_io_service ().post (boost::bind (
BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler), ec));
return init.result.get();
#else
boost::system::error_code ec;
ec = pure_virtual (ec);
get_io_service ().post (boost::bind (handler, ec));
get_io_service ().post (boost::bind (
BOOST_ASIO_MOVE_CAST(ShutdownHandler)(handler), ec));
#endif
}