Realistic 3D camera system
3D camera system components
basic_endpoint.hpp
Go to the documentation of this file.
1 //
2 // ip/impl/basic_endpoint.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 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 ASIO_IP_IMPL_BASIC_ENDPOINT_HPP
12 #define ASIO_IP_IMPL_BASIC_ENDPOINT_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #if !defined(ASIO_NO_IOSTREAM)
19 
21 
23 
24 namespace asio {
25 namespace ip {
26 
27 template <typename Elem, typename Traits, typename InternetProtocol>
28 std::basic_ostream<Elem, Traits>& operator<<(
29  std::basic_ostream<Elem, Traits>& os,
30  const basic_endpoint<InternetProtocol>& endpoint)
31 {
32  asio::ip::detail::endpoint tmp_ep(endpoint.address(), endpoint.port());
34  std::string s = tmp_ep.to_string(ec);
35  if (ec)
36  {
37  if (os.exceptions() & std::basic_ostream<Elem, Traits>::failbit)
39  else
40  os.setstate(std::basic_ostream<Elem, Traits>::failbit);
41  }
42  else
43  for (std::string::iterator i = s.begin(); i != s.end(); ++i)
44  os << os.widen(*i);
45  return os;
46 }
47 
48 } // namespace ip
49 } // namespace asio
50 
52 
53 #endif // !defined(ASIO_NO_IOSTREAM)
54 
55 #endif // ASIO_IP_IMPL_BASIC_ENDPOINT_HPP
void throw_error(const asio::error_code &err)
Definition: throw_error.hpp:31
Describes an endpoint for a version-independent IP socket.
SocketService & s
Definition: connect.hpp:521
asio::ip::address address() const
Get the IP address associated with the endpoint.
unsigned short port() const
std::basic_ostream< Elem, Traits > & operator<<(std::basic_ostream< Elem, Traits > &os, const address &addr)
Definition: address.hpp:28
Class to represent an error code value.
Definition: error_code.hpp:80