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