impl/value_ref.hpp

95.5% Lines (42/44) 95.0% List of functions (19/21)
f(x) Functions (21)
Function Calls Lines Branches Blocks
<unknown function 20> :20 boost::json::value boost::json::value_ref::from_builtin<bool>(void const*, boost::json::storage_ptr) :20 213x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<decltype(nullptr)>(void const*, boost::json::storage_ptr) :20 55x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<double>(void const*, boost::json::storage_ptr) :20 29x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<float>(void const*, boost::json::storage_ptr) :20 13x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<int>(void const*, boost::json::storage_ptr) :20 7749x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<long long>(void const*, boost::json::storage_ptr) :20 1x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<long>(void const*, boost::json::storage_ptr) :20 1x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<short>(void const*, boost::json::storage_ptr) :20 1x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<signed char>(void const*, boost::json::storage_ptr) :20 0 0.0% 0.0% boost::json::value boost::json::value_ref::from_builtin<unsigned char>(void const*, boost::json::storage_ptr) :20 16x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<unsigned int>(void const*, boost::json::storage_ptr) :20 43x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<unsigned long long>(void const*, boost::json::storage_ptr) :20 1x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<unsigned long>(void const*, boost::json::storage_ptr) :20 1x 100.0% 100.0% boost::json::value boost::json::value_ref::from_builtin<unsigned short>(void const*, boost::json::storage_ptr) :20 1x 100.0% 100.0% boost::json::value boost::json::value_ref::from_const<boost::json::array>(void const*, boost::json::storage_ptr) :27 3x 100.0% 78.0% boost::json::value boost::json::value_ref::from_const<boost::json::object>(void const*, boost::json::storage_ptr) :27 3x 100.0% 78.0% boost::json::value boost::json::value_ref::from_const<boost::json::value>(void const*, boost::json::storage_ptr) :27 3x 100.0% 78.0% boost::json::value boost::json::value_ref::from_rvalue<boost::json::array>(void*, boost::json::storage_ptr) :34 1x 100.0% 80.0% boost::json::value boost::json::value_ref::from_rvalue<boost::json::object>(void*, boost::json::storage_ptr) :34 15x 100.0% 80.0% boost::json::value boost::json::value_ref::from_rvalue<boost::json::value>(void*, boost::json::storage_ptr) :34 4x 100.0% 80.0%
Line TLA Hits Source Code
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_VALUE_REF_HPP
11 #define BOOST_JSON_IMPL_VALUE_REF_HPP
12
13 #include <boost/json/value_from.hpp>
14
15 namespace boost {
16 namespace json {
17
18 template<class T>
19 value
20 8440x value_ref::from_builtin(void const* p, storage_ptr sp) noexcept
21 {
22 8440x return value( *reinterpret_cast<T const*>(p), std::move(sp) );
23 }
24
25 template<class T>
26 value
27 9x value_ref::from_const(void const* p, storage_ptr sp)
28 {
29 9x return value_from( *reinterpret_cast<T const*>(p), std::move(sp) );
30 }
31
32 template<class T>
33 value
34 66x value_ref::from_rvalue(void* p, storage_ptr sp)
35 {
36 66x return value_from( std::move(*reinterpret_cast<T*>(p)), std::move(sp) );
37 }
38
39 } // namespace json
40 } // namespace boost
41
42 #endif
43