2
3
4
5
6
7
8
9
10
11
13#ifndef IPADDRESS_IPV4_ADDRESS_HPP
14#define IPADDRESS_IPV4_ADDRESS_HPP
24
25
26
27
28
29
36
37
38
39
40
41 template <uint_type Ip>
47
48
49
50
51
52
54 return ip_from_uint32(ip);
58
59
60
61
62
64 return ip_to_uint32(_bytes);
68
69
70
71
72
78
79
80
81
82
92 lhs._bytes.swap(rhs._bytes);
96 return internal::calc_hash(0, size_t(bytes[0]), size_t(bytes[1]), size_t(bytes[2]), size_t(bytes[3]));
100 return lhs._bytes == rhs._bytes;
104 return lhs._bytes < rhs._bytes;
107#ifdef IPADDRESS_HAS_SPACESHIP_OPERATOR
123
124
125
126
127
128
129
132#ifdef IPADDRESS_NONTYPE_TEMPLATE_PARAMETER
135
136
137
138
139
140 IPADDRESS_EXPORT
template <fixed_string FixedString>
141 IPADDRESS_NODISCARD IPADDRESS_CONSTEVAL IPADDRESS_FORCE_INLINE ipv4_address operator
""_ipv4() IPADDRESS_NOEXCEPT {
142 return ipv4_address::parse<FixedString>();
146
147
148
149
150
151 IPADDRESS_EXPORT IPADDRESS_NODISCARD IPADDRESS_CONSTEVAL IPADDRESS_FORCE_INLINE ipv4_address operator
""_ipv4(
unsigned long long value) IPADDRESS_NOEXCEPT {
152 assert(value <= ipv4_address::base_all_ones &&
"literal integer is too long");
153 return ipv4_address::from_uint(uint32_t(value));
159
160
161
162
163
164
166 return internal::parse_ip_from_literal<ipv4_address_base,
char, ipv4_address::base_max_string_len>(address, size);
170
171
172
173
174
175
177 return internal::parse_ip_from_literal<ipv4_address_base,
wchar_t, ipv4_address::base_max_string_len>(address, size);
181
182
183
184
185
186
188 return internal::parse_ip_from_literal<ipv4_address_base,
char16_t, ipv4_address::base_max_string_len>(address, size);
192
193
194
195
196
197
199 return internal::parse_ip_from_literal<ipv4_address_base,
char32_t, ipv4_address::base_max_string_len>(address, size);
203
204
205
206
207
209 return ipv4_address::from_uint(uint32_t(value));
A template base class for IP address representations.
Definition ip-address-base.hpp:56
Template base class for representing a network of IP addresses.
Definition ip-network-base.hpp:32
Represents the base class for IPv4 address manipulation.
Definition ipv4-address.hpp:30
constexpr inline uint_type to_uint() const noexcept
Converts the IPv4 address to an unsigned integer.
Definition ipv4-address.hpp:63
constexpr inline const base_type & bytes() const noexcept
Provides access to the underlying bytes of the IPv4 address.
Definition ipv4-address.hpp:73
static constexpr inline ip_address_base< ipv4_address_base > from_uint() noexcept
Creates an IPv4 address from an unsigned integer using a template parameter.
Definition ipv4-address.hpp:42
constexpr inline ipv6_address ipv6_mapped() const noexcept
Retrieves the IPv6-mapped IPv4 address.
Definition ipv6-address.hpp:941
static constexpr inline ip_address_base< ipv4_address_base > from_uint(uint_type ip) noexcept
Creates an IPv4 address from an unsigned integer.
Definition ipv4-address.hpp:53
Represents the base class for IPv6 address manipulation.
Definition ipv6-address.hpp:274
#define IPADDRESS_NOEXCEPT_WHEN_NO_EXCEPTIONS
Definition config.hpp:96
#define IPADDRESS_EXPORT
Definition config.hpp:45
#define IPADDRESS_NODISCARD
Definition config.hpp:101
#define IPADDRESS_FORCE_INLINE
Definition config.hpp:115
#define IPADDRESS_NAMESPACE
Definition config.hpp:41
#define IPADDRESS_NOEXCEPT
Definition config.hpp:92
#define IPADDRESS_NODISCARD_WHEN_NO_EXCEPTIONS
Definition config.hpp:105