<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/network/qhostaddress.cpp:78 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QHostAddress Class</title> <style type="text/css"><!-- h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td valign=center> <a href="index.html"> <font color="#004faf">Home</font></a> | <a href="classes.html"> <font color="#004faf">All Classes</font></a> | <a href="mainclasses.html"> <font color="#004faf">Main Classes</font></a> | <a href="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QHostAddress Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1> <p>The QHostAddress class provides an IP address. <a href="#details">More...</a> <p><tt>#include <<a href="qhostaddress-h.html">qhostaddress.h</a>></tt> <p><a href="qhostaddress-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li><div class=fn><a href="#QHostAddress"><b>QHostAddress</b></a> ()</div></li> <li><div class=fn><a href="#QHostAddress-2"><b>QHostAddress</b></a> ( Q_UINT32 ip4Addr )</div></li> <li><div class=fn><a href="#QHostAddress-3"><b>QHostAddress</b></a> ( Q_UINT8 * ip6Addr )</div></li> <li><div class=fn><a href="#QHostAddress-4"><b>QHostAddress</b></a> ( const QHostAddress & address )</div></li> <li><div class=fn>virtual <a href="#~QHostAddress"><b>~QHostAddress</b></a> ()</div></li> <li><div class=fn>QHostAddress & <a href="#operator-eq"><b>operator=</b></a> ( const QHostAddress & address )</div></li> <li><div class=fn>void <a href="#setAddress"><b>setAddress</b></a> ( Q_UINT32 ip4Addr )</div></li> <li><div class=fn>void <a href="#setAddress-2"><b>setAddress</b></a> ( Q_UINT8 * ip6Addr )</div></li> <li><div class=fn>bool <a href="#setAddress-3"><b>setAddress</b></a> ( const QString & address )</div></li> <li><div class=fn>bool <a href="#isIp4Addr"><b>isIp4Addr</b></a> () const</div></li> <li><div class=fn>Q_UINT32 <a href="#ip4Addr"><b>ip4Addr</b></a> () const</div></li> <li><div class=fn>QString <a href="#toString"><b>toString</b></a> () const</div></li> <li><div class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QHostAddress & other ) const</div></li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The QHostAddress class provides an IP address. <p> <p> This class contains an IP address in a platform and protocol independent manner. It stores both IPv4 and IPv6 addresses in a way that you can easily access on any platform. <p> QHostAddress is normally used with the classes <a href="qsocket.html">QSocket</a>, <a href="qserversocket.html">QServerSocket</a> and <a href="qsocketdevice.html">QSocketDevice</a> to set up a server or to connect to a host. <p> Host addresses may be set with <a href="#setAddress">setAddress</a>() and retrieved with <a href="#ip4Addr">ip4Addr</a>() or <a href="#toString">toString</a>(). <p> <p>See also <a href="qsocket.html">QSocket</a>, <a href="qserversocket.html">QServerSocket</a>, <a href="qsocketdevice.html">QSocketDevice</a> and <a href="io.html">Input/Output and Networking</a>. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="QHostAddress"></a>QHostAddress::QHostAddress () </h3> Creates a host address object with the IP address 0.0.0.0. <h3 class=fn><a name="QHostAddress-2"></a>QHostAddress::QHostAddress ( Q_UINT32 ip4Addr ) </h3> Creates a host address object for the IPv4 address <em>ip4Addr</em>. <h3 class=fn><a name="QHostAddress-3"></a>QHostAddress::QHostAddress ( Q_UINT8 * ip6Addr ) </h3> Creates a host address object with the specified IPv6 address. <p> <em>ip6Addr</em> must be a 16 byte array in network byte order (high-order byte first) <h3 class=fn><a name="QHostAddress-4"></a>QHostAddress::QHostAddress ( const <a href="qhostaddress.html">QHostAddress</a> & address ) </h3> Creates a copy of <em>address</em>. <h3 class=fn><a name="~QHostAddress"></a>QHostAddress::~QHostAddress ()<tt> [virtual]</tt> </h3> Destroys the host address object. <h3 class=fn>Q_UINT32 <a name="ip4Addr"></a>QHostAddress::ip4Addr () const </h3> Returns the IPv4 address as a number. <p> For example, if the address is 127.0.0.1, the returned value is 2130706433 (hex: 7f000001). <p> This value is only valid when <a href="#isIp4Addr">isIp4Addr</a>() returns TRUE. <p> <p>See also <a href="#toString">toString</a>(). <h3 class=fn>bool <a name="isIp4Addr"></a>QHostAddress::isIp4Addr () const </h3> Returns TRUE if the host address represents a IPv4 address; otherwise returns FALSE. <h3 class=fn><a href="qhostaddress.html">QHostAddress</a> & <a name="operator-eq"></a>QHostAddress::operator= ( const <a href="qhostaddress.html">QHostAddress</a> & address ) </h3> Assigns another host address object <em>address</em> to this object and returns a reference to this object. <h3 class=fn>bool <a name="operator-eq-eq"></a>QHostAddress::operator== ( const <a href="qhostaddress.html">QHostAddress</a> & other ) const </h3> Returns TRUE if this host address is the same as <em>other</em>; otherwise returns FALSE. <h3 class=fn>void <a name="setAddress"></a>QHostAddress::setAddress ( Q_UINT32 ip4Addr ) </h3> Set the IPv4 address specified by <em>ip4Addr</em>. <h3 class=fn>void <a name="setAddress-2"></a>QHostAddress::setAddress ( Q_UINT8 * ip6Addr ) </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Set the IPv6 address specified by <em>ip6Addr</em>. <p> <em>ip6Addr</em> must be a 16 byte array in network byte order (high-order byte first) <h3 class=fn>bool <a name="setAddress-3"></a>QHostAddress::setAddress ( const <a href="qstring.html">QString</a> & address ) </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Sets the IPv4 or IPv6 address specified by the string representation <em>address</em> (e.g. "127.0.0.1"). Returns TRUE and sets the address if the address was successfully parsed; otherwise returns FALSE and leaves the address unchanged. <h3 class=fn><a href="qstring.html">QString</a> <a name="toString"></a>QHostAddress::toString () const </h3> Returns the address as a string. <p> For example, if the address is the IPv4 address 127.0.0.1, the returned string is "127.0.0.1". <p> <p>See also <a href="#ip4Addr">ip4Addr</a>(). <!-- eof --> <hr><p> This file is part of the <a href="index.html">Qt toolkit</a>. Copyright © 1995-2001 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2001 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a> <td align=right><div align=right>Qt version 3.0.2</div> </table></div></address></body> </html>