LCOV - code coverage report
Current view: top level - json/detail - object.hpp (source / functions) Coverage Total Hit
Test: coverage_remapped.info Lines: 100.0 % 13 13
Test Date: 2026-02-25 20:43:10 Functions: 100.0 % 4 4

           TLA  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_OBJECT_HPP
      11                 : #define BOOST_JSON_DETAIL_OBJECT_HPP
      12                 : 
      13                 : #include <boost/json/storage_ptr.hpp>
      14                 : #include <boost/json/string_view.hpp>
      15                 : #include <cstdlib>
      16                 : 
      17                 : namespace boost {
      18                 : namespace json {
      19                 : 
      20                 : class object;
      21                 : class value;
      22                 : class key_value_pair;
      23                 : 
      24                 : namespace detail {
      25                 : 
      26                 : class unchecked_object
      27                 : {
      28                 :     // each element is two values,
      29                 :     // first one is a string key,
      30                 :     // second one is the value.
      31                 :     value* data_;
      32                 :     std::size_t size_;
      33                 :     storage_ptr const& sp_;
      34                 : 
      35                 : public:
      36                 :     inline
      37                 :     ~unchecked_object();
      38                 : 
      39 HIT       34879 :     unchecked_object(
      40                 :         value* data,
      41                 :         std::size_t size, // # of kv-pairs
      42                 :         storage_ptr const& sp) noexcept
      43           34879 :         : data_(data)
      44           34879 :         , size_(size)
      45           34879 :         , sp_(sp)
      46                 :     {
      47           34879 :     }
      48                 : 
      49                 :     unchecked_object(
      50                 :         unchecked_object&& other) noexcept
      51                 :         : data_(other.data_)
      52                 :         , size_(other.size_)
      53                 :         , sp_(other.sp_)
      54                 :     {
      55                 :         other.data_ = nullptr;
      56                 :     }
      57                 : 
      58                 :     storage_ptr const&
      59           34879 :     storage() const noexcept
      60                 :     {
      61           34879 :         return sp_;
      62                 :     }
      63                 : 
      64                 :     std::size_t
      65          136330 :     size() const noexcept
      66                 :     {
      67          136330 :         return size_;
      68                 :     }
      69                 : 
      70                 :     value*
      71           33791 :     release() noexcept
      72                 :     {
      73           33791 :         auto const data = data_;
      74           33791 :         data_ = nullptr;
      75           33791 :         return data;
      76                 :     }
      77                 : };
      78                 : 
      79                 : template<class CharRange>
      80                 : std::pair<key_value_pair*, std::size_t>
      81                 : find_in_object(
      82                 :     object const& obj,
      83                 :     CharRange key) noexcept;
      84                 : 
      85                 : extern template
      86                 : BOOST_JSON_DECL
      87                 : std::pair<key_value_pair*, std::size_t>
      88                 : find_in_object<string_view>(
      89                 :     object const&,
      90                 :     string_view key) noexcept;
      91                 : 
      92                 : } // detail
      93                 : } // namespace json
      94                 : } // namespace boost
      95                 : 
      96                 : #endif
        

Generated by: LCOV version 2.3