File indexing completed on 2025-01-18 09:29:00
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_ASIO_IP_BASIC_RESOLVER_ENTRY_HPP
0012 #define BOOST_ASIO_IP_BASIC_RESOLVER_ENTRY_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <string>
0020 #include <boost/asio/detail/string_view.hpp>
0021
0022 #include <boost/asio/detail/push_options.hpp>
0023
0024 namespace boost {
0025 namespace asio {
0026 namespace ip {
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 template <typename InternetProtocol>
0038 class basic_resolver_entry
0039 {
0040 public:
0041
0042 typedef InternetProtocol protocol_type;
0043
0044
0045 typedef typename InternetProtocol::endpoint endpoint_type;
0046
0047
0048 basic_resolver_entry()
0049 {
0050 }
0051
0052
0053 basic_resolver_entry(const endpoint_type& ep,
0054 BOOST_ASIO_STRING_VIEW_PARAM host, BOOST_ASIO_STRING_VIEW_PARAM service)
0055 : endpoint_(ep),
0056 host_name_(static_cast<std::string>(host)),
0057 service_name_(static_cast<std::string>(service))
0058 {
0059 }
0060
0061
0062 endpoint_type endpoint() const
0063 {
0064 return endpoint_;
0065 }
0066
0067
0068 operator endpoint_type() const
0069 {
0070 return endpoint_;
0071 }
0072
0073
0074 std::string host_name() const
0075 {
0076 return host_name_;
0077 }
0078
0079
0080 template <class Allocator>
0081 std::basic_string<char, std::char_traits<char>, Allocator> host_name(
0082 const Allocator& alloc = Allocator()) const
0083 {
0084 return std::basic_string<char, std::char_traits<char>, Allocator>(
0085 host_name_.c_str(), alloc);
0086 }
0087
0088
0089 std::string service_name() const
0090 {
0091 return service_name_;
0092 }
0093
0094
0095 template <class Allocator>
0096 std::basic_string<char, std::char_traits<char>, Allocator> service_name(
0097 const Allocator& alloc = Allocator()) const
0098 {
0099 return std::basic_string<char, std::char_traits<char>, Allocator>(
0100 service_name_.c_str(), alloc);
0101 }
0102
0103 private:
0104 endpoint_type endpoint_;
0105 std::string host_name_;
0106 std::string service_name_;
0107 };
0108
0109 }
0110 }
0111 }
0112
0113 #include <boost/asio/detail/pop_options.hpp>
0114
0115 #endif