2
3
4
5
6
7
8
9
10
11
13#ifndef IPADDRESS_IPV4_ADDRESS_HPP
14#define IPADDRESS_IPV4_ADDRESS_HPP
21
22
23
24
25
26
33
34
35
36
37
38 template <uint_type Ip>
44
45
46
47
48
49
51 return ip_from_uint32(ip);
55
56
57
58
59
61 return ip_to_uint32(_bytes);
65
66
67
68
69
81 lhs._bytes.swap(rhs._bytes);
85 return internal::calc_hash(0, size_t(bytes[0]), size_t(bytes[1]), size_t(bytes[2]), size_t(bytes[3]));
89 return lhs._bytes == rhs._bytes;
93 return lhs._bytes < rhs._bytes;
96#ifdef IPADDRESS_HAS_SPACESHIP_OPERATOR
112
113
114
115
116
117
118
121#ifdef IPADDRESS_NONTYPE_TEMPLATE_PARAMETER
124
125
126
127
128
129 IPADDRESS_EXPORT
template <fixed_string FixedString>
130 IPADDRESS_NODISCARD IPADDRESS_CONSTEVAL IPADDRESS_FORCE_INLINE ipv4_address operator
""_ipv4() IPADDRESS_NOEXCEPT {
131 return ipv4_address::parse<FixedString>();
135
136
137
138
139
140 IPADDRESS_EXPORT IPADDRESS_NODISCARD IPADDRESS_CONSTEVAL IPADDRESS_FORCE_INLINE ipv4_address operator
""_ipv4(
unsigned long long value) IPADDRESS_NOEXCEPT {
141 assert(value <= ipv4_address::base_all_ones &&
"literal integer is too long");
142 return ipv4_address::from_uint(uint32_t(value));
148
149
150
151
152
153
155 return internal::parse_ip_from_literal<ipv4_address_base,
char, ipv4_address::base_max_string_len>(address, size);
159
160
161
162
163
164
166 return internal::parse_ip_from_literal<ipv4_address_base,
wchar_t, ipv4_address::base_max_string_len>(address, size);
170
171
172
173
174
175
177 return internal::parse_ip_from_literal<ipv4_address_base,
char16_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,
char32_t, ipv4_address::base_max_string_len>(address, size);
192
193
194
195
196
198 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:27
constexpr inline uint_type to_uint() const noexcept
Converts the IPv4 address to an unsigned integer.
Definition ipv4-address.hpp:60
constexpr inline const base_type & bytes() const noexcept
Provides access to the underlying bytes of the IPv4 address.
Definition ipv4-address.hpp:70
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:39
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:50
#define IPADDRESS_NOEXCEPT_WHEN_NO_EXCEPTIONS
Definition config.hpp:93
#define IPADDRESS_EXPORT
Definition config.hpp:42
#define IPADDRESS_NODISCARD
Definition config.hpp:98
#define IPADDRESS_FORCE_INLINE
Definition config.hpp:112
#define IPADDRESS_NAMESPACE
Definition config.hpp:38
#define IPADDRESS_NOEXCEPT
Definition config.hpp:89
#define IPADDRESS_NODISCARD_WHEN_NO_EXCEPTIONS
Definition config.hpp:102