100.00% Lines (14/14)
100.00% Functions (2/2)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) | 2 | // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) | |||||
| 3 | // | 3 | // | |||||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 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) | 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 6 | // | 6 | // | |||||
| 7 | // Official repository: https://github.com/boostorg/json | 7 | // Official repository: https://github.com/boostorg/json | |||||
| 8 | // | 8 | // | |||||
| 9 | 9 | |||||||
| 10 | #ifndef BOOST_JSON_IMPL_KIND_IPP | 10 | #ifndef BOOST_JSON_IMPL_KIND_IPP | |||||
| 11 | #define BOOST_JSON_IMPL_KIND_IPP | 11 | #define BOOST_JSON_IMPL_KIND_IPP | |||||
| 12 | 12 | |||||||
| 13 | #include <boost/json/kind.hpp> | 13 | #include <boost/json/kind.hpp> | |||||
| 14 | #include <ostream> | 14 | #include <ostream> | |||||
| 15 | 15 | |||||||
| 16 | namespace boost { | 16 | namespace boost { | |||||
| 17 | namespace json { | 17 | namespace json { | |||||
| 18 | 18 | |||||||
| 19 | string_view | 19 | string_view | |||||
| HITCBC | 20 | 16 | to_string(kind k) noexcept | 20 | 16 | to_string(kind k) noexcept | ||
| 21 | { | 21 | { | |||||
| HITCBC | 22 | 16 | switch(k) | 22 | 16 | switch(k) | ||
| 23 | { | 23 | { | |||||
| HITCBC | 24 | 2 | case kind::array: return "array"; | 24 | 2 | case kind::array: return "array"; | ||
| HITCBC | 25 | 2 | case kind::object: return "object"; | 25 | 2 | case kind::object: return "object"; | ||
| HITCBC | 26 | 2 | case kind::string: return "string"; | 26 | 2 | case kind::string: return "string"; | ||
| HITCBC | 27 | 2 | case kind::int64: return "int64"; | 27 | 2 | case kind::int64: return "int64"; | ||
| HITCBC | 28 | 2 | case kind::uint64: return "uint64"; | 28 | 2 | case kind::uint64: return "uint64"; | ||
| HITCBC | 29 | 2 | case kind::double_: return "double"; | 29 | 2 | case kind::double_: return "double"; | ||
| HITCBC | 30 | 2 | case kind::bool_: return "bool"; | 30 | 2 | case kind::bool_: return "bool"; | ||
| HITCBC | 31 | 2 | default: // satisfy warnings | 31 | 2 | default: // satisfy warnings | ||
| HITCBC | 32 | 2 | case kind::null: return "null"; | 32 | 2 | case kind::null: return "null"; | ||
| 33 | } | 33 | } | |||||
| 34 | } | 34 | } | |||||
| 35 | 35 | |||||||
| 36 | std::ostream& | 36 | std::ostream& | |||||
| HITCBC | 37 | 8 | operator<<(std::ostream& os, kind k) | 37 | 8 | operator<<(std::ostream& os, kind k) | ||
| 38 | { | 38 | { | |||||
| HITCBC | 39 | 8 | os << to_string(k); | 39 | 8 | os << to_string(k); | ||
| HITCBC | 40 | 8 | return os; | 40 | 8 | return os; | ||
| 41 | } | 41 | } | |||||
| 42 | 42 | |||||||
| 43 | } // namespace json | 43 | } // namespace json | |||||
| 44 | } // namespace boost | 44 | } // namespace boost | |||||
| 45 | 45 | |||||||
| 46 | #endif | 46 | #endif | |||||