1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
<!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>
|