]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
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_IMPL_PARSER_IPP | |
11 | #define BOOST_BEAST_HTTP_IMPL_PARSER_IPP | |
12 | ||
13 | #include <boost/throw_exception.hpp> | |
14 | #include <stdexcept> | |
15 | ||
16 | namespace boost { | |
17 | namespace beast { | |
18 | namespace http { | |
19 | ||
20 | template<bool isRequest, class Body, class Allocator> | |
21 | parser<isRequest, Body, Allocator>:: | |
22 | parser() | |
23 | : wr_(m_) | |
24 | { | |
25 | } | |
26 | ||
27 | template<bool isRequest, class Body, class Allocator> | |
28 | template<class Arg1, class... ArgN, class> | |
29 | parser<isRequest, Body, Allocator>:: | |
30 | parser(Arg1&& arg1, ArgN&&... argn) | |
31 | : m_(std::forward<Arg1>(arg1), | |
32 | std::forward<ArgN>(argn)...) | |
33 | , wr_(m_) | |
34 | { | |
35 | m_.clear(); | |
36 | } | |
37 | ||
38 | template<bool isRequest, class Body, class Allocator> | |
39 | template<class OtherBody, class... Args, class> | |
40 | parser<isRequest, Body, Allocator>:: | |
41 | parser(parser<isRequest, OtherBody, Allocator>&& other, | |
42 | Args&&... args) | |
43 | : base_type(std::move(other)) | |
44 | , m_(other.release(), std::forward<Args>(args)...) | |
45 | , wr_(m_) | |
46 | { | |
47 | if(other.rd_inited_) | |
48 | BOOST_THROW_EXCEPTION(std::invalid_argument{ | |
49 | "moved-from parser has a body"}); | |
50 | } | |
51 | ||
52 | } // http | |
53 | } // beast | |
54 | } // boost | |
55 | ||
56 | #endif |