asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design
Reference Class Hierarchy | Class Index | Member Index

asio::ip::address Class Reference

List of all members.


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.

Public Member Functions

 address ()
 Default constructor.
 address (const asio::ip::address_v4 &ipv4_address)
 Construct an address from an IPv4 address.
 address (const asio::ip::address_v6 &ipv6_address)
 Construct an address from an IPv6 address.
 address (const address &other)
 Copy constructor.
addressoperator= (const address &other)
 Assign from another address.
addressoperator= (const asio::ip::address_v4 &ipv4_address)
 Assign from an IPv4 address.
addressoperator= (const asio::ip::address_v6 &ipv6_address)
 Assign from an IPv6 address.
bool is_v4 () const
 Get whether the address is an IP version 4 address.
bool is_v6 () const
 Get whether the address is an IP version 6 address.
asio::ip::address_v4 to_v4 () const
 Get the address as an IP version 4 address.
asio::ip::address_v6 to_v6 () const
 Get the address as an IP version 6 address.
std::string to_string () const
 Get the address as a string in dotted decimal format.
std::string to_string (asio::error_code &ec) const
 Get the address as a string in dotted decimal format.

Static Public Member Functions

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

Friends

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

Related Functions

(Note that these are not member functions.)

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.

Constructor & Destructor Documentation

asio::ip::address::address (  ) 

Default constructor.

asio::ip::address::address ( const asio::ip::address_v4 ipv4_address  ) 

Construct an address from an IPv4 address.

asio::ip::address::address ( const asio::ip::address_v6 ipv6_address  ) 

Construct an address from an IPv6 address.

asio::ip::address::address ( const address other  ) 

Copy constructor.


Member Function Documentation

address& asio::ip::address::operator= ( const address other  ) 

Assign from another address.

address& asio::ip::address::operator= ( const asio::ip::address_v4 ipv4_address  ) 

Assign from an IPv4 address.

address& asio::ip::address::operator= ( const asio::ip::address_v6 ipv6_address  ) 

Assign from an IPv6 address.

bool asio::ip::address::is_v4 (  )  const

Get whether the address is an IP version 4 address.

bool asio::ip::address::is_v6 (  )  const

Get whether the address is an IP version 6 address.

asio::ip::address_v4 asio::ip::address::to_v4 (  )  const

Get the address as an IP version 4 address.

asio::ip::address_v6 asio::ip::address::to_v6 (  )  const

Get the address as an IP version 6 address.

std::string asio::ip::address::to_string (  )  const

Get the address as a string in dotted decimal format.

std::string asio::ip::address::to_string ( asio::error_code ec  )  const

Get the address as a string in dotted decimal format.

static address asio::ip::address::from_string ( const char *  str  )  [static]

Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.

static address asio::ip::address::from_string ( const char *  str,
asio::error_code ec 
) [static]

Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.

static address asio::ip::address::from_string ( const std::string &  str  )  [static]

Create an address from an IPv4 address string in dotted decimal form, or from an IPv6 address in hexadecimal notation.

static address asio::ip::address::from_string ( const std::string &  str,
asio::error_code ec 
) [static]

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

bool operator== ( const address a1,
const address a2 
) [friend]

Compare two addresses for equality.

bool operator!= ( const address a1,
const address a2 
) [friend]

Compare two addresses for inequality.

bool operator< ( const address a1,
const address a2 
) [friend]

Compare addresses for ordering.

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:
os The output stream to which the string will be written.
addr The address to be written.
Returns:
The output stream.

asio 0.3.8rc3 Home | Reference | Tutorial | Examples | Design