/src/boost/boost/json/impl/kind.ipp
Line | Count | Source (jump to first uncovered line) |
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_IMPL_KIND_IPP |
11 | | #define BOOST_JSON_IMPL_KIND_IPP |
12 | | |
13 | | #include <boost/json/kind.hpp> |
14 | | #include <ostream> |
15 | | |
16 | | namespace boost { |
17 | | namespace json { |
18 | | |
19 | | string_view |
20 | | to_string(kind k) noexcept |
21 | 0 | { |
22 | 0 | switch(k) |
23 | 0 | { |
24 | 0 | case kind::array: return "array"; |
25 | 0 | case kind::object: return "object"; |
26 | 0 | case kind::string: return "string"; |
27 | 0 | case kind::int64: return "int64"; |
28 | 0 | case kind::uint64: return "uint64"; |
29 | 0 | case kind::double_: return "double"; |
30 | 0 | case kind::bool_: return "bool"; |
31 | 0 | default: // satisfy warnings |
32 | 0 | case kind::null: return "null"; |
33 | 0 | } |
34 | 0 | } |
35 | | |
36 | | std::ostream& |
37 | | operator<<(std::ostream& os, kind k) |
38 | 0 | { |
39 | 0 | os << to_string(k); |
40 | 0 | return os; |
41 | 0 | } |
42 | | |
43 | | } // namespace json |
44 | | } // namespace boost |
45 | | |
46 | | #endif |