address_v4.hpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // ip/impl/address_v4.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2019 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. #ifndef BOOST_ASIO_IP_IMPL_ADDRESS_V4_HPP
  11. #define BOOST_ASIO_IP_IMPL_ADDRESS_V4_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #if !defined(BOOST_ASIO_NO_IOSTREAM)
  16. #include <boost/asio/detail/throw_error.hpp>
  17. #include <boost/asio/detail/push_options.hpp>
  18. namespace boost {
  19. namespace asio {
  20. namespace ip {
  21. #if !defined(BOOST_ASIO_NO_DEPRECATED)
  22. inline address_v4 address_v4::from_string(const char* str)
  23. {
  24. return boost::asio::ip::make_address_v4(str);
  25. }
  26. inline address_v4 address_v4::from_string(
  27. const char* str, boost::system::error_code& ec)
  28. {
  29. return boost::asio::ip::make_address_v4(str, ec);
  30. }
  31. inline address_v4 address_v4::from_string(const std::string& str)
  32. {
  33. return boost::asio::ip::make_address_v4(str);
  34. }
  35. inline address_v4 address_v4::from_string(
  36. const std::string& str, boost::system::error_code& ec)
  37. {
  38. return boost::asio::ip::make_address_v4(str, ec);
  39. }
  40. #endif // !defined(BOOST_ASIO_NO_DEPRECATED)
  41. template <typename Elem, typename Traits>
  42. std::basic_ostream<Elem, Traits>& operator<<(
  43. std::basic_ostream<Elem, Traits>& os, const address_v4& addr)
  44. {
  45. return os << addr.to_string().c_str();
  46. }
  47. } // namespace ip
  48. } // namespace asio
  49. } // namespace boost
  50. #include <boost/asio/detail/pop_options.hpp>
  51. #endif // !defined(BOOST_ASIO_NO_IOSTREAM)
  52. #endif // BOOST_ASIO_IP_IMPL_ADDRESS_V4_HPP