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