50.00% Lines (6/12)
100.00% Functions (2/2)
| TLA | Baseline | Branch | ||||||
|---|---|---|---|---|---|---|---|---|
| Line | Hits | Code | Line | Hits | Code | |||
| 1 | // | 1 | // | |||||
| 2 | // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com) | 2 | // Copyright (c) 2025 Vinnie Falco (vinnie.falco@gmail.com) | |||||
| 3 | // | 3 | // | |||||
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying | 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) | 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |||||
| 6 | // | 6 | // | |||||
| 7 | // Official repository: https://github.com/cppalliance/capy | 7 | // Official repository: https://github.com/cppalliance/capy | |||||
| 8 | // | 8 | // | |||||
| 9 | 9 | |||||||
| 10 | #include <boost/capy/error.hpp> | 10 | #include <boost/capy/error.hpp> | |||||
| 11 | 11 | |||||||
| 12 | namespace boost { | 12 | namespace boost { | |||||
| 13 | namespace capy { | 13 | namespace capy { | |||||
| 14 | 14 | |||||||
| 15 | namespace detail { | 15 | namespace detail { | |||||
| 16 | 16 | |||||||
| 17 | const char* | 17 | const char* | |||||
| HITCBC | 18 | 1 | error_cat_type:: | 18 | 1 | error_cat_type:: | ||
| 19 | name() const noexcept | 19 | name() const noexcept | |||||
| 20 | { | 20 | { | |||||
| HITCBC | 21 | 1 | return "boost.capy"; | 21 | 1 | return "boost.capy"; | ||
| 22 | } | 22 | } | |||||
| 23 | 23 | |||||||
| 24 | std::string | 24 | std::string | |||||
| HITCBC | 25 | 1022 | error_cat_type:: | 25 | 1022 | error_cat_type:: | ||
| 26 | message(int code) const | 26 | message(int code) const | |||||
| 27 | { | 27 | { | |||||
| HITCBC | 28 | 1022 | switch(static_cast<error>(code)) | 28 | 1022 | switch(static_cast<error>(code)) | ||
| 29 | { | 29 | { | |||||
| HITCBC | 30 | 3 | case error::eof: return "eof"; | 30 | 3 | case error::eof: return "eof"; | ||
| MISUBC | 31 | ✗ | case error::canceled: return "operation canceled"; | 31 | ✗ | case error::canceled: return "operation canceled"; | ||
| HITCBC | 32 | 3063 | case error::test_failure: return "test failure"; | 32 | 3063 | case error::test_failure: return "test failure"; | ||
| MISUBC | 33 | ✗ | case error::stream_truncated: return "stream truncated"; | 33 | ✗ | case error::stream_truncated: return "stream truncated"; | ||
| MISUBC | 34 | ✗ | case error::not_found: return "not found"; | 34 | ✗ | case error::not_found: return "not found"; | ||
| MISUBC | 35 | ✗ | case error::timeout: return "timeout"; | 35 | ✗ | case error::timeout: return "timeout"; | ||
| MISUBC | 36 | ✗ | default: | 36 | ✗ | default: | ||
| MISUBC | 37 | ✗ | return "unknown"; | 37 | ✗ | return "unknown"; | ||
| 38 | } | 38 | } | |||||
| 39 | } | 39 | } | |||||
| 40 | 40 | |||||||
| 41 | //----------------------------------------------- | 41 | //----------------------------------------------- | |||||
| 42 | 42 | |||||||
| 43 | // msvc 14.0 has a bug that warns about inability | 43 | // msvc 14.0 has a bug that warns about inability | |||||
| 44 | // to use constexpr construction here, even though | 44 | // to use constexpr construction here, even though | |||||
| 45 | // there's no constexpr construction | 45 | // there's no constexpr construction | |||||
| 46 | #if BOOST_CAPY_WORKAROUND(_MSC_VER, <= 1900) | 46 | #if BOOST_CAPY_WORKAROUND(_MSC_VER, <= 1900) | |||||
| 47 | BOOST_CAPY_MSVC_WARNING_PUSH | 47 | BOOST_CAPY_MSVC_WARNING_PUSH | |||||
| 48 | BOOST_CAPY_MSVC_WARNING_DISABLE(4592) | 48 | BOOST_CAPY_MSVC_WARNING_DISABLE(4592) | |||||
| 49 | #endif | 49 | #endif | |||||
| 50 | 50 | |||||||
| 51 | #if defined(__cpp_constinit) && __cpp_constinit >= 201907L | 51 | #if defined(__cpp_constinit) && __cpp_constinit >= 201907L | |||||
| 52 | constinit error_cat_type error_cat; | 52 | constinit error_cat_type error_cat; | |||||
| 53 | #else | 53 | #else | |||||
| 54 | error_cat_type error_cat; | 54 | error_cat_type error_cat; | |||||
| 55 | #endif | 55 | #endif | |||||
| 56 | 56 | |||||||
| 57 | #if BOOST_CAPY_WORKAROUND(_MSC_VER, <= 1900) | 57 | #if BOOST_CAPY_WORKAROUND(_MSC_VER, <= 1900) | |||||
| 58 | BOOST_CAPY_MSVC_WARNING_POP | 58 | BOOST_CAPY_MSVC_WARNING_POP | |||||
| 59 | #endif | 59 | #endif | |||||
| 60 | 60 | |||||||
| 61 | } // detail | 61 | } // detail | |||||
| 62 | 62 | |||||||
| 63 | } // capy | 63 | } // capy | |||||
| 64 | } // boost | 64 | } // boost | |||||