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.
tqt3/doc/html/tqhostaddress.html

201 lines
9.7 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/tqhostaddress.cpp:82 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQHostAddress 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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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>TQHostAddress Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
<p>The TQHostAddress class provides an IP address.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="tqhostaddress-h.html">tqhostaddress.h</a>&gt;</tt>
<p><a href="tqhostaddress-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQHostAddress"><b>TQHostAddress</b></a> ()</li>
<li class=fn><a href="#TQHostAddress-2"><b>TQHostAddress</b></a> ( TQ_UINT32&nbsp;ip4Addr )</li>
<li class=fn><a href="#TQHostAddress-3"><b>TQHostAddress</b></a> ( TQ_UINT8&nbsp;*&nbsp;ip6Addr )</li>
<li class=fn><a href="#TQHostAddress-4"><b>TQHostAddress</b></a> ( const&nbsp;Q_IPV6ADDR&nbsp;&amp;&nbsp;ip6Addr )</li>
<li class=fn><a href="#TQHostAddress-6"><b>TQHostAddress</b></a> ( const&nbsp;TQHostAddress&nbsp;&amp;&nbsp;address )</li>
<li class=fn>virtual <a href="#~TQHostAddress"><b>~TQHostAddress</b></a> ()</li>
<li class=fn>TQHostAddress &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQHostAddress&nbsp;&amp;&nbsp;address )</li>
<li class=fn>void <a href="#setAddress"><b>setAddress</b></a> ( TQ_UINT32&nbsp;ip4Addr )</li>
<li class=fn>void <a href="#setAddress-2"><b>setAddress</b></a> ( TQ_UINT8&nbsp;*&nbsp;ip6Addr )</li>
<li class=fn>bool <a href="#setAddress-3"><b>setAddress</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;address )</li>
<li class=fn>bool isIp4Addr () const &nbsp;<em>(obsolete)</em></li>
<li class=fn>TQ_UINT32 ip4Addr () const &nbsp;<em>(obsolete)</em></li>
<li class=fn>bool <a href="#isIPv4Address"><b>isIPv4Address</b></a> () const</li>
<li class=fn>TQ_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>TQString <a href="#toString"><b>toString</b></a> () const</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;TQHostAddress&nbsp;&amp;&nbsp;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 TQHostAddress 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> TQHostAddress is normally used with the classes <a href="tqsocket.html">TQSocket</a>,
<a href="tqserversocket.html">TQServerSocket</a> and <a href="tqsocketdevice.html">TQSocketDevice</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="tqsocket.html">TQSocket</a>, <a href="tqserversocket.html">TQServerSocket</a>, <a href="tqsocketdevice.html">TQSocketDevice</a>, and <a href="io.html">Input/Output and Networking</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQHostAddress"></a>TQHostAddress::TQHostAddress ()
</h3>
Creates a host address object with the IP address 0.0.0.0.
<h3 class=fn><a name="TQHostAddress-2"></a>TQHostAddress::TQHostAddress ( TQ_UINT32&nbsp;ip4Addr )
</h3>
Creates a host address object for the IPv4 address <em>ip4Addr</em>.
<h3 class=fn><a name="TQHostAddress-3"></a>TQHostAddress::TQHostAddress ( TQ_UINT8&nbsp;*&nbsp;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="TQHostAddress-4"></a>TQHostAddress::TQHostAddress ( const&nbsp;Q_IPV6ADDR&nbsp;&amp;&nbsp;ip6Addr )
</h3>
Creates a host address object with the IPv6 address, <em>ip6Addr</em>.
<h3 class=fn><a name="TQHostAddress-6"></a>TQHostAddress::TQHostAddress ( const&nbsp;<a href="tqhostaddress.html">TQHostAddress</a>&nbsp;&amp;&nbsp;address )
</h3>
Creates a copy of <em>address</em>.
<h3 class=fn><a name="~TQHostAddress"></a>TQHostAddress::~TQHostAddress ()<tt> [virtual]</tt>
</h3>
Destroys the host address object.
<h3 class=fn>TQ_UINT32 <a name="ip4Addr"></a>TQHostAddress::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>TQHostAddress::isIPv4Address () const
</h3>
Returns TRUE if the host address represents an IPv4 address;
otherwise returns FALSE.
<h3 class=fn>bool <a name="isIPv6Address"></a>TQHostAddress::isIPv6Address () const
</h3>
Returns TRUE if the host address represents an IPv6 address;
otherwise returns FALSE.
<h3 class=fn>bool <a name="isIp4Addr"></a>TQHostAddress::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>TQHostAddress::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="tqhostaddress.html">TQHostAddress</a>&nbsp;&amp; <a name="operator-eq"></a>TQHostAddress::operator= ( const&nbsp;<a href="tqhostaddress.html">TQHostAddress</a>&nbsp;&amp;&nbsp;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>TQHostAddress::operator== ( const&nbsp;<a href="tqhostaddress.html">TQHostAddress</a>&nbsp;&amp;&nbsp;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>TQHostAddress::setAddress ( TQ_UINT32&nbsp;ip4Addr )
</h3>
Set the IPv4 address specified by <em>ip4Addr</em>.
<h3 class=fn>void <a name="setAddress-2"></a>TQHostAddress::setAddress ( TQ_UINT8&nbsp;*&nbsp;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>TQHostAddress::setAddress ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;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>TQ_UINT32 <a name="toIPv4Address"></a>TQHostAddress::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>TQHostAddress::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 &lt; 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="tqstring.html">TQString</a> <a name="toString"></a>TQHostAddress::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">TQt toolkit</a>.
Copyright &copy; 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 &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>