100.00% Lines (9/9) 100.00% Functions (3/3)
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_DETAIL_ARRAY_HPP 10   #ifndef BOOST_JSON_DETAIL_ARRAY_HPP
11   #define BOOST_JSON_DETAIL_ARRAY_HPP 11   #define BOOST_JSON_DETAIL_ARRAY_HPP
12   12  
13   #include <boost/json/detail/config.hpp> 13   #include <boost/json/detail/config.hpp>
14   #include <boost/json/storage_ptr.hpp> 14   #include <boost/json/storage_ptr.hpp>
15   #include <cstddef> 15   #include <cstddef>
16   16  
17   namespace boost { 17   namespace boost {
18   namespace json { 18   namespace json {
19   19  
20   class value; 20   class value;
21   21  
22   namespace detail { 22   namespace detail {
23   23  
24   class unchecked_array 24   class unchecked_array
25   { 25   {
26   value* data_; 26   value* data_;
27   std::size_t size_; 27   std::size_t size_;
28   storage_ptr const& sp_; 28   storage_ptr const& sp_;
29   29  
30   public: 30   public:
31   inline 31   inline
32   ~unchecked_array(); 32   ~unchecked_array();
33   33  
HITCBC 34   2120 unchecked_array( 34   2120 unchecked_array(
35   value* data, 35   value* data,
36   std::size_t size, 36   std::size_t size,
37   storage_ptr const& sp) noexcept 37   storage_ptr const& sp) noexcept
HITCBC 38   2120 : data_(data) 38   2120 : data_(data)
HITCBC 39   2120 , size_(size) 39   2120 , size_(size)
HITCBC 40   2120 , sp_(sp) 40   2120 , sp_(sp)
41   { 41   {
HITCBC 42   2120 } 42   2120 }
43   43  
44   unchecked_array( 44   unchecked_array(
45   unchecked_array&& other) noexcept 45   unchecked_array&& other) noexcept
46   : data_(other.data_) 46   : data_(other.data_)
47   , size_(other.size_) 47   , size_(other.size_)
48   , sp_(other.sp_) 48   , sp_(other.sp_)
49   { 49   {
50   other.data_ = nullptr; 50   other.data_ = nullptr;
51   } 51   }
52   52  
53   storage_ptr const& 53   storage_ptr const&
HITCBC 54   2120 storage() const noexcept 54   2120 storage() const noexcept
55   { 55   {
HITCBC 56   2120 return sp_; 56   2120 return sp_;
57   } 57   }
58   58  
59   std::size_t 59   std::size_t
HITCBC 60   4684 size() const noexcept 60   4684 size() const noexcept
61   { 61   {
HITCBC 62   4684 return size_; 62   4684 return size_;
63   } 63   }
64   64  
65   inline 65   inline
66   void 66   void
67   relocate(value* dest) noexcept; 67   relocate(value* dest) noexcept;
68   }; 68   };
69   69  
70   } // detail 70   } // detail
71   71  
72   } // namespace json 72   } // namespace json
73   } // namespace boost 73   } // namespace boost
74   74  
75   // includes are at the bottom of <boost/json/value.hpp> 75   // includes are at the bottom of <boost/json/value.hpp>
76   76  
77   #endif 77   #endif