Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QHostAddress Class Reference

List of all members.

Detailed Description

The QHostAddress class provides an IP address.


This class holds an IPv4 or IPv6 address in a platform- and protocol-independent manner.

QHostAddress is normally used with the QTcpSocket, QTcpServer, and QUdpSocket to connect to a host or to set up a server.

A host address is set with setAddress(), checked for its type using isIPv4Address() or isIPv6Address(), and retrieved with toIPv4Address(), toIPv6Address(), or toString().

The class also supports common predefined addresses: Null, LocalHost, LocalHostIPv6, Broadcast, and Any.

See also:
QTcpSocket, QTcpServer, QUdpSocket

Definition at line 47 of file qhostaddress.h.

Public Types

enum  SpecialAddress {
  Null, Broadcast, LocalHost, LocalHostIPv6,
  Any, AnyIPv6

Public Member Functions

void clear ()
bool isNull () const
bool operator!= (SpecialAddress address) const
bool operator!= (const QHostAddress &address) const
QHostAddressoperator= (const QString &address)
QHostAddressoperator= (const QHostAddress &other)
bool operator== (SpecialAddress address) const
bool operator== (const QHostAddress &address) const
QAbstractSocket::NetworkLayerProtocol protocol () const
 QHostAddress (SpecialAddress address)
 QHostAddress (const QHostAddress &copy)
 QHostAddress (const QString &address)
 QHostAddress (const sockaddr *sockaddr)
 QHostAddress (const Q_IPV6ADDR &ip6Addr)
 QHostAddress (quint8 *ip6Addr)
 QHostAddress (quint32 ip4Addr)
 QHostAddress ()
QString scopeId () const
bool setAddress (const QString &address)
void setAddress (const sockaddr *sockaddr)
void setAddress (const Q_IPV6ADDR &ip6Addr)
void setAddress (quint8 *ip6Addr)
void setAddress (quint32 ip4Addr)
void setScopeId (const QString &id)
quint32 toIPv4Address () const
Q_IPV6ADDR toIPv6Address () const
QString toString () const
 ~QHostAddress ()

Private Attributes

QHostAddressPrivate * d

Related Functions

(Note that these are not member functions.)

QDataStreamoperator<< (QDataStream &out, const QHostAddress &address)
QDataStreamoperator>> (QDataStream &in, QHostAddress &address)

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

Generated by  Doxygen 1.6.0   Back to index