GCC Code Coverage Report


Directory: libs/url/
File: boost/url/grammar/impl/error.hpp
Date: 2024-03-08 17:32:04
Exec Total Coverage
Lines: 11 11 100.0%
Functions: 4 4 100.0%
Branches: 0 0 -%

Line Branch Exec 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/url
8 //
9
10 #ifndef BOOST_URL_GRAMMAR_IMPL_ERROR_HPP
11 #define BOOST_URL_GRAMMAR_IMPL_ERROR_HPP
12
13 #include <type_traits>
14
15 namespace boost {
16 namespace system {
17 template<>
18 struct is_error_code_enum<
19 ::boost::urls::grammar::error>
20 {
21 static bool const value = true;
22 };
23 template<>
24 struct is_error_condition_enum<
25 ::boost::urls::grammar::condition>
26 {
27 static bool const value = true;
28 };
29 } // system
30 } // boost
31
32 namespace boost {
33 namespace urls {
34 namespace grammar {
35
36 namespace detail {
37
38 struct BOOST_SYMBOL_VISIBLE
39 error_cat_type
40 : system::error_category
41 {
42 BOOST_URL_DECL
43 const char* name(
44 ) const noexcept override;
45
46 BOOST_URL_DECL
47 std::string message(
48 int) const override;
49
50 BOOST_URL_DECL
51 char const* message(
52 int, char*, std::size_t
53 ) const noexcept override;
54
55 BOOST_URL_DECL
56 system::error_condition
57 default_error_condition(
58 int code) const noexcept override;
59
60 72 BOOST_SYSTEM_CONSTEXPR error_cat_type() noexcept
61 72 : error_category(0x0536e50a30f9e9f2)
62 {
63 72 }
64 };
65
66 struct BOOST_SYMBOL_VISIBLE
67 condition_cat_type
68 : system::error_category
69 {
70 BOOST_URL_DECL
71 const char* name(
72 ) const noexcept override;
73
74 BOOST_URL_DECL
75 std::string message(
76 int) const override;
77
78 BOOST_URL_DECL
79 char const* message(
80 int, char*, std::size_t
81 ) const noexcept override;
82
83 72 BOOST_SYSTEM_CONSTEXPR condition_cat_type()
84 72 : error_category(0x0536e50a30f9e9f2)
85 {
86 72 }
87 };
88
89 BOOST_URL_DECL extern
90 error_cat_type error_cat;
91
92 BOOST_URL_DECL extern
93 condition_cat_type condition_cat;
94
95 } // detail
96
97 inline
98 system::error_code
99 9925 make_error_code(
100 error ev) noexcept
101 {
102 return system::error_code{
103 static_cast<std::underlying_type<
104 error>::type>(ev),
105 9925 detail::error_cat};
106 }
107
108 inline
109 system::error_condition
110 20 make_error_condition(
111 condition c) noexcept
112 {
113 20 return system::error_condition{
114 static_cast<std::underlying_type<
115 condition>::type>(c),
116 20 detail::condition_cat};
117 }
118
119 } // grammar
120 } // urls
121 } // boost
122
123 #endif
124