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.9KB

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