GCC Code Coverage Report


Directory: ./
File: libs/buffers/include/boost/buffers/error.hpp
Date: 2025-12-06 02:12:43
Exec Total Coverage
Lines: 5 5 100.0%
Functions: 2 2 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 //
2 // Copyright (c) 2025 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/cppalliance/buffers
8 //
9
10 #ifndef BOOST_BUFFERS_ERROR_HPP
11 #define BOOST_BUFFERS_ERROR_HPP
12
13 #include <boost/buffers/detail/config.hpp>
14 #include <boost/system/error_category.hpp>
15 #include <boost/system/is_error_code_enum.hpp>
16
17 namespace boost {
18 namespace buffers {
19
20 /** Error codes returned from algorithms and operations.
21 */
22 enum class error
23 {
24 eof = 1
25 };
26
27 //-----------------------------------------------
28
29 } // buffers
30 namespace system {
31 template<>
32 struct is_error_code_enum<
33 ::boost::buffers::error>
34 {
35 static bool const value = true;
36 };
37 } // system
38 namespace buffers {
39
40 //-----------------------------------------------
41
42 namespace detail {
43
44 struct BOOST_SYMBOL_VISIBLE
45 error_cat_type
46 : system::error_category
47 {
48 BOOST_BUFFERS_DECL const char* name(
49 ) const noexcept override;
50 BOOST_BUFFERS_DECL std::string message(
51 int) const override;
52 BOOST_BUFFERS_DECL char const* message(
53 int, char*, std::size_t
54 ) const noexcept override;
55 8 BOOST_SYSTEM_CONSTEXPR error_cat_type()
56 8 : error_category(0x884562ca8e2fc5fd)
57 {
58 8 }
59 };
60
61 BOOST_BUFFERS_DECL extern error_cat_type error_cat;
62
63 } // detail
64
65 //-----------------------------------------------
66
67 inline
68 BOOST_SYSTEM_CONSTEXPR
69 system::error_code
70 58 make_error_code(
71 error ev) noexcept
72 {
73 return system::error_code{
74 static_cast<std::underlying_type<
75 error>::type>(ev),
76 58 detail::error_cat};
77 }
78
79 } // buffers
80 } // boost
81
82 #endif
83