C++ Essence Library 0.1.0
A Utility Library for Modern C++ Programming
Loading...
Searching...
No Matches
essence::net::ipv4_address Class Reference

Represents an IPv4 address. More...

#include <ipv4_address.hpp>

Public Types

using value_type = std::array<std::uint8_t, value_size>
 

Public Member Functions

constexpr ipv4_address () noexcept
 Creates an instance.
 
constexpr ipv4_address (std::initializer_list< std::uint8_t > address) noexcept
 Creates an instance from an initializer list.
 
constexpr ipv4_address (std::span< const std::uint8_t, value_size > address) noexcept
 Creates an instance from a 4-byte array.
 
constexpr ipv4_address (std::uint32_t address) noexcept
 Creates an instance from a 32-bit unsigned integer.
 
constexpr auto operator<=> (const ipv4_address &) const noexcept=default
 
constexpr operator std::uint32_t () const noexcept
 Converts to a 32-bit unsigned integer.
 
constexpr value_type & get () noexcept
 Gets the underlying array.
 
constexpr const value_type & get () const noexcept
 Gets the underlying array.
 

Static Public Attributes

static constexpr std::size_t value_size = 4
 

Detailed Description

Represents an IPv4 address.

Constructor & Destructor Documentation

◆ ipv4_address() [1/3]

essence::net::ipv4_address::ipv4_address ( std::initializer_list< std::uint8_t > address)
inlineconstexprnoexcept

Creates an instance from an initializer list.

Parameters
addressThe IPv4 address.

◆ ipv4_address() [2/3]

essence::net::ipv4_address::ipv4_address ( std::span< const std::uint8_t, value_size > address)
inlineexplicitconstexprnoexcept

Creates an instance from a 4-byte array.

Parameters
addressThe IPv4 address.

◆ ipv4_address() [3/3]

essence::net::ipv4_address::ipv4_address ( std::uint32_t address)
inlineexplicitconstexprnoexcept

Creates an instance from a 32-bit unsigned integer.

Parameters
addressThe IPv4 address.

Member Function Documentation

◆ get() [1/2]

const value_type & essence::net::ipv4_address::get ( ) const
inlinenodiscardconstexprnoexcept

Gets the underlying array.

Returns
The underlying array.

◆ get() [2/2]

value_type & essence::net::ipv4_address::get ( )
inlinenodiscardconstexprnoexcept

Gets the underlying array.

Returns
The underlying array.

The documentation for this class was generated from the following file: