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 * Use static string in basic_fields::reader
* Remove redundant code * Remove redundant code
* Fix parsing chunk size with leading zeroes * Fix parsing chunk size with leading zeroes
* Better message formal parameter names
API Changes: API Changes:

View File

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