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