| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // | ||
| 2 | // Copyright (c) 2025 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/cppalliance/buffers | ||
| 8 | // | ||
| 9 | |||
| 10 | #include <boost/buffers/error.hpp> | ||
| 11 | |||
| 12 | namespace boost { | ||
| 13 | namespace buffers { | ||
| 14 | |||
| 15 | namespace detail { | ||
| 16 | |||
| 17 | const char* | ||
| 18 | 1 | error_cat_type:: | |
| 19 | name() const noexcept | ||
| 20 | { | ||
| 21 | 1 | return "boost.buffers"; | |
| 22 | } | ||
| 23 | |||
| 24 | std::string | ||
| 25 | 1 | error_cat_type:: | |
| 26 | message(int code) const | ||
| 27 | { | ||
| 28 |
1/1✓ Branch 2 taken 1 times.
|
2 | return message(code, nullptr, 0); |
| 29 | } | ||
| 30 | |||
| 31 | char const* | ||
| 32 | 1 | error_cat_type:: | |
| 33 | message( | ||
| 34 | int code, | ||
| 35 | char*, | ||
| 36 | std::size_t) const noexcept | ||
| 37 | { | ||
| 38 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | switch(static_cast<error>(code)) |
| 39 | { | ||
| 40 | 1 | case error::eof: return "eof"; | |
| 41 | ✗ | default: | |
| 42 | ✗ | return "unknown"; | |
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | //----------------------------------------------- | ||
| 47 | |||
| 48 | // msvc 14.0 has a bug that warns about inability | ||
| 49 | // to use constexpr construction here, even though | ||
| 50 | // there's no constexpr construction | ||
| 51 | #if defined(_MSC_VER) && _MSC_VER <= 1900 | ||
| 52 | # pragma warning( push ) | ||
| 53 | # pragma warning( disable : 4592 ) | ||
| 54 | #endif | ||
| 55 | |||
| 56 | #if defined(__cpp_constinit) && __cpp_constinit >= 201907L | ||
| 57 | constinit error_cat_type error_cat; | ||
| 58 | #else | ||
| 59 | error_cat_type error_cat; | ||
| 60 | #endif | ||
| 61 | |||
| 62 | #if defined(_MSC_VER) && _MSC_VER <= 1900 | ||
| 63 | # pragma warning( pop ) | ||
| 64 | #endif | ||
| 65 | |||
| 66 | } // detail | ||
| 67 | |||
| 68 | } // buffers | ||
| 69 | } // boost | ||
| 70 |