GCC Code Coverage Report


Directory: libs/json/include/boost/json/
File: impl/serialize.hpp
Date: 2025-12-23 17:20:53
Exec Total Coverage
Lines: 8 8 100.0%
Functions: 11 11 100.0%
Branches: 1 1 100.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2023 Dmitry Arkhipov (grisumbras@yandex.ru)
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_SERIALIZE_HPP
11 #define BOOST_JSON_IMPL_SERIALIZE_HPP
12
13 #include <boost/json/serializer.hpp>
14
15 namespace boost {
16 namespace json {
17 namespace detail {
18
19 BOOST_JSON_DECL
20 void
21 serialize_impl(std::string& s, serializer& sr);
22
23 } // namespace detail
24
25 template<class T>
26 std::string
27 79 serialize(T const& t, serialize_options const& opts)
28 {
29 unsigned char buf[256];
30 79 serializer sr(
31 158 storage_ptr(),
32 buf,
33 sizeof(buf),
34 opts);
35 79 std::string s;
36 79 sr.reset(&t);
37
1/1
✓ Branch 1 taken 40 times.
79 detail::serialize_impl(s, sr);
38 158 return s;
39 79 }
40
41 } // namespace json
42 } // namespace boost
43
44 #endif // BOOST_JSON_IMPL_SERIALIZE_HPP
45