~ubuntu-branches/ubuntu/intrepid/miro/intrepid

« back to all changes in this revision

Viewing changes to portable/libtorrent/include/libtorrent/asio/ip/basic_resolver_entry.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2008-02-09 13:37:10 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080209133710-9rs90q6gckvp1b6i
Tags: 1.1.2-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// basic_resolver_entry.hpp
 
3
// ~~~~~~~~~~~~~~~~~~~~~~~~
 
4
//
 
5
// Copyright (c) 2003-2007 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 ASIO_IP_BASIC_RESOLVER_ENTRY_HPP
 
12
#define ASIO_IP_BASIC_RESOLVER_ENTRY_HPP
 
13
 
 
14
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
 
15
# pragma once
 
16
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
 
17
 
 
18
#include "asio/detail/push_options.hpp"
 
19
 
 
20
#include "asio/detail/push_options.hpp"
 
21
#include <string>
 
22
#include "asio/detail/pop_options.hpp"
 
23
 
 
24
namespace asio {
 
25
namespace ip {
 
26
 
 
27
/// An entry produced by a resolver.
 
28
/**
 
29
 * The asio::ip::basic_resolver_entry class template describes an entry
 
30
 * as returned by a resolver.
 
31
 *
 
32
 * @par Thread Safety
 
33
 * @e Distinct @e objects: Safe.@n
 
34
 * @e Shared @e objects: Unsafe.
 
35
 */
 
36
template <typename InternetProtocol>
 
37
class basic_resolver_entry
 
38
{
 
39
public:
 
40
  /// The protocol type associated with the endpoint entry.
 
41
  typedef InternetProtocol protocol_type;
 
42
 
 
43
  /// The endpoint type associated with the endpoint entry.
 
44
  typedef typename InternetProtocol::endpoint endpoint_type;
 
45
 
 
46
  /// Default constructor.
 
47
  basic_resolver_entry()
 
48
  {
 
49
  }
 
50
 
 
51
  /// Construct with specified endpoint, host name and service name.
 
52
  basic_resolver_entry(const endpoint_type& endpoint,
 
53
      const std::string& host_name, const std::string& service_name)
 
54
    : endpoint_(endpoint),
 
55
      host_name_(host_name),
 
56
      service_name_(service_name)
 
57
  {
 
58
  }
 
59
 
 
60
  /// Get the endpoint associated with the entry.
 
61
  endpoint_type endpoint() const
 
62
  {
 
63
    return endpoint_;
 
64
  }
 
65
 
 
66
  /// Convert to the endpoint associated with the entry.
 
67
  operator endpoint_type() const
 
68
  {
 
69
    return endpoint_;
 
70
  }
 
71
 
 
72
  /// Get the host name associated with the entry.
 
73
  std::string host_name() const
 
74
  {
 
75
    return host_name_;
 
76
  }
 
77
 
 
78
  /// Get the service name associated with the entry.
 
79
  std::string service_name() const
 
80
  {
 
81
    return service_name_;
 
82
  }
 
83
 
 
84
private:
 
85
  endpoint_type endpoint_;
 
86
  std::string host_name_;
 
87
  std::string service_name_;
 
88
};
 
89
 
 
90
} // namespace ip
 
91
} // namespace asio
 
92
 
 
93
#include "asio/detail/pop_options.hpp"
 
94
 
 
95
#endif // ASIO_IP_BASIC_RESOLVER_ENTRY_HPP