Remove make_serializer (API Change):

Actions Required:

* Replace calls to make_serializer with variable declarations
This commit is contained in:
Vinnie Falco
2017-06-22 07:48:05 -07:00
parent 67f595eea8
commit e477574681
8 changed files with 17 additions and 48 deletions

View File

@ -9,6 +9,14 @@ Version 64:
* Doc tidying * Doc tidying
* Add link_directories to cmake * Add link_directories to cmake
API Changes:
* Remove make_serializer
Actions Required:
* Replace calls to make_serializer with variable declarations
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Version 63: Version 63:

View File

@ -29,12 +29,6 @@ This code creates an HTTP response and the corresponding serializer:
[http_snippet_10] [http_snippet_10]
The function
[link beast.ref.beast__http__make_serializer `make_serializer`]
is provided to simplify creation of variables:
[http_snippet_11]
The stream operations which work on serializers are: The stream operations which work on serializers are:
[table Serializer Stream Operations [table Serializer Stream Operations

View File

@ -66,7 +66,6 @@
<member><link linkend="beast.ref.beast__http__async_write_header">async_write_header</link></member> <member><link linkend="beast.ref.beast__http__async_write_header">async_write_header</link></member>
<member><link linkend="beast.ref.beast__http__async_write_some">async_write_some</link></member> <member><link linkend="beast.ref.beast__http__async_write_some">async_write_some</link></member>
<member><link linkend="beast.ref.beast__http__int_to_status">int_to_status</link></member> <member><link linkend="beast.ref.beast__http__int_to_status">int_to_status</link></member>
<member><link linkend="beast.ref.beast__http__make_serializer">make_serializer</link></member>
<member><link linkend="beast.ref.beast__http__obsolete_reason">obsolete_reason</link></member> <member><link linkend="beast.ref.beast__http__obsolete_reason">obsolete_reason</link></member>
<member><link linkend="beast.ref.beast__http__operator_lt__lt_">operator&lt;&lt;</link></member> <member><link linkend="beast.ref.beast__http__operator_lt__lt_">operator&lt;&lt;</link></member>
<member><link linkend="beast.ref.beast__http__read">read</link></member> <member><link linkend="beast.ref.beast__http__read">read</link></member>

View File

@ -65,7 +65,7 @@ send_expect_100_continue(
req.set(field::expect, "100-continue"); req.set(field::expect, "100-continue");
// Create the serializer // Create the serializer
auto sr = make_serializer(req); serializer<true, Body, basic_fields<Allocator>> sr{req};
// Send just the header // Send just the header
write_header(stream, sr, ec); write_header(stream, sr, ec);
@ -214,7 +214,7 @@ send_cgi_response(
// to acquire buffers from the body (which would return // to acquire buffers from the body (which would return
// the error http::need_buffer because we set `data` // the error http::need_buffer because we set `data`
// to `nullptr` above). // to `nullptr` above).
auto sr = make_serializer(res); serializer<false, buffer_body, fields> sr{res};
// Send the header immediately. // Send the header immediately.
write_header(output, sr, ec); write_header(output, sr, ec);

View File

@ -756,7 +756,7 @@ write(SyncWriteStream& stream,
"Body requirements not met"); "Body requirements not met");
static_assert(is_body_reader<Body>::value, static_assert(is_body_reader<Body>::value,
"BodyReader requirements not met"); "BodyReader requirements not met");
auto sr = make_serializer(msg); serializer<isRequest, Body, Fields> sr{msg};
write(stream, sr, ec); write(stream, sr, ec);
} }

View File

@ -53,10 +53,8 @@ struct no_chunk_decorator
/** Provides buffer oriented HTTP message serialization functionality. /** Provides buffer oriented HTTP message serialization functionality.
An object of this type is used to serialize a complete An object of this type is used to serialize a complete
HTTP message into a seriest of octets. To use this class, HTTP message into a sequence of octets. To use this class,
construct an instance with the message to be serialized. construct an instance with the message to be serialized.
To make it easier to declare the type, the helper function
@ref make_serializer is provided.
The implementation will automatically perform chunk encoding The implementation will automatically perform chunk encoding
if the contents of the message indicate that chunk encoding if the contents of the message indicate that chunk encoding
@ -114,11 +112,11 @@ struct no_chunk_decorator
@tparam Fields The type of fields in the message. @tparam Fields The type of fields in the message.
@tparam ChunkDecorator The type of chunk decorator to use. @tparam ChunkDecorator The type of chunk decorator to use.
@see @ref make_serializer
*/ */
template< template<
bool isRequest, class Body, class Fields, bool isRequest,
class Body,
class Fields = fields,
class ChunkDecorator = no_chunk_decorator> class ChunkDecorator = no_chunk_decorator>
class serializer class serializer
{ {
@ -322,27 +320,6 @@ public:
consume(std::size_t n); consume(std::size_t n);
}; };
/** Return a stateful object to serialize an HTTP message.
This convenience function makes it easier to declare
the variable for a given message.
@see @ref serializer
*/
template<
bool isRequest, class Body, class Fields,
class ChunkDecorator = no_chunk_decorator>
inline
serializer<isRequest, Body, Fields,
typename std::decay<ChunkDecorator>::type>
make_serializer(message<isRequest, Body, Fields> const& m,
ChunkDecorator const& decorator = ChunkDecorator{})
{
return serializer<isRequest, Body, Fields,
typename std::decay<ChunkDecorator>::type>{
m, decorator};
}
} // http } // http
} // beast } // beast

View File

@ -128,15 +128,6 @@ void fxx() {
//] //]
} }
{
response<string_body> res;
//[http_snippet_11
auto sr = make_serializer(res);
//]
}
} // fxx() } // fxx()
//[http_snippet_12 //[http_snippet_12

View File

@ -678,7 +678,7 @@ public:
isRequest, Body, Fields> const& m, error_code& ec, isRequest, Body, Fields> const& m, error_code& ec,
Decorator const& decorator = Decorator{}) Decorator const& decorator = Decorator{})
{ {
auto sr = make_serializer(m, decorator); serializer<isRequest, Body, Fields, Decorator> sr{m};
for(;;) for(;;)
{ {
stream.nwrite = 0; stream.nwrite = 0;
@ -700,7 +700,7 @@ public:
error_code& ec, yield_context yield, error_code& ec, yield_context yield,
Decorator const& decorator = Decorator{}) Decorator const& decorator = Decorator{})
{ {
auto sr = make_serializer(m); serializer<isRequest, Body, Fields, Decorator> sr{m};
for(;;) for(;;)
{ {
stream.nwrite = 0; stream.nwrite = 0;