2 // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com)
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)
7 // Official repository: https://github.com/boostorg/json
10 #ifndef BOOST_JSON_IMPL_STREAM_PARSER_IPP
11 #define BOOST_JSON_IMPL_STREAM_PARSER_IPP
13 #include <boost/json/stream_parser.hpp>
14 #include <boost/json/basic_parser_impl.hpp>
15 #include <boost/json/error.hpp>
25 parse_options const& opt,
26 unsigned char* buffer,
27 std::size_t size) noexcept
40 parse_options const& opt) noexcept
52 reset(storage_ptr sp) noexcept
55 p_.handler().st.reset(sp);
66 true, data, size, ec);
77 std::size_t const result = write_some(data, size, jec);
89 auto const n = write_some(
92 detail::throw_system_error(ec,
93 BOOST_JSON_SOURCE_POS);
104 auto const n = write_some(
108 BOOST_STATIC_CONSTEXPR source_location loc = BOOST_JSON_SOURCE_POS;
109 BOOST_JSON_ASSIGN_ERROR_CODE(ec, error::extra_data, &loc);
123 std::size_t const result = write(data, size, jec);
135 auto const n = write(
138 detail::throw_system_error(ec,
139 BOOST_JSON_SOURCE_POS);
145 finish(error_code& ec)
147 p_.write_some(false, nullptr, 0, ec);
157 detail::throw_system_error(ec,
158 BOOST_JSON_SOURCE_POS);
163 finish(std::error_code& ec)
176 // prevent undefined behavior
179 return p_.handler().st.release();