• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // ip/impl/address_v4.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2021 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_V4_HPP
12 #define BOOST_ASIO_IP_IMPL_ADDRESS_V4_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_ASIO_NO_IOSTREAM)
19 
20 #include <boost/asio/detail/throw_error.hpp>
21 
22 #include <boost/asio/detail/push_options.hpp>
23 
24 namespace boost {
25 namespace asio {
26 namespace ip {
27 
28 #if !defined(BOOST_ASIO_NO_DEPRECATED)
29 
from_string(const char * str)30 inline address_v4 address_v4::from_string(const char* str)
31 {
32   return boost::asio::ip::make_address_v4(str);
33 }
34 
from_string(const char * str,boost::system::error_code & ec)35 inline address_v4 address_v4::from_string(
36     const char* str, boost::system::error_code& ec)
37 {
38   return boost::asio::ip::make_address_v4(str, ec);
39 }
40 
from_string(const std::string & str)41 inline address_v4 address_v4::from_string(const std::string& str)
42 {
43   return boost::asio::ip::make_address_v4(str);
44 }
45 
from_string(const std::string & str,boost::system::error_code & ec)46 inline address_v4 address_v4::from_string(
47     const std::string& str, boost::system::error_code& ec)
48 {
49   return boost::asio::ip::make_address_v4(str, ec);
50 }
51 
52 #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
53 
54 template <typename Elem, typename Traits>
operator <<(std::basic_ostream<Elem,Traits> & os,const address_v4 & addr)55 std::basic_ostream<Elem, Traits>& operator<<(
56     std::basic_ostream<Elem, Traits>& os, const address_v4& addr)
57 {
58   return os << addr.to_string().c_str();
59 }
60 
61 } // namespace ip
62 } // namespace asio
63 } // namespace boost
64 
65 #include <boost/asio/detail/pop_options.hpp>
66 
67 #endif // !defined(BOOST_ASIO_NO_IOSTREAM)
68 
69 #endif // BOOST_ASIO_IP_IMPL_ADDRESS_V4_HPP
70