PageRenderTime 32ms CodeModel.GetById 20ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/asio/ip/impl/address_v6.hpp

http://hadesmem.googlecode.com/
C++ Header | 55 lines | 35 code | 11 blank | 9 comment | 5 complexity | 3a0acbb4ca60c2371073f8e9079b2a41 MD5 | raw file
 1//
 2// ip/impl/address_v6.hpp
 3// ~~~~~~~~~~~~~~~~~~~~~~
 4//
 5// Copyright (c) 2003-2011 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_IP_IMPL_ADDRESS_V6_HPP
12#define BOOST_ASIO_IP_IMPL_ADDRESS_V6_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(BOOST_NO_IOSTREAM)
19
20#include <boost/asio/detail/throw_error.hpp>
21
22#include <boost/asio/detail/push_options.hpp>
23
24namespace boost {
25namespace asio {
26namespace ip {
27
28template <typename Elem, typename Traits>
29std::basic_ostream<Elem, Traits>& operator<<(
30    std::basic_ostream<Elem, Traits>& os, const address_v6& addr)
31{
32  boost::system::error_code ec;
33  std::string s = addr.to_string(ec);
34  if (ec)
35  {
36    if (os.exceptions() & std::basic_ostream<Elem, Traits>::failbit)
37      boost::asio::detail::throw_error(ec);
38    else
39      os.setstate(std::basic_ostream<Elem, Traits>::failbit);
40  }
41  else
42    for (std::string::iterator i = s.begin(); i != s.end(); ++i)
43      os << os.widen(*i);
44  return os;
45}
46
47} // namespace ip
48} // namespace asio
49} // namespace boost
50
51#include <boost/asio/detail/pop_options.hpp>
52
53#endif // !defined(BOOST_NO_IOSTREAM)
54
55#endif // BOOST_ASIO_IP_IMPL_ADDRESS_V6_HPP