Better message formal parameter names

fix #476
This commit is contained in:
Vinnie Falco
2017-06-15 11:03:34 -07:00
parent dba4be01ab
commit e5a7ff300f
3 changed files with 72 additions and 61 deletions

View File

@ -11,6 +11,7 @@ Version 58:
* Use static string in basic_fields::reader
* Remove redundant code
* Fix parsing chunk size with leading zeroes
* Better message formal parameter names
API Changes:

View File

@ -192,8 +192,8 @@ swap(
template<bool isRequest, class Body, class Fields>
template<class... Args>
message<isRequest, Body, Fields>::
message(header_type&& base, Args&&... args)
: header_type(std::move(base))
message(header_type&& h, Args&&... args)
: header_type(std::move(h))
, body(std::forward<Args>(args)...)
{
}
@ -201,46 +201,52 @@ message(header_type&& base, Args&&... args)
template<bool isRequest, class Body, class Fields>
template<class... Args>
message<isRequest, Body, Fields>::
message(header_type const& base, Args&&... args)
: header_type(base)
message(header_type const& h, Args&&... args)
: header_type(h)
, body(std::forward<Args>(args)...)
{
}
template<bool isRequest, class Body, class Fields>
template<class U, class>
template<class BodyArg, class>
message<isRequest, Body, Fields>::
message(U&& u)
: body(std::forward<U>(u))
message(BodyArg&& body_arg)
: body(std::forward<BodyArg>(body_arg))
{
}
template<bool isRequest, class Body, class Fields>
template<class U, class V, class>
template<class BodyArg, class HeaderArg, class>
message<isRequest, Body, Fields>::
message(U&& u, V&& v)
: header_type(std::forward<V>(v))
, body(std::forward<U>(u))
message(BodyArg&& body_arg, HeaderArg&& header_arg)
: header_type(std::forward<HeaderArg>(header_arg))
, body(std::forward<BodyArg>(body_arg))
{
}
template<bool isRequest, class Body, class Fields>
template<class... Un>
message<isRequest, Body, Fields>::
message(std::piecewise_construct_t, std::tuple<Un...> un)
: message(std::piecewise_construct, un,
beast::detail::make_index_sequence<sizeof...(Un)>{})
{
}
template<bool isRequest, class Body, class Fields>
template<class... Un, class... Vn>
template<class... BodyArgs>
message<isRequest, Body, Fields>::
message(std::piecewise_construct_t,
std::tuple<Un...>&& un, std::tuple<Vn...>&& vn)
: message(std::piecewise_construct, un, vn,
beast::detail::make_index_sequence<sizeof...(Un)>{},
beast::detail::make_index_sequence<sizeof...(Vn)>{})
std::tuple<BodyArgs...> body_args)
: message(std::piecewise_construct, body_args,
beast::detail::make_index_sequence<
sizeof...(BodyArgs)>{})
{
}
template<bool isRequest, class Body, class Fields>
template<class... BodyArgs, class... HeaderArgs>
message<isRequest, Body, Fields>::
message(std::piecewise_construct_t,
std::tuple<BodyArgs...>&& body_args,
std::tuple<HeaderArgs...>&& header_args)
: message(std::piecewise_construct,
body_args, header_args,
beast::detail::make_index_sequence<
sizeof...(BodyArgs)>{},
beast::detail::make_index_sequence<
sizeof...(HeaderArgs)>{})
{
}

View File

@ -154,14 +154,14 @@ struct header<true, Fields> : Fields
// VFALCO Don't move these declarations around,
// otherwise the documentation will be wrong.
/** Construct the header.
/** Constructor
All arguments are forwarded to the constructor
of the `fields` member.
@param args Arguments forwarded to the `Fields`
base class constructor.
@note This constructor participates in overload resolution
if and only if the first parameter is not convertible to
`header`.
@note This constructor participates in overload
resolution if and only if the first parameter is
not convertible to @ref header.
*/
#if BEAST_DOXYGEN
template<class... Args>
@ -230,14 +230,14 @@ struct header<false, Fields> : Fields
/// Copy assignment
header& operator=(header const&) = default;
/** Construct the header.
/** Constructor
All arguments are forwarded to the constructor
of the `fields` member.
@param args Arguments forwarded to the `Fields`
base class constructor.
@note This constructor participates in overload resolution
if and only if the first parameter is not convertible to
`header`.
@note This constructor participates in overload
resolution if and only if the first parameter is
not convertible to @ref header.
*/
template<class Arg1, class... ArgN,
class = typename std::enable_if<
@ -416,54 +416,58 @@ struct message : header<isRequest, Fields>
/** Construct a message.
@param u An argument forwarded to the body constructor.
@param body_arg An argument forwarded to the body constructor.
@note This constructor participates in overload resolution
only if `u` is not convertible to `header_type`.
only if `body_arg` is not convertible to `header_type`.
*/
template<class U
template<class BodyArg
#if ! BEAST_DOXYGEN
, class = typename std::enable_if<
! std::is_convertible<typename
std::decay<U>::type, header_type>::value>::type
std::decay<BodyArg>::type, header_type>::value>::type
#endif
>
explicit
message(U&& u);
message(BodyArg&& body_arg);
/** Construct a message.
@param u An argument forwarded to the body constructor.
@param body_arg An argument forwarded to the body constructor.
@param v An argument forwarded to the fields constructor.
@param header_arg An argument forwarded to the header constructor.
@note This constructor participates in overload resolution
only if `u` is not convertible to `header_type`.
only if `body_arg` is not convertible to `header_type`.
*/
template<class U, class V
template<class BodyArg, class HeaderArg
#if ! BEAST_DOXYGEN
,class = typename std::enable_if<! std::is_convertible<
typename std::decay<U>::type, header_type>::value>::type
,class = typename std::enable_if<
! std::is_convertible<
typename std::decay<BodyArg>::type,
header_type>::value>::type
#endif
>
message(U&& u, V&& v);
message(BodyArg&& body_arg, HeaderArg&& header_arg);
/** Construct a message.
@param un A tuple forwarded as a parameter pack to the body constructor.
@param body_args A tuple forwarded as a parameter pack to the body constructor.
*/
template<class... Un>
message(std::piecewise_construct_t, std::tuple<Un...> un);
/** Construct a message.
@param un A tuple forwarded as a parameter pack to the body constructor.
@param vn A tuple forwarded as a parameter pack to the fields constructor.
*/
template<class... Un, class... Vn>
template<class... BodyArgs>
message(std::piecewise_construct_t,
std::tuple<Un...>&& un, std::tuple<Vn...>&& vn);
std::tuple<BodyArgs...> body_args);
/** Construct a message.
@param body_args A tuple forwarded as a parameter pack to the body constructor.
@param header_args A tuple forwarded as a parameter pack to the fields constructor.
*/
template<class... BodyArgs, class... HeaderArgs>
message(std::piecewise_construct_t,
std::tuple<BodyArgs...>&& body_args,
std::tuple<HeaderArgs...>&& header_args);
/// Returns `true` if "close" is specified in the Connection field.
bool