ゴミ箱
empty_body.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/beast
8 //
9 
10 #ifndef BOOST_BEAST_HTTP_EMPTY_BODY_HPP
11 #define BOOST_BEAST_HTTP_EMPTY_BODY_HPP
12 
13 #include <boost/beast/config.hpp>
16 #include <boost/optional.hpp>
17 
18 namespace boost {
19 namespace beast {
20 namespace http {
21 
31 struct empty_body
32 {
38  struct value_type
39  {
40  };
41 
48  static
49  std::uint64_t
51  {
52  return 0;
53  }
54 
59 #if BOOST_BEAST_DOXYGEN
60  using reader = implementation_defined;
61 #else
62  struct reader
63  {
64  using const_buffers_type =
65  boost::asio::null_buffers;
66 
67  template<bool isRequest, class Fields>
68  explicit
69  reader(message<isRequest,
70  empty_body, Fields> const&)
71  {
72  }
73 
74  void
76  {
77  ec.assign(0, ec.category());
78  }
79 
80  boost::optional<std::pair<const_buffers_type, bool>>
81  get(error_code& ec)
82  {
83  ec.assign(0, ec.category());
84  return boost::none;
85  }
86  };
87 #endif
88 
93 #if BOOST_BEAST_DOXYGEN
94  using writer = implementation_defined;
95 #else
96  struct writer
97  {
98  template<bool isRequest, class Fields>
99  explicit
101  {
102  }
103 
104  void
105  init(boost::optional<std::uint64_t> const&, error_code& ec)
106  {
107  ec.assign(0, ec.category());
108  }
109 
110  template<class ConstBufferSequence>
111  std::size_t
113  error_code& ec)
114  {
116  return 0;
117  }
118 
119  void
121  {
122  ec.assign(0, ec.category());
123  }
124  };
125 #endif
126 };
127 
128 } // http
129 } // beast
130 } // boost
131 
132 #endif
BufferSequence< boost::asio::const_buffer > ConstBufferSequence
Definition: type_traits.hpp:280
boost::asio::null_buffers const_buffers_type
Definition: empty_body.hpp:65
Definition: async_result.hpp:20
void init(error_code &ec)
Definition: empty_body.hpp:75
Definition: type_traits.hpp:25
static std::uint64_t size(value_type)
Definition: empty_body.hpp:50
writer(message< isRequest, empty_body, Fields > &)
Definition: empty_body.hpp:100
Definition: empty_body.hpp:38
Definition: beast_common.hpp:6
Definition: empty_body.hpp:96
void init(boost::optional< std::uint64_t > const &, error_code &ec)
Definition: empty_body.hpp:105
boost::system::error_code error_code
The type of error code used by the library.
Definition: error.hpp:21
Definition: empty_body.hpp:31
Definition: empty_body.hpp:62
reader(message< isRequest, empty_body, Fields > const &)
Definition: empty_body.hpp:69
std::size_t put(ConstBufferSequence const &, error_code &ec)
Definition: empty_body.hpp:112
void finish(error_code &ec)
Definition: empty_body.hpp:120