parser requires basic_fields (API Change):

* `parser` is now templated on Allocator

* `parser` only produces messages using `basic_fields<Allocator>`
  as the Fields type.

* message-oriented read and async_read only work on messages
  using basic_fields as the Fields type.

Actions Required:

* Callers using `parser` with Fields types other than basic_fields
  will need to create their own subclass of basic_parser to work
  with their custom fields type.
This commit is contained in:
Vinnie Falco
2017-06-19 11:54:53 -07:00
parent 72ce21927c
commit 50902c3938
7 changed files with 68 additions and 52 deletions

View File

@@ -464,7 +464,6 @@ do_head_request(
*/
template<
bool isRequest,
class Fields = fields,
class SyncWriteStream,
class SyncReadStream,
class DynamicBuffer,
@@ -487,10 +486,10 @@ relay(
char buf[2048];
// Create a parser with a buffer body to read from the input.
parser<isRequest, buffer_body, Fields> p;
parser<isRequest, buffer_body> p;
// Create a serializer from the message contained in the parser.
serializer<isRequest, buffer_body, Fields> sr{p.get()};
serializer<isRequest, buffer_body, fields> sr{p.get()};
// Read just the header from the input
read_header(input, buffer, p, ec);
@@ -684,13 +683,12 @@ write_ostream(
template<
class Allocator,
bool isRequest,
class Body,
class Fields>
class Body>
void
read_istream(
std::istream& is,
basic_flat_buffer<Allocator>& buffer,
message<isRequest, Body, Fields>& msg,
message<isRequest, Body, fields>& msg,
error_code& ec)
{
// Create the message parser
@@ -700,7 +698,7 @@ read_istream(
// a move construction in case the caller has constructed
// their message in a non-default way.
//
parser<isRequest, Body, Fields> p{std::move(msg)};
parser<isRequest, Body> p{std::move(msg)};
do
{