-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy patherror.cpp
More file actions
63 lines (52 loc) · 1.36 KB
/
error.cpp
File metadata and controls
63 lines (52 loc) · 1.36 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
//
// Copyright (c) 2025 Vinnie Falco ([email protected])
//
// 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";
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 defined(_MSC_VER) && _MSC_VER <= 1900
# pragma warning( push )
# pragma 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 defined(_MSC_VER) && _MSC_VER <= 1900
# pragma warning( pop )
#endif
} // detail
} // capy
} // boost