Files
boost_beast/include/beast/http/empty_body.hpp
T

70 lines
1.3 KiB
C++
Raw Normal View History

2016-04-19 20:29:16 -04:00
//
// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
//
// 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)
//
#ifndef BEAST_HTTP_EMPTY_BODY_HPP
#define BEAST_HTTP_EMPTY_BODY_HPP
#include <beast/http/body_type.hpp>
2016-04-19 20:29:16 -04:00
#include <boost/asio/buffer.hpp>
#include <memory>
#include <string>
namespace beast {
namespace http {
/** An empty content-body.
Meets the requirements of @b `Body`.
2016-04-19 20:29:16 -04:00
*/
struct empty_body
{
2016-04-22 19:02:07 -04:00
#if GENERATING_DOCS
/// The type of the `message::body` member
using value_type = void;
#else
struct value_type {};
#endif
#if GENERATING_DOCS
private:
#endif
2016-04-19 20:29:16 -04:00
struct writer
{
template<bool isRequest, class Headers>
2016-04-19 20:29:16 -04:00
explicit
2016-10-15 13:40:17 -04:00
writer(message<isRequest, empty_body, Headers> const& m) noexcept
2016-04-19 20:29:16 -04:00
{
}
void
2016-10-15 13:40:17 -04:00
init(error_code& ec) noexcept
2016-04-19 20:29:16 -04:00
{
}
std::uint64_t
2016-10-15 13:40:17 -04:00
content_length() const noexcept
2016-04-19 20:29:16 -04:00
{
return 0;
}
2016-10-15 13:40:17 -04:00
template<class WriteFunction>
2016-04-19 20:29:16 -04:00
boost::tribool
2016-10-15 13:40:17 -04:00
write(resume_context&&, error_code&,
WriteFunction&& wf) noexcept
2016-04-19 20:29:16 -04:00
{
2016-10-15 13:40:17 -04:00
wf(boost::asio::null_buffers{});
2016-04-19 20:29:16 -04:00
return true;
}
};
};
} // http
} // beast
#endif