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