You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
201 lines
9.6 KiB
201 lines
9.6 KiB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/network/qhostaddress.cpp:82 -->
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>QHostAddress Class</title>
|
|
<style type="text/css"><!--
|
|
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 class=fn><a href="#QHostAddress"><b>QHostAddress</b></a> ()</li>
|
|
<li class=fn><a href="#QHostAddress-2"><b>QHostAddress</b></a> ( Q_UINT32 ip4Addr )</li>
|
|
<li class=fn><a href="#QHostAddress-3"><b>QHostAddress</b></a> ( Q_UINT8 * ip6Addr )</li>
|
|
<li class=fn><a href="#QHostAddress-4"><b>QHostAddress</b></a> ( const Q_IPV6ADDR & ip6Addr )</li>
|
|
<li class=fn><a href="#QHostAddress-6"><b>QHostAddress</b></a> ( const QHostAddress & address )</li>
|
|
<li class=fn>virtual <a href="#~QHostAddress"><b>~QHostAddress</b></a> ()</li>
|
|
<li class=fn>QHostAddress & <a href="#operator-eq"><b>operator=</b></a> ( const QHostAddress & address )</li>
|
|
<li class=fn>void <a href="#setAddress"><b>setAddress</b></a> ( Q_UINT32 ip4Addr )</li>
|
|
<li class=fn>void <a href="#setAddress-2"><b>setAddress</b></a> ( Q_UINT8 * ip6Addr )</li>
|
|
<li class=fn>bool <a href="#setAddress-3"><b>setAddress</b></a> ( const QString & address )</li>
|
|
<li class=fn>bool isIp4Addr () const <em>(obsolete)</em></li>
|
|
<li class=fn>Q_UINT32 ip4Addr () const <em>(obsolete)</em></li>
|
|
<li class=fn>bool <a href="#isIPv4Address"><b>isIPv4Address</b></a> () const</li>
|
|
<li class=fn>Q_UINT32 <a href="#toIPv4Address"><b>toIPv4Address</b></a> () const</li>
|
|
<li class=fn>bool <a href="#isIPv6Address"><b>isIPv6Address</b></a> () const</li>
|
|
<li class=fn>Q_IPV6ADDR <a href="#toIPv6Address"><b>toIPv6Address</b></a> () const</li>
|
|
<li class=fn>QString <a href="#toString"><b>toString</b></a> () const</li>
|
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const QHostAddress & other ) const</li>
|
|
<li class=fn>bool <a href="#isNull"><b>isNull</b></a> () const</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 Q_IPV6ADDR & ip6Addr )
|
|
</h3>
|
|
Creates a host address object with the IPv6 address, <em>ip6Addr</em>.
|
|
|
|
<h3 class=fn><a name="QHostAddress-6"></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>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Use <a href="#toIPv4Address">toIPv4Address</a>() instead.
|
|
|
|
<h3 class=fn>bool <a name="isIPv4Address"></a>QHostAddress::isIPv4Address () const
|
|
</h3>
|
|
Returns TRUE if the host address represents an IPv4 address;
|
|
otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="isIPv6Address"></a>QHostAddress::isIPv6Address () const
|
|
</h3>
|
|
Returns TRUE if the host address represents an IPv6 address;
|
|
otherwise returns FALSE.
|
|
|
|
<h3 class=fn>bool <a name="isIp4Addr"></a>QHostAddress::isIp4Addr () const
|
|
</h3>
|
|
<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
|
|
<p> Use <a href="#isIPv4Address">isIPv4Address</a>() instead.
|
|
|
|
<h3 class=fn>bool <a name="isNull"></a>QHostAddress::isNull () const
|
|
</h3>
|
|
Returns TRUE if this host address is null (INADDR_ANY or in6addr_any). The
|
|
default constructor creates a null address, and that address isn't valid
|
|
for any particular host or interface.
|
|
|
|
<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>Q_UINT32 <a name="toIPv4Address"></a>QHostAddress::toIPv4Address () 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 (i.e. 0x7f000001).
|
|
<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>Q_IPV6ADDR <a name="toIPv6Address"></a>QHostAddress::toIPv6Address () const
|
|
</h3>
|
|
Returns the IPv6 address as a Q_IPV6ADDR structure. The structure
|
|
consists of 16 unsigned characters.
|
|
<p> <pre>
|
|
Q_IPV6ADDR addr = hostAddr.ip6Addr();
|
|
// addr.c[] contains 16 unsigned characters
|
|
|
|
for (int i = 0; i < 16; ++i) {
|
|
// process addr.c[i]
|
|
}
|
|
</pre>
|
|
|
|
<p> This value is only valid when <a href="#isIPv6Address">isIPv6Address</a>() returns TRUE.
|
|
<p> <p>See also <a href="#toString">toString</a>().
|
|
|
|
<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-2007
|
|
<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 © 2007
|
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
|
<td align=right><div align=right>Qt 3.3.8</div>
|
|
</table></div></address></body>
|
|
</html>
|