Warning, file /include/boost/asio/ip/address_v6_iterator.hpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_ASIO_IP_ADDRESS_V6_ITERATOR_HPP
0013 #define BOOST_ASIO_IP_ADDRESS_V6_ITERATOR_HPP
0014
0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0016 # pragma once
0017 #endif
0018
0019 #include <boost/asio/detail/config.hpp>
0020 #include <boost/asio/ip/address_v6.hpp>
0021
0022 #include <boost/asio/detail/push_options.hpp>
0023
0024 namespace boost {
0025 namespace asio {
0026 namespace ip {
0027
0028 template <typename> class basic_address_iterator;
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 template <> class basic_address_iterator<address_v6>
0040 {
0041 public:
0042
0043 typedef address_v6 value_type;
0044
0045
0046 typedef std::ptrdiff_t difference_type;
0047
0048
0049 typedef const address_v6* pointer;
0050
0051
0052 typedef const address_v6& reference;
0053
0054
0055 typedef std::input_iterator_tag iterator_category;
0056
0057
0058 basic_address_iterator(const address_v6& addr) noexcept
0059 : address_(addr)
0060 {
0061 }
0062
0063
0064 basic_address_iterator(
0065 const basic_address_iterator& other) noexcept
0066 : address_(other.address_)
0067 {
0068 }
0069
0070
0071 basic_address_iterator(basic_address_iterator&& other) noexcept
0072 : address_(static_cast<address_v6&&>(other.address_))
0073 {
0074 }
0075
0076
0077 basic_address_iterator& operator=(
0078 const basic_address_iterator& other) noexcept
0079 {
0080 address_ = other.address_;
0081 return *this;
0082 }
0083
0084
0085 basic_address_iterator& operator=(basic_address_iterator&& other) noexcept
0086 {
0087 address_ = static_cast<address_v6&&>(other.address_);
0088 return *this;
0089 }
0090
0091
0092 const address_v6& operator*() const noexcept
0093 {
0094 return address_;
0095 }
0096
0097
0098 const address_v6* operator->() const noexcept
0099 {
0100 return &address_;
0101 }
0102
0103
0104 basic_address_iterator& operator++() noexcept
0105 {
0106 for (int i = 15; i >= 0; --i)
0107 {
0108 if (address_.addr_.s6_addr[i] < 0xFF)
0109 {
0110 ++address_.addr_.s6_addr[i];
0111 break;
0112 }
0113
0114 address_.addr_.s6_addr[i] = 0;
0115 }
0116
0117 return *this;
0118 }
0119
0120
0121 basic_address_iterator operator++(int) noexcept
0122 {
0123 basic_address_iterator tmp(*this);
0124 ++*this;
0125 return tmp;
0126 }
0127
0128
0129 basic_address_iterator& operator--() noexcept
0130 {
0131 for (int i = 15; i >= 0; --i)
0132 {
0133 if (address_.addr_.s6_addr[i] > 0)
0134 {
0135 --address_.addr_.s6_addr[i];
0136 break;
0137 }
0138
0139 address_.addr_.s6_addr[i] = 0xFF;
0140 }
0141
0142 return *this;
0143 }
0144
0145
0146 basic_address_iterator operator--(int)
0147 {
0148 basic_address_iterator tmp(*this);
0149 --*this;
0150 return tmp;
0151 }
0152
0153
0154 friend bool operator==(const basic_address_iterator& a,
0155 const basic_address_iterator& b)
0156 {
0157 return a.address_ == b.address_;
0158 }
0159
0160
0161 friend bool operator!=(const basic_address_iterator& a,
0162 const basic_address_iterator& b)
0163 {
0164 return a.address_ != b.address_;
0165 }
0166
0167 private:
0168 address_v6 address_;
0169 };
0170
0171
0172 typedef basic_address_iterator<address_v6> address_v6_iterator;
0173
0174 }
0175 }
0176 }
0177
0178 #include <boost/asio/detail/pop_options.hpp>
0179
0180 #endif