/src/boost/boost/json/detail/array.hpp
Line | Count | Source |
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 | | unchecked_array( |
35 | | value* data, |
36 | | std::size_t size, |
37 | | storage_ptr const& sp) noexcept |
38 | 28.6k | : data_(data) |
39 | 28.6k | , size_(size) |
40 | 28.6k | , sp_(sp) |
41 | 28.6k | { |
42 | 28.6k | } |
43 | | |
44 | | unchecked_array( |
45 | | unchecked_array&& other) noexcept |
46 | | : data_(other.data_) |
47 | | , size_(other.size_) |
48 | | , sp_(other.sp_) |
49 | 0 | { |
50 | 0 | other.data_ = nullptr; |
51 | 0 | } |
52 | | |
53 | | storage_ptr const& |
54 | | storage() const noexcept |
55 | 28.6k | { |
56 | 28.6k | return sp_; |
57 | 28.6k | } |
58 | | |
59 | | std::size_t |
60 | | size() const noexcept |
61 | 68.6k | { |
62 | 68.6k | return size_; |
63 | 68.6k | } |
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 |