net/SocketAddress: add method HasPort()
This commit is contained in:
parent
e3ef0929f1
commit
d9b1f2fefa
@ -175,6 +175,14 @@ public:
|
||||
return ((SocketAddress)*this).IsV4Mapped();
|
||||
}
|
||||
|
||||
/**
|
||||
* Does the address family support port numbers?
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
bool HasPort() const noexcept {
|
||||
return ((SocketAddress)*this).HasPort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the port number. Returns 0 if not applicable.
|
||||
*/
|
||||
|
@ -163,6 +163,15 @@ public:
|
||||
[[gnu::pure]]
|
||||
IPv4Address UnmapV4() const noexcept;
|
||||
|
||||
/**
|
||||
* Does the address family support port numbers?
|
||||
*/
|
||||
[[gnu::pure]]
|
||||
bool HasPort() const noexcept {
|
||||
return !IsNull() &&
|
||||
(GetFamily() == AF_INET || GetFamily() == AF_INET6);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the port number. Returns 0 if not applicable.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user