]>
Commit | Line | Data |
---|---|---|
20effc67 TL |
1 | // |
2 | // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.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/json | |
8 | // | |
9 | ||
10 | #ifndef BOOST_JSON_DETAIL_EXCEPT_HPP | |
11 | #define BOOST_JSON_DETAIL_EXCEPT_HPP | |
12 | ||
13 | #include <boost/json/error.hpp> | |
1e59de90 | 14 | #include <boost/assert/source_location.hpp> |
20effc67 | 15 | #include <boost/exception/diagnostic_information.hpp> |
20effc67 TL |
16 | |
17 | BOOST_JSON_NS_BEGIN | |
18 | namespace detail { | |
19 | ||
1e59de90 TL |
20 | #if defined(BOOST_CURRENT_LOCATION) |
21 | # define BOOST_JSON_SOURCE_POS BOOST_CURRENT_LOCATION | |
20effc67 | 22 | using source_location = boost::source_location; |
1e59de90 | 23 | # define BOOST_JSON_ASSIGN_ERROR_CODE(ec, x, loc) (ec).assign(x, loc); |
20effc67 | 24 | #else |
1e59de90 | 25 | # define BOOST_JSON_SOURCE_POS {} |
20effc67 | 26 | struct source_location{}; |
1e59de90 | 27 | # define BOOST_JSON_ASSIGN_ERROR_CODE(ec, x, loc) (ec).assign(x); |
20effc67 TL |
28 | #endif |
29 | ||
30 | BOOST_JSON_DECL void BOOST_NORETURN throw_bad_alloc(source_location const& loc); | |
31 | BOOST_JSON_DECL void BOOST_NORETURN throw_invalid_argument(char const* what, source_location const& loc); | |
32 | BOOST_JSON_DECL void BOOST_NORETURN throw_length_error(char const* what, source_location const& loc); | |
33 | BOOST_JSON_DECL void BOOST_NORETURN throw_out_of_range(source_location const& loc); | |
34 | BOOST_JSON_DECL void BOOST_NORETURN throw_system_error(error_code const& ec, source_location const& loc); | |
35 | ||
36 | } // detail | |
37 | BOOST_JSON_NS_END | |
38 | ||
39 | #endif |