Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

basic_resolver_entry.hpp 2.8KB

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