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.

address_v6_range.hpp 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. //
  2. // ip/address_v6_range.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. // Oliver Kowalke (oliver dot kowalke at gmail dot com)
  7. //
  8. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  9. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  10. //
  11. #ifndef ASIO_IP_ADDRESS_V6_RANGE_HPP
  12. #define ASIO_IP_ADDRESS_V6_RANGE_HPP
  13. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  14. # pragma once
  15. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  16. #include "asio/detail/config.hpp"
  17. #include "asio/ip/address_v6_iterator.hpp"
  18. #include "asio/detail/push_options.hpp"
  19. namespace asio {
  20. namespace ip {
  21. template <typename> class basic_address_range;
  22. /// Represents a range of IPv6 addresses.
  23. /**
  24. * @par Thread Safety
  25. * @e Distinct @e objects: Safe.@n
  26. * @e Shared @e objects: Unsafe.
  27. */
  28. template <> class basic_address_range<address_v6>
  29. {
  30. public:
  31. /// The type of an iterator that points into the range.
  32. typedef basic_address_iterator<address_v6> iterator;
  33. /// Construct an empty range.
  34. basic_address_range() ASIO_NOEXCEPT
  35. : begin_(address_v6()),
  36. end_(address_v6())
  37. {
  38. }
  39. /// Construct an range that represents the given range of addresses.
  40. explicit basic_address_range(const iterator& first,
  41. const iterator& last) ASIO_NOEXCEPT
  42. : begin_(first),
  43. end_(last)
  44. {
  45. }
  46. /// Copy constructor.
  47. basic_address_range(const basic_address_range& other) ASIO_NOEXCEPT
  48. : begin_(other.begin_),
  49. end_(other.end_)
  50. {
  51. }
  52. #if defined(ASIO_HAS_MOVE)
  53. /// Move constructor.
  54. basic_address_range(basic_address_range&& other) ASIO_NOEXCEPT
  55. : begin_(ASIO_MOVE_CAST(iterator)(other.begin_)),
  56. end_(ASIO_MOVE_CAST(iterator)(other.end_))
  57. {
  58. }
  59. #endif // defined(ASIO_HAS_MOVE)
  60. /// Assignment operator.
  61. basic_address_range& operator=(
  62. const basic_address_range& other) ASIO_NOEXCEPT
  63. {
  64. begin_ = other.begin_;
  65. end_ = other.end_;
  66. return *this;
  67. }
  68. #if defined(ASIO_HAS_MOVE)
  69. /// Move assignment operator.
  70. basic_address_range& operator=(
  71. basic_address_range&& other) ASIO_NOEXCEPT
  72. {
  73. begin_ = ASIO_MOVE_CAST(iterator)(other.begin_);
  74. end_ = ASIO_MOVE_CAST(iterator)(other.end_);
  75. return *this;
  76. }
  77. #endif // defined(ASIO_HAS_MOVE)
  78. /// Obtain an iterator that points to the start of the range.
  79. iterator begin() const ASIO_NOEXCEPT
  80. {
  81. return begin_;
  82. }
  83. /// Obtain an iterator that points to the end of the range.
  84. iterator end() const ASIO_NOEXCEPT
  85. {
  86. return end_;
  87. }
  88. /// Determine whether the range is empty.
  89. bool empty() const ASIO_NOEXCEPT
  90. {
  91. return begin_ == end_;
  92. }
  93. /// Find an address in the range.
  94. iterator find(const address_v6& addr) const ASIO_NOEXCEPT
  95. {
  96. return addr >= *begin_ && addr < *end_ ? iterator(addr) : end_;
  97. }
  98. private:
  99. iterator begin_;
  100. iterator end_;
  101. };
  102. /// Represents a range of IPv6 addresses.
  103. typedef basic_address_range<address_v6> address_v6_range;
  104. } // namespace ip
  105. } // namespace asio
  106. #include "asio/detail/pop_options.hpp"
  107. #endif // ASIO_IP_ADDRESS_V6_RANGE_HPP