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

Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Related Functions

QHostAddress Class Reference

The QHostAddress class provides an IP address.QtNetwork. More...

Inheritance diagram for QHostAddress:
Inheritance graph
Collaboration diagram for QHostAddress:
Collaboration graph

List of all members.

Public Types

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

Public Member Functions

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

Static Public Member Functions

static QPair< QHostAddress, int > parseSubnet (const QString &subnet)

Protected Attributes


Related Functions

(Note that these are not member functions.)

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

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:
QHostInfo, QTcpSocket, QTcpServer, QUdpSocket

Definition at line 69 of file qhostaddress.h.

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

Generated by  Doxygen 1.6.0   Back to index