Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

address Class Reference

Inherited by inet_address.

List of all members.


Detailed Description

A network address (e.g., an IPv4 or IPv6 address and port, or a UNIX-domain socket path).

Addresses, like STL strings, may be passed and copied by value.


Public Methods

 address ()
 Constructs an empty address.

 address (const void *addr, socklen_t len)
 Constructs an address from a block of data.

const sockaddr * data () const
 Returns a pointer to the data as a sockaddr.

socklen_t length () const
 Returns the length of the address structure.

const string & data_as_string () const
 Returns the address structure as a string.

 operator const void * () const
 Returns a non-null pointer if and only if this address is non-empty.

string as_string () const
 Returns a human-readable version of the string.

 NMSTL_ARITH_OPS (address, data_as_string())
 NMSTL_SIMPLY_SERIALIZABLE (address,<< addr)

Protected Attributes

string addr


Constructor & Destructor Documentation

address::address (    ) 
 

Constructs an empty address.

address::address (  const void *    addr,
socklen_t    len
) 
 

Constructs an address from a block of data.


Member Function Documentation

string address::as_string (    ) 
 

Returns a human-readable version of the string.

Reimplemented in inet_address.

const sockaddr* address::data (    )  const
 

Returns a pointer to the data as a sockaddr.

const string& address::data_as_string (    )  const
 

Returns the address structure as a string.

The string is not human-readable; rather it is a string equal to string(this->data(), this->length()).

socklen_t address::length (    )  const
 

Returns the length of the address structure.

address::NMSTL_ARITH_OPS (  address   ,
data_as_string()   
) 
 

address::NMSTL_SIMPLY_SERIALIZABLE (  address   ,
<<    addr
) 
 

address::operator const void * (    )  const
 

Returns a non-null pointer if and only if this address is non-empty.

This exists primarily to enable the "if (address) { ... }" metaphor.


Member Data Documentation

string address::addr [protected]
 


The documentation for this class was generated from the following file:
Generated on Fri Dec 20 13:35:10 2002 for NMSTL