forked from boostorg/beast
Body::reader and Body::writer meanings are reversed, for consistency with the names of the stream operations: * Body::reader is used for read, read_some, async_read, async_read_some * Body::writer is used for write, write_some, async_write, async_write_some Actions Required: * Swap the reader and writer names for user defined Body types * Swap use of is_body_reader and is_body_writer
57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
//
|
|
// Copyright (c) 2016-2017 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)
|
|
//
|
|
// Official repository: https://github.com/boostorg/beast
|
|
//
|
|
|
|
#ifndef BOOST_BEAST_HTTP_IMPL_PARSER_IPP
|
|
#define BOOST_BEAST_HTTP_IMPL_PARSER_IPP
|
|
|
|
#include <boost/throw_exception.hpp>
|
|
#include <stdexcept>
|
|
|
|
namespace boost {
|
|
namespace beast {
|
|
namespace http {
|
|
|
|
template<bool isRequest, class Body, class Allocator>
|
|
parser<isRequest, Body, Allocator>::
|
|
parser()
|
|
: wr_(m_)
|
|
{
|
|
}
|
|
|
|
template<bool isRequest, class Body, class Allocator>
|
|
template<class Arg1, class... ArgN, class>
|
|
parser<isRequest, Body, Allocator>::
|
|
parser(Arg1&& arg1, ArgN&&... argn)
|
|
: m_(std::forward<Arg1>(arg1),
|
|
std::forward<ArgN>(argn)...)
|
|
, wr_(m_)
|
|
{
|
|
m_.clear();
|
|
}
|
|
|
|
template<bool isRequest, class Body, class Allocator>
|
|
template<class OtherBody, class... Args, class>
|
|
parser<isRequest, Body, Allocator>::
|
|
parser(parser<isRequest, OtherBody, Allocator>&& other,
|
|
Args&&... args)
|
|
: base_type(std::move(other))
|
|
, m_(other.release(), std::forward<Args>(args)...)
|
|
, wr_(m_)
|
|
{
|
|
if(other.rd_inited_)
|
|
BOOST_THROW_EXCEPTION(std::invalid_argument{
|
|
"moved-from parser has a body"});
|
|
}
|
|
|
|
} // http
|
|
} // beast
|
|
} // boost
|
|
|
|
#endif
|