Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:59

0001 //
0002 // ip/impl/network_v4.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 // Copyright (c) 2014 Oliver Kowalke (oliver dot kowalke at gmail dot com)
0007 //
0008 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0009 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0010 //
0011 
0012 #ifndef BOOST_ASIO_IP_IMPL_NETWORK_V4_HPP
0013 #define BOOST_ASIO_IP_IMPL_NETWORK_V4_HPP
0014 
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0018 
0019 #if !defined(BOOST_ASIO_NO_IOSTREAM)
0020 
0021 #include <boost/asio/detail/throw_error.hpp>
0022 
0023 #include <boost/asio/detail/push_options.hpp>
0024 
0025 namespace boost {
0026 namespace asio {
0027 namespace ip {
0028 
0029 template <typename Elem, typename Traits>
0030 std::basic_ostream<Elem, Traits>& operator<<(
0031     std::basic_ostream<Elem, Traits>& os, const network_v4& addr)
0032 {
0033   boost::system::error_code ec;
0034   std::string s = addr.to_string(ec);
0035   if (ec)
0036   {
0037     if (os.exceptions() & std::basic_ostream<Elem, Traits>::failbit)
0038       boost::asio::detail::throw_error(ec);
0039     else
0040       os.setstate(std::basic_ostream<Elem, Traits>::failbit);
0041   }
0042   else
0043     for (std::string::iterator i = s.begin(); i != s.end(); ++i)
0044       os << os.widen(*i);
0045   return os;
0046 }
0047 
0048 } // namespace ip
0049 } // namespace asio
0050 } // namespace boost
0051 
0052 #include <boost/asio/detail/pop_options.hpp>
0053 
0054 #endif // !defined(BOOST_ASIO_NO_IOSTREAM)
0055 
0056 #endif // BOOST_ASIO_IP_IMPL_NETWORK_V4_HPP