Warning, file /include/boost/asio/ip/address_v4_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 #ifndef BOOST_ASIO_IP_ADDRESS_V4_ITERATOR_HPP
0012 #define BOOST_ASIO_IP_ADDRESS_V4_ITERATOR_HPP
0013
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif
0017
0018 #include <boost/asio/detail/config.hpp>
0019 #include <boost/asio/ip/address_v4.hpp>
0020
0021 #include <boost/asio/detail/push_options.hpp>
0022
0023 namespace boost {
0024 namespace asio {
0025 namespace ip {
0026
0027 template <typename> class basic_address_iterator;
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 template <> class basic_address_iterator<address_v4>
0039 {
0040 public:
0041
0042 typedef address_v4 value_type;
0043
0044
0045 typedef std::ptrdiff_t difference_type;
0046
0047
0048 typedef const address_v4* pointer;
0049
0050
0051 typedef const address_v4& reference;
0052
0053
0054 typedef std::input_iterator_tag iterator_category;
0055
0056
0057 basic_address_iterator(const address_v4& addr) noexcept
0058 : address_(addr)
0059 {
0060 }
0061
0062
0063 basic_address_iterator(const basic_address_iterator& other) noexcept
0064 : address_(other.address_)
0065 {
0066 }
0067
0068
0069 basic_address_iterator(basic_address_iterator&& other) noexcept
0070 : address_(static_cast<address_v4&&>(other.address_))
0071 {
0072 }
0073
0074
0075 basic_address_iterator& operator=(
0076 const basic_address_iterator& other) noexcept
0077 {
0078 address_ = other.address_;
0079 return *this;
0080 }
0081
0082
0083 basic_address_iterator& operator=(basic_address_iterator&& other) noexcept
0084 {
0085 address_ = static_cast<address_v4&&>(other.address_);
0086 return *this;
0087 }
0088
0089
0090 const address_v4& operator*() const noexcept
0091 {
0092 return address_;
0093 }
0094
0095
0096 const address_v4* operator->() const noexcept
0097 {
0098 return &address_;
0099 }
0100
0101
0102 basic_address_iterator& operator++() noexcept
0103 {
0104 address_ = address_v4((address_.to_uint() + 1) & 0xFFFFFFFF);
0105 return *this;
0106 }
0107
0108
0109 basic_address_iterator operator++(int) noexcept
0110 {
0111 basic_address_iterator tmp(*this);
0112 ++*this;
0113 return tmp;
0114 }
0115
0116
0117 basic_address_iterator& operator--() noexcept
0118 {
0119 address_ = address_v4((address_.to_uint() - 1) & 0xFFFFFFFF);
0120 return *this;
0121 }
0122
0123
0124 basic_address_iterator operator--(int)
0125 {
0126 basic_address_iterator tmp(*this);
0127 --*this;
0128 return tmp;
0129 }
0130
0131
0132 friend bool operator==(const basic_address_iterator& a,
0133 const basic_address_iterator& b)
0134 {
0135 return a.address_ == b.address_;
0136 }
0137
0138
0139 friend bool operator!=(const basic_address_iterator& a,
0140 const basic_address_iterator& b)
0141 {
0142 return a.address_ != b.address_;
0143 }
0144
0145 private:
0146 address_v4 address_;
0147 };
0148
0149
0150 typedef basic_address_iterator<address_v4> address_v4_iterator;
0151
0152 }
0153 }
0154 }
0155
0156 #include <boost/asio/detail/pop_options.hpp>
0157
0158 #endif