Clementine
Public Member Functions | Static Public Member Functions | Friends | Related Functions | List of all members
asio::ip::address Class Reference

Implements version-independent IP addresses. More...

#include <address.hpp>

Public Member Functions

ASIO_DECL address () ASIO_NOEXCEPT
 Default constructor.
 
ASIO_DECL address (const asio::ip::address_v4 &ipv4_address) ASIO_NOEXCEPT
 Construct an address from an IPv4 address.
 
ASIO_DECL address (const asio::ip::address_v6 &ipv6_address) ASIO_NOEXCEPT
 Construct an address from an IPv6 address.
 
ASIO_DECL address (const address &other) ASIO_NOEXCEPT
 Copy constructor.
 
ASIO_DECL addressoperator= (const address &other) ASIO_NOEXCEPT
 Assign from another address.
 
ASIO_DECL addressoperator= (const asio::ip::address_v4 &ipv4_address) ASIO_NOEXCEPT
 Assign from an IPv4 address.
 
ASIO_DECL addressoperator= (const asio::ip::address_v6 &ipv6_address) ASIO_NOEXCEPT
 Assign from an IPv6 address.
 
bool is_v4 () const ASIO_NOEXCEPT
 Get whether the address is an IP version 4 address.
 
bool is_v6 () const ASIO_NOEXCEPT
 Get whether the address is an IP version 6 address.
 
ASIO_DECL asio::ip::address_v4 to_v4 () const
 Get the address as an IP version 4 address.
 
ASIO_DECL asio::ip::address_v6 to_v6 () const
 Get the address as an IP version 6 address.
 
ASIO_DECL std::string to_string () const
 Get the address as a string.
 
ASIO_DECL std::string to_string (asio::error_code &ec) const
 (Deprecated: Use other overload.) Get the address as a string.
 
ASIO_DECL bool is_loopback () const ASIO_NOEXCEPT
 Determine whether the address is a loopback address.
 
ASIO_DECL bool is_unspecified () const ASIO_NOEXCEPT
 Determine whether the address is unspecified.
 
ASIO_DECL bool is_multicast () const ASIO_NOEXCEPT
 Determine whether the address is a multicast address.
 

Static Public Member Functions

static address from_string (const char *str)
 (Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. More...
 
static address from_string (const char *str, asio::error_code &ec)
 (Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. More...
 
static address from_string (const std::string &str)
 (Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. More...
 
static address from_string (const std::string &str, asio::error_code &ec)
 (Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation. More...
 

Friends

ASIO_DECL friend bool operator== (const address &a1, const address &a2) ASIO_NOEXCEPT
 Compare two addresses for equality.
 
bool operator!= (const address &a1, const address &a2) ASIO_NOEXCEPT
 Compare two addresses for inequality.
 
ASIO_DECL friend bool operator< (const address &a1, const address &a2) ASIO_NOEXCEPT
 Compare addresses for ordering.
 
bool operator> (const address &a1, const address &a2) ASIO_NOEXCEPT
 Compare addresses for ordering.
 
bool operator<= (const address &a1, const address &a2) ASIO_NOEXCEPT
 Compare addresses for ordering.
 
bool operator>= (const address &a1, const address &a2) ASIO_NOEXCEPT
 Compare addresses for ordering.
 

Related Functions

(Note that these are not member functions.)

ASIO_DECL address make_address (const char *str)
 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
 
ASIO_DECL address make_address (const char *str, asio::error_code &ec) ASIO_NOEXCEPT
 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
 
ASIO_DECL address make_address (const std::string &str)
 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
 
ASIO_DECL address make_address (const std::string &str, asio::error_code &ec) ASIO_NOEXCEPT
 Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.
 
template<typename Elem , typename Traits >
std::basic_ostream< Elem, Traits > & operator<< (std::basic_ostream< Elem, Traits > &os, const address &addr)
 Output an address as a string. More...
 

Detailed Description

Implements version-independent IP addresses.

The asio::ip::address class provides the ability to use either IP version 4 or version 6 addresses.

Thread Safety
Distinct objects: Safe.
Shared objects: Unsafe.

Member Function Documentation

◆ from_string() [1/4]

address asio::ip::address::from_string ( const char *  str)
inlinestatic

(Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.

◆ from_string() [2/4]

address asio::ip::address::from_string ( const char *  str,
asio::error_code ec 
)
inlinestatic

(Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.

◆ from_string() [3/4]

address asio::ip::address::from_string ( const std::string &  str)
inlinestatic

(Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.

◆ from_string() [4/4]

address asio::ip::address::from_string ( const std::string &  str,
asio::error_code ec 
)
inlinestatic

(Deprecated: Use make_address().) Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.

Friends And Related Function Documentation

◆ operator<<()

template<typename Elem , typename Traits >
std::basic_ostream< Elem, Traits > & operator<< ( std::basic_ostream< Elem, Traits > &  os,
const address addr 
)
related

Output an address as a string.

Used to output a human-readable string for a specified address.

Parameters
osThe output stream to which the string will be written.
addrThe address to be written.
Returns
The output stream.

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