diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:11:01 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:11:01 +0900 |
commit | 3fdc3e5ee96dca5b11d1694975a65200787eab86 (patch) | |
tree | 5c1733853892b8397d67706fa453a9bd978d2102 /boost/asio/ip/basic_resolver_entry.hpp | |
parent | 88e602c57797660ebe0f9e15dbd64c1ff16dead3 (diff) | |
download | boost-3fdc3e5ee96dca5b11d1694975a65200787eab86.tar.gz boost-3fdc3e5ee96dca5b11d1694975a65200787eab86.tar.bz2 boost-3fdc3e5ee96dca5b11d1694975a65200787eab86.zip |
Imported Upstream version 1.66.0upstream/1.66.0
Diffstat (limited to 'boost/asio/ip/basic_resolver_entry.hpp')
-rw-r--r-- | boost/asio/ip/basic_resolver_entry.hpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/boost/asio/ip/basic_resolver_entry.hpp b/boost/asio/ip/basic_resolver_entry.hpp index 05c8547a0c..ec6c7bd6d5 100644 --- a/boost/asio/ip/basic_resolver_entry.hpp +++ b/boost/asio/ip/basic_resolver_entry.hpp @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <string> +#include <boost/asio/detail/string_view.hpp> #include <boost/asio/detail/push_options.hpp> @@ -50,10 +51,10 @@ public: /// Construct with specified endpoint, host name and service name. basic_resolver_entry(const endpoint_type& ep, - const std::string& host, const std::string& service) + BOOST_ASIO_STRING_VIEW_PARAM host, BOOST_ASIO_STRING_VIEW_PARAM service) : endpoint_(ep), - host_name_(host), - service_name_(service) + host_name_(static_cast<std::string>(host)), + service_name_(static_cast<std::string>(service)) { } @@ -75,12 +76,30 @@ public: return host_name_; } + /// Get the host name associated with the entry. + template <class Allocator> + std::basic_string<char, std::char_traits<char>, Allocator> host_name( + const Allocator& alloc = Allocator()) const + { + return std::basic_string<char, std::char_traits<char>, Allocator>( + host_name_.c_str(), alloc); + } + /// Get the service name associated with the entry. std::string service_name() const { return service_name_; } + /// Get the service name associated with the entry. + template <class Allocator> + std::basic_string<char, std::char_traits<char>, Allocator> service_name( + const Allocator& alloc = Allocator()) const + { + return std::basic_string<char, std::char_traits<char>, Allocator>( + service_name_.c_str(), alloc); + } + private: endpoint_type endpoint_; std::string host_name_; |