1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +00:00

LibCore: Move GIODevice hierarchy from LibGUI to LibCore.

This commit is contained in:
Andreas Kling 2019-04-10 20:22:23 +02:00
parent fc1d3074de
commit cfd6e6cc36
19 changed files with 112 additions and 112 deletions

31
LibCore/CSocketAddress.h Normal file
View file

@ -0,0 +1,31 @@
#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;
};