mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-25 05:55:13 +00:00
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
38 lines
754 B
C++
38 lines
754 B
C++
#pragma once
|
|
|
|
#include <Kernel/Net/IPv4.h>
|
|
|
|
class CSocketAddress {
|
|
public:
|
|
enum class Type
|
|
{
|
|
Invalid,
|
|
IPv4,
|
|
Local
|
|
};
|
|
|
|
CSocketAddress() {}
|
|
CSocketAddress(const IPv4Address& address)
|
|
: m_type(Type::IPv4)
|
|
, m_ipv4_address(address)
|
|
{
|
|
}
|
|
|
|
Type type() const { return m_type; }
|
|
bool is_valid() const { return m_type != Type::Invalid; }
|
|
IPv4Address ipv4_address() const { return m_ipv4_address; }
|
|
|
|
String to_string() const
|
|
{
|
|
switch (m_type) {
|
|
case Type::IPv4:
|
|
return m_ipv4_address.to_string();
|
|
default:
|
|
return "[CSocketAddress]";
|
|
}
|
|
}
|
|
|
|
private:
|
|
Type m_type { Type::Invalid };
|
|
IPv4Address m_ipv4_address;
|
|
};
|