src/brotli/error.cpp

0.0% Lines (0/0/36) 0.0% List of functions (0/0/2)
error.cpp
f(x) Functions (2)
Line TLA Hits Source Code
1 //
2 // Copyright (c) 2024 Mohammad Nejati
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/http
8 //
9
10 #include <boost/http/brotli/error.hpp>
11
12 namespace boost {
13 namespace http {
14 namespace brotli {
15 namespace detail {
16
17 const char*
18 error_cat_type::
19 name() const noexcept
20 {
21 return "boost.http.brotli";
22 }
23
24 std::string
25 error_cat_type::
26 message(int ev) const
27 {
28 switch(static_cast<error>(ev))
29 {
30
31 case error::no_error: return "no_error";
32 case error::success: return "success";
33 case error::needs_more_input: return "needs_more_input";
34 case error::needs_more_output: return "needs_more_output";
35 case error::format_exuberant_nibble: return "format_exuberant_nibble";
36 case error::format_reserved: return "format_reserved";
37 case error::format_exuberant_meta_nibbl: return "format_exuberant_meta_nibbl";
38 case error::format_simple_huffman_alphabet: return "format_simple_huffman_alphabet";
39 case error::format_simple_huffman_same: return "format_simple_huffman_same";
40 case error::format_cl_space: return "format_cl_space";
41 case error::format_huffman_space: return "format_huffman_space";
42 case error::format_context_map_repea: return "format_context_map_repea";
43 case error::format_block_length_1: return "format_block_length_1";
44 case error::format_block_length_2: return "format_block_length_2";
45 case error::format_transform: return "format_transform";
46 case error::format_dictionary: return "format_dictionary";
47 case error::format_window_bits: return "format_window_bits";
48 case error::format_padding_1: return "format_padding_1";
49 case error::format_padding_2: return "format_padding_2";
50 case error::format_distance: return "format_distance";
51 case error::compound_dictionary: return "compound_dictionary";
52 case error::dictionary_not_set: return "dictionary_not_set";
53 case error::invalid_arguments: return "invalid_arguments";
54 case error::alloc_context_modes: return "alloc_context_modes";
55 case error::alloc_tree_groups: return "alloc_tree_groups";
56 case error::alloc_context_map: return "alloc_context_map";
57 case error::alloc_ring_buffer_1: return "alloc_ring_buffer_1";
58 case error::alloc_ring_buffer_2: return "alloc_ring_buffer_2";
59 case error::alloc_block_type_trees: return "alloc_block_type_trees";
60 case error::unreachable: return "unreachable";
61 default:
62 return "unknown";
63 }
64 }
65
66 // msvc 14.0 has a bug that warns about inability
67 // to use constexpr construction here, even though
68 // there's no constexpr construction
69 #if defined(_MSC_VER) && _MSC_VER <= 1900
70 # pragma warning( push )
71 # pragma warning( disable : 4592 )
72 #endif
73
74 #if defined(__cpp_constinit) && __cpp_constinit >= 201907L
75 constinit error_cat_type error_cat;
76 #else
77 error_cat_type error_cat;
78 #endif
79
80 #if defined(_MSC_VER) && _MSC_VER <= 1900
81 # pragma warning( pop )
82 #endif
83
84 } // detail
85 } // brotli
86 } // http
87 } // boost
88