Files
boost_beast/doc/concept/Body.qbk
T

90 lines
2.5 KiB
Plaintext
Raw Normal View History

2016-05-11 08:36:29 -04:00
[/
2017-02-06 20:07:03 -05:00
Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
2016-05-11 08:36:29 -04:00
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
]
2017-06-04 17:25:55 -07:00
[section:Body Body]
2016-09-25 11:19:51 -04:00
A [*Body] type is supplied as a template argument to the __message__ class. It
controls both the type of the data member of the resulting message object, and
the algorithms used during parsing and serialization.
2016-05-11 08:36:29 -04:00
In this table:
2017-05-28 09:05:29 -07:00
* `X` is a type meeting the requirements of [*Body].
2016-05-11 08:36:29 -04:00
2017-06-07 04:36:45 -07:00
* `m` is a value of type `message<b, X, F>` where `b` is a `bool` value
and `F` is a type meeting the requirements of [*Fields].
2016-05-11 08:36:29 -04:00
[table Body requirements
2017-05-28 09:05:29 -07:00
[[expression] [type] [semantics, pre/post-conditions]]
2016-05-11 08:36:29 -04:00
[
[`X::value_type`]
[]
[
The type of the `message::body` member.
If this is not movable or not copyable, the containing message
will be not movable or not copyable.
]
2017-06-07 04:36:45 -07:00
][
2017-02-08 12:24:33 -05:00
[`X::writer`]
2016-05-11 08:36:29 -04:00
[]
[
2017-05-28 09:05:29 -07:00
If present, indicates that the body can hold a message body
parsing result. The type must meet the requirements of
2017-06-04 17:25:55 -07:00
__BodyWriter__. The implementation constructs an object of
this type to obtain buffers into which parsed body octets
are placed.
2017-05-28 09:05:29 -07:00
]
2017-06-07 04:36:45 -07:00
][
2017-05-28 09:05:29 -07:00
[`X::reader`]
[]
[
2017-06-04 17:25:55 -07:00
If present, indicates that the body is serializable. The type
must meet the requirements of __BodyReader__. The implementation
2017-05-28 09:05:29 -07:00
constructs an object of this type to obtain buffers representing
the message body for serialization.
]
2017-06-07 04:36:45 -07:00
][
[`X::size(m)`]
[`std::uint64_t`]
[
If present, returns the serialized size of `m.body` not including
any chunked transfer encoding. When this function is provided,
[link beast.ref.http__message.prepare `message::prepare`]
will automatically set the content length field based on the
value. Otherwise, the chunked transfer encoding will be set.
]
][
2017-05-28 09:05:29 -07:00
[`is_body<X>`]
[`std::true_type`]
[
An alias for `std::true_type` for `X`, otherwise an alias
for `std::false_type`.
2016-05-11 08:36:29 -04:00
]
]
]
2017-06-07 04:36:45 -07:00
Exemplar:
```
struct body
{
using value_type = implementation_defined;
/// The algorithm used for extracting buffers
class reader;
/// The algorithm used for inserting buffers
class writer;
/// Returns the body's payload size
template<bool isRequest, class Fields>
static
std::uint64_t
size(message<isRequest, empty_body, Fields> const& m);
}
```
2016-05-11 08:36:29 -04:00
[endsect]