comparison DEPENDENCIES/generic/include/boost/asio/impl/error.ipp @ 16:2665513ce2d3

Add boost headers
author Chris Cannam
date Tue, 05 Aug 2014 11:11:38 +0100
parents
children c530137014c0
comparison
equal deleted inserted replaced
15:663ca0da4350 16:2665513ce2d3
1 //
2 // impl/error.ipp
3 // ~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2013 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10
11 #ifndef BOOST_ASIO_IMPL_ERROR_IPP
12 #define BOOST_ASIO_IMPL_ERROR_IPP
13
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17
18 #include <boost/asio/detail/config.hpp>
19 #include <boost/asio/error.hpp>
20
21 #include <boost/asio/detail/push_options.hpp>
22
23 namespace boost {
24 namespace asio {
25 namespace error {
26
27 #if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
28
29 namespace detail {
30
31 class netdb_category : public boost::system::error_category
32 {
33 public:
34 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
35 {
36 return "asio.netdb";
37 }
38
39 std::string message(int value) const
40 {
41 if (value == error::host_not_found)
42 return "Host not found (authoritative)";
43 if (value == error::host_not_found_try_again)
44 return "Host not found (non-authoritative), try again later";
45 if (value == error::no_data)
46 return "The query is valid, but it does not have associated data";
47 if (value == error::no_recovery)
48 return "A non-recoverable error occurred during database lookup";
49 return "asio.netdb error";
50 }
51 };
52
53 } // namespace detail
54
55 const boost::system::error_category& get_netdb_category()
56 {
57 static detail::netdb_category instance;
58 return instance;
59 }
60
61 namespace detail {
62
63 class addrinfo_category : public boost::system::error_category
64 {
65 public:
66 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
67 {
68 return "asio.addrinfo";
69 }
70
71 std::string message(int value) const
72 {
73 if (value == error::service_not_found)
74 return "Service not found";
75 if (value == error::socket_type_not_supported)
76 return "Socket type not supported";
77 return "asio.addrinfo error";
78 }
79 };
80
81 } // namespace detail
82
83 const boost::system::error_category& get_addrinfo_category()
84 {
85 static detail::addrinfo_category instance;
86 return instance;
87 }
88
89 #endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
90
91 namespace detail {
92
93 class misc_category : public boost::system::error_category
94 {
95 public:
96 const char* name() const BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT
97 {
98 return "asio.misc";
99 }
100
101 std::string message(int value) const
102 {
103 if (value == error::already_open)
104 return "Already open";
105 if (value == error::eof)
106 return "End of file";
107 if (value == error::not_found)
108 return "Element not found";
109 if (value == error::fd_set_failure)
110 return "The descriptor does not fit into the select call's fd_set";
111 return "asio.misc error";
112 }
113 };
114
115 } // namespace detail
116
117 const boost::system::error_category& get_misc_category()
118 {
119 static detail::misc_category instance;
120 return instance;
121 }
122
123 } // namespace error
124 } // namespace asio
125 } // namespace boost
126
127 #include <boost/asio/detail/pop_options.hpp>
128
129 #endif // BOOST_ASIO_IMPL_ERROR_IPP