src/zlib/error.cpp
0.0% Lines (0/0/15)
0.0% List of functions (0/0/2)
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/zlib/error.hpp> | ||
| 11 | |||
| 12 | namespace boost { | ||
| 13 | namespace http { | ||
| 14 | namespace zlib { | ||
| 15 | namespace detail { | ||
| 16 | |||
| 17 | const char* | ||
| 18 | ✗ | error_cat_type:: | |
| 19 | name() const noexcept | ||
| 20 | { | ||
| 21 | ✗ | return "boost.http.zlib"; | |
| 22 | } | ||
| 23 | |||
| 24 | std::string | ||
| 25 | ✗ | error_cat_type:: | |
| 26 | message(int ev) const | ||
| 27 | { | ||
| 28 | ✗ | switch(static_cast<error>(ev)) | |
| 29 | { | ||
| 30 | ✗ | case error::ok: return "Z_OK"; | |
| 31 | ✗ | case error::stream_end: return "Z_STREAM_END"; | |
| 32 | ✗ | case error::need_dict: return "Z_NEED_DICT"; | |
| 33 | ✗ | case error::errno_: return "Z_ERRNO"; | |
| 34 | ✗ | case error::stream_err: return "Z_STREAM_ERROR"; | |
| 35 | ✗ | case error::data_err: return "Z_DATA_ERROR"; | |
| 36 | ✗ | case error::mem_err: return "Z_MEM_ERROR"; | |
| 37 | ✗ | case error::buf_err: return "Z_BUF_ERROR"; | |
| 38 | ✗ | case error::version_err: return "Z_VERSION_ERROR"; | |
| 39 | ✗ | default: | |
| 40 | ✗ | return "unknown"; | |
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | // msvc 14.0 has a bug that warns about inability | ||
| 45 | // to use constexpr construction here, even though | ||
| 46 | // there's no constexpr construction | ||
| 47 | #if defined(_MSC_VER) && _MSC_VER <= 1900 | ||
| 48 | # pragma warning( push ) | ||
| 49 | # pragma warning( disable : 4592 ) | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #if defined(__cpp_constinit) && __cpp_constinit >= 201907L | ||
| 53 | constinit error_cat_type error_cat; | ||
| 54 | #else | ||
| 55 | error_cat_type error_cat; | ||
| 56 | #endif | ||
| 57 | |||
| 58 | #if defined(_MSC_VER) && _MSC_VER <= 1900 | ||
| 59 | # pragma warning( pop ) | ||
| 60 | #endif | ||
| 61 | |||
| 62 | } // detail | ||
| 63 | } // zlib | ||
| 64 | } // http | ||
| 65 | } // boost | ||
| 66 |