Chris@16
|
1 //
|
Chris@16
|
2 // ip/basic_resolver_entry.hpp
|
Chris@16
|
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
Chris@16
|
4 //
|
Chris@101
|
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
Chris@16
|
6 //
|
Chris@16
|
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
|
Chris@16
|
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
9 //
|
Chris@16
|
10
|
Chris@16
|
11 #ifndef BOOST_ASIO_IP_BASIC_RESOLVER_ENTRY_HPP
|
Chris@16
|
12 #define BOOST_ASIO_IP_BASIC_RESOLVER_ENTRY_HPP
|
Chris@16
|
13
|
Chris@16
|
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
Chris@16
|
15 # pragma once
|
Chris@16
|
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
Chris@16
|
17
|
Chris@16
|
18 #include <boost/asio/detail/config.hpp>
|
Chris@16
|
19 #include <string>
|
Chris@16
|
20
|
Chris@16
|
21 #include <boost/asio/detail/push_options.hpp>
|
Chris@16
|
22
|
Chris@16
|
23 namespace boost {
|
Chris@16
|
24 namespace asio {
|
Chris@16
|
25 namespace ip {
|
Chris@16
|
26
|
Chris@16
|
27 /// An entry produced by a resolver.
|
Chris@16
|
28 /**
|
Chris@16
|
29 * The boost::asio::ip::basic_resolver_entry class template describes an entry
|
Chris@16
|
30 * as returned by a resolver.
|
Chris@16
|
31 *
|
Chris@16
|
32 * @par Thread Safety
|
Chris@16
|
33 * @e Distinct @e objects: Safe.@n
|
Chris@16
|
34 * @e Shared @e objects: Unsafe.
|
Chris@16
|
35 */
|
Chris@16
|
36 template <typename InternetProtocol>
|
Chris@16
|
37 class basic_resolver_entry
|
Chris@16
|
38 {
|
Chris@16
|
39 public:
|
Chris@16
|
40 /// The protocol type associated with the endpoint entry.
|
Chris@16
|
41 typedef InternetProtocol protocol_type;
|
Chris@16
|
42
|
Chris@16
|
43 /// The endpoint type associated with the endpoint entry.
|
Chris@16
|
44 typedef typename InternetProtocol::endpoint endpoint_type;
|
Chris@16
|
45
|
Chris@16
|
46 /// Default constructor.
|
Chris@16
|
47 basic_resolver_entry()
|
Chris@16
|
48 {
|
Chris@16
|
49 }
|
Chris@16
|
50
|
Chris@16
|
51 /// Construct with specified endpoint, host name and service name.
|
Chris@16
|
52 basic_resolver_entry(const endpoint_type& ep,
|
Chris@16
|
53 const std::string& host, const std::string& service)
|
Chris@16
|
54 : endpoint_(ep),
|
Chris@16
|
55 host_name_(host),
|
Chris@16
|
56 service_name_(service)
|
Chris@16
|
57 {
|
Chris@16
|
58 }
|
Chris@16
|
59
|
Chris@16
|
60 /// Get the endpoint associated with the entry.
|
Chris@16
|
61 endpoint_type endpoint() const
|
Chris@16
|
62 {
|
Chris@16
|
63 return endpoint_;
|
Chris@16
|
64 }
|
Chris@16
|
65
|
Chris@16
|
66 /// Convert to the endpoint associated with the entry.
|
Chris@16
|
67 operator endpoint_type() const
|
Chris@16
|
68 {
|
Chris@16
|
69 return endpoint_;
|
Chris@16
|
70 }
|
Chris@16
|
71
|
Chris@16
|
72 /// Get the host name associated with the entry.
|
Chris@16
|
73 std::string host_name() const
|
Chris@16
|
74 {
|
Chris@16
|
75 return host_name_;
|
Chris@16
|
76 }
|
Chris@16
|
77
|
Chris@16
|
78 /// Get the service name associated with the entry.
|
Chris@16
|
79 std::string service_name() const
|
Chris@16
|
80 {
|
Chris@16
|
81 return service_name_;
|
Chris@16
|
82 }
|
Chris@16
|
83
|
Chris@16
|
84 private:
|
Chris@16
|
85 endpoint_type endpoint_;
|
Chris@16
|
86 std::string host_name_;
|
Chris@16
|
87 std::string service_name_;
|
Chris@16
|
88 };
|
Chris@16
|
89
|
Chris@16
|
90 } // namespace ip
|
Chris@16
|
91 } // namespace asio
|
Chris@16
|
92 } // namespace boost
|
Chris@16
|
93
|
Chris@16
|
94 #include <boost/asio/detail/pop_options.hpp>
|
Chris@16
|
95
|
Chris@16
|
96 #endif // BOOST_ASIO_IP_BASIC_RESOLVER_ENTRY_HPP
|