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 | |||
11 | #include <boost/url/detail/config.hpp> | ||
12 | #include <boost/url/error.hpp> | ||
13 | #include <boost/url/grammar/error.hpp> | ||
14 | |||
15 | namespace boost { | ||
16 | namespace urls { | ||
17 | |||
18 | namespace detail { | ||
19 | |||
20 | const char* | ||
21 | 97 | error_cat_type:: | |
22 | name() const noexcept | ||
23 | { | ||
24 | 97 | return "boost.url"; | |
25 | } | ||
26 | |||
27 | std::string | ||
28 | 98 | error_cat_type:: | |
29 | message(int code) const | ||
30 | { | ||
31 |
1/2✓ Branch 3 taken 98 times.
✗ Branch 4 not taken.
|
98 | return message(code, nullptr, 0); |
32 | } | ||
33 | |||
34 | char const* | ||
35 | 98 | error_cat_type:: | |
36 | message( | ||
37 | int code, | ||
38 | char*, | ||
39 | std::size_t) const noexcept | ||
40 | { | ||
41 |
10/10✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 19 times.
✓ Branch 5 taken 63 times.
✓ Branch 6 taken 9 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 1 times.
|
98 | switch(static_cast<error>(code)) |
42 | { | ||
43 | 1 | case error::success: return "success"; | |
44 | 1 | case error::illegal_null: return "illegal null"; | |
45 | 1 | case error::illegal_reserved_char: return "illegal reserved char"; | |
46 | 1 | case error::non_canonical: return "non canonical"; | |
47 | |||
48 | 19 | case error::bad_pct_hexdig: return "bad hexdig in pct-encoding"; | |
49 | 63 | case error::incomplete_encoding: return "incomplete pct-encoding"; | |
50 | 9 | case error::missing_pct_hexdig: return "missing hexdig in pct-encoding"; | |
51 | 1 | case error::no_space: return "no space"; | |
52 | 1 | case error::not_a_base: return "not a base"; | |
53 | } | ||
54 | 1 | return ""; | |
55 | } | ||
56 | |||
57 | system::error_condition | ||
58 | 9 | error_cat_type:: | |
59 | default_error_condition( | ||
60 | int ev) const noexcept | ||
61 | { | ||
62 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
|
9 | switch(static_cast<error>(ev)) |
63 | { | ||
64 | 6 | default: | |
65 | 6 | return {ev, *this}; | |
66 | |||
67 | 3 | case error::bad_pct_hexdig: | |
68 | case error::incomplete_encoding: | ||
69 | case error::missing_pct_hexdig: | ||
70 | 3 | return grammar::condition::fatal; | |
71 | } | ||
72 | } | ||
73 | |||
74 | //----------------------------------------------- | ||
75 | |||
76 | // msvc 14.0 has a bug that warns about inability | ||
77 | // to use constexpr construction here, even though | ||
78 | // there's no constexpr construction | ||
79 | #if defined(_MSC_VER) && _MSC_VER <= 1900 | ||
80 | # pragma warning( push ) | ||
81 | # pragma warning( disable : 4592 ) | ||
82 | #endif | ||
83 | |||
84 | error_cat_type error_cat; | ||
85 | |||
86 | #if defined(_MSC_VER) && _MSC_VER <= 1900 | ||
87 | # pragma warning( pop ) | ||
88 | #endif | ||
89 | |||
90 | } // detail | ||
91 | |||
92 | } // urls | ||
93 | } // boost | ||
94 | |||
95 |