mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:37:35 +00:00
Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.
This commit is contained in:
parent
63814ffebf
commit
04b9dc2d30
328 changed files with 36 additions and 36 deletions
37
Libraries/LibCore/CSocketAddress.h
Normal file
37
Libraries/LibCore/CSocketAddress.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/IPv4Address.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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue