// // 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 #include namespace boost { namespace beast { namespace http { template parser:: parser() : parser{detail::has_deprecated_body_reader{}} { } template parser:: parser(std::true_type) : rd_(m_) { #ifndef BOOST_BEAST_ALLOW_DEPRECATED // Deprecated BodyReader Concept (v1.66) static_assert(sizeof(Body) == 0, BOOST_BEAST_DEPRECATION_STRING); #endif } template parser:: parser(std::false_type) : rd_(m_.base(), m_.body()) { } template template parser:: parser(Arg1&& arg1, ArgN&&... argn) : parser(std::forward(arg1), detail::has_deprecated_body_reader{}, std::forward(argn)...) { } // VFALCO arg1 comes before `true_type` to make // the signature unambiguous. template template parser:: parser(Arg1&& arg1, std::true_type, ArgN&&... argn) : m_(std::forward(arg1), std::forward(argn)...) , rd_(m_) { m_.clear(); #ifndef BOOST_BEAST_ALLOW_DEPRECATED /* Deprecated BodyWriter Concept (v1.66) */ static_assert(sizeof(Body) == 0, BOOST_BEAST_DEPRECATION_STRING); #endif // BOOST_BEAST_ALLOW_DEPRECATED } // VFALCO arg1 comes before `false_type` to make // the signature unambiguous. template template parser:: parser(Arg1&& arg1, std::false_type, ArgN&&... argn) : m_(std::forward(arg1), std::forward(argn)...) , rd_(m_.base(), m_.body()) { m_.clear(); } template template parser:: parser( parser&& other, Args&&... args) : parser(detail::has_deprecated_body_reader{}, std::move(other), std::forward(args)...) { } template template parser:: parser(std::true_type, parser&& other, Args&&... args) : base_type(std::move(other)) , m_(other.release(), std::forward(args)...) , rd_(m_) { if(other.rd_inited_) BOOST_THROW_EXCEPTION(std::invalid_argument{ "moved-from parser has a body"}); #ifndef BOOST_BEAST_ALLOW_DEPRECATED // Deprecated BodyReader Concept (v1.66) static_assert(sizeof(Body) == 0, BOOST_BEAST_DEPRECATION_STRING); #endif } template template parser:: parser(std::false_type, parser&& other, Args&&... args) : base_type(std::move(other)) , m_(other.release(), std::forward(args)...) , rd_(m_.base(), m_.body()) { if(other.rd_inited_) BOOST_THROW_EXCEPTION(std::invalid_argument{ "moved-from parser has a body"}); } } // http } // beast } // boost #endif