ipaddress 1.1.0
Loading...
Searching...
No Matches
ipv4_address_base Class Reference

Represents the base class for IPv4 address manipulation. More...

#include <ipv4-address.hpp>

Inheritance diagram for ipv4_address_base:

Public Types

using base_type = typename base_v4<ipv4_address_base>::base_type
 The base type for the IPv4 address.
 
using uint_type = typename base_v4<ipv4_address_base>::uint_type
 The unsigned integer type for the IPv4 address.
 

Public Member Functions

constexpr inline uint_type to_uint () const noexcept
 Converts the IPv4 address to an unsigned integer.
 
constexpr inline const base_typebytes () const noexcept
 Provides access to the underlying bytes of the IPv4 address.
 
constexpr inline ip_version version () const noexcept
 Retrieves the IP version of the address.
 
constexpr inline size_t size () const noexcept
 Retrieves the size of the IPv4 address.
 

Static Public Member Functions

template<uint_type Ip>
static constexpr inline ip_address_base< ipv4_address_basefrom_uint () noexcept
 Creates an IPv4 address from an unsigned integer using a template parameter.
 
static constexpr inline ip_address_base< ipv4_address_basefrom_uint (uint_type ip) noexcept
 Creates an IPv4 address from an unsigned integer.
 

Detailed Description

Represents the base class for IPv4 address manipulation.

This class provides the basic functionalities required for handling IPv4 addresses, including conversion to and from numeric representations, access to the underlying bytes, and utility functions that are common across different representations of IPv4 addresses.

Member Function Documentation

◆ from_uint() [1/2]

template<uint_type Ip>
static constexpr inline ip_address_base< ipv4_address_base > from_uint ( )
inlinestaticnoexcept

Creates an IPv4 address from an unsigned integer using a template parameter.

Template Parameters
IpThe unsigned integer representing the IPv4 address.
Returns
An instance of ip address representing the IPv4 address.

◆ from_uint() [2/2]

static constexpr inline ip_address_base< ipv4_address_base > from_uint ( uint_type ip)
inlinestaticnoexcept

Creates an IPv4 address from an unsigned integer.

Parameters
[in]ipThe unsigned integer representing the IPv4 address.
Returns
An instance of ip address representing the IPv4 address.
Remarks
Bytes in integer ip must be presented in host byte order.

◆ to_uint()

constexpr inline uint_type to_uint ( ) const
inlinenoexcept

Converts the IPv4 address to an unsigned integer.

Returns
The unsigned integer representation of the IPv4 address.
Remarks
Bytes in integer are presented in host byte order.

◆ bytes()

constexpr inline const base_type & bytes ( ) const
inlinenoexcept

Provides access to the underlying bytes of the IPv4 address.

Returns
A reference to the base type containing the bytes of the IPv4 address.
Remarks
Retrieves the data representing the IP address in network byte order (big-endian).

◆ version()

constexpr inline ip_version version ( ) const
inlinenoexceptinherited

Retrieves the IP version of the address.

Returns
The IP version enumeration value for IPv4.

◆ size()

constexpr inline size_t size ( ) const
inlinenoexceptinherited

Retrieves the size of the IPv4 address.

Returns
The size of the IPv4 address in bytes.

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