forked from glynos/cpp-netlib
-
Notifications
You must be signed in to change notification settings - Fork 425
/
error.cpp
43 lines (29 loc) · 982 Bytes
/
error.cpp
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
// Copyright (C) 2013 by Glyn Matthews
// 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)
#include <network/error.hpp>
#include <cstring>
#include <string>
namespace network {
class network_category_impl : public std::error_category {
public:
network_category_impl() = default;
virtual ~network_category_impl() noexcept;
virtual const char *name() const noexcept;
virtual std::string message(int ev) const;
};
network_category_impl::~network_category_impl() noexcept {
}
const char *network_category_impl::name() const noexcept {
static const char name[] = "network_error";
return name;
}
std::string network_category_impl::message(int ev) const {
return std::strerror(ev);
}
const std::error_category &network_category() {
static network_category_impl category;
return category;
}
} // namespace network