source: trunk/doc/html/qhttpheader.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 12.2 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/network/qhttp.cpp:331 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QHttpHeader Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QHttpHeader Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
33
34<p>The QHttpHeader class contains header information for HTTP.
35<a href="#details">More...</a>
36<p><tt>#include &lt;<a href="qhttp-h.html">qhttp.h</a>&gt;</tt>
37<p>Inherited by <a href="qhttpresponseheader.html">QHttpResponseHeader</a> and <a href="qhttprequestheader.html">QHttpRequestHeader</a>.
38<p><a href="qhttpheader-members.html">List of all member functions.</a>
39<h2>Public Members</h2>
40<ul>
41<li class=fn><a href="#QHttpHeader"><b>QHttpHeader</b></a> ()</li>
42<li class=fn><a href="#QHttpHeader-2"><b>QHttpHeader</b></a> ( const&nbsp;QHttpHeader&nbsp;&amp;&nbsp;header )</li>
43<li class=fn><a href="#QHttpHeader-3"><b>QHttpHeader</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;str )</li>
44<li class=fn>virtual <a href="#~QHttpHeader"><b>~QHttpHeader</b></a> ()</li>
45<li class=fn>QHttpHeader &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QHttpHeader&nbsp;&amp;&nbsp;h )</li>
46<li class=fn>QString <a href="#value"><b>value</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;key ) const</li>
47<li class=fn>void <a href="#setValue"><b>setValue</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;key, const&nbsp;QString&nbsp;&amp;&nbsp;value )</li>
48<li class=fn>void <a href="#removeValue"><b>removeValue</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;key )</li>
49<li class=fn>QStringList <a href="#keys"><b>keys</b></a> () const</li>
50<li class=fn>bool <a href="#hasKey"><b>hasKey</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;key ) const</li>
51<li class=fn>bool <a href="#hasContentLength"><b>hasContentLength</b></a> () const</li>
52<li class=fn>uint <a href="#contentLength"><b>contentLength</b></a> () const</li>
53<li class=fn>void <a href="#setContentLength"><b>setContentLength</b></a> ( int&nbsp;len )</li>
54<li class=fn>bool <a href="#hasContentType"><b>hasContentType</b></a> () const</li>
55<li class=fn>QString <a href="#contentType"><b>contentType</b></a> () const</li>
56<li class=fn>void <a href="#setContentType"><b>setContentType</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;type )</li>
57<li class=fn>virtual QString <a href="#toString"><b>toString</b></a> () const</li>
58<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
59<li class=fn>virtual int <a href="#majorVersion"><b>majorVersion</b></a> () const = 0</li>
60<li class=fn>virtual int <a href="#minorVersion"><b>minorVersion</b></a> () const = 0</li>
61</ul>
62<hr><a name="details"></a><h2>Detailed Description</h2>
63
64
65The QHttpHeader class contains header information for HTTP.
66
67<p>
68
69<p> In most cases you should use the more specialized derivatives of
70this class, <a href="qhttpresponseheader.html">QHttpResponseHeader</a> and <a href="qhttprequestheader.html">QHttpRequestHeader</a>, rather
71than directly using QHttpHeader.
72<p> QHttpHeader provides the HTTP header fields. A HTTP header field
73consists of a name followed by a colon, a single space, and the
74field value. (See RFC 1945.) Field names are case-insensitive. A
75typical header field looks like this:
76<pre>
77 content-type: text/html
78 </pre>
79
80<p> In the API the header field name is called the "key" and the
81content is called the "value". You can get and set a header
82field's value by using its key with <a href="#value">value</a>() and <a href="#setValue">setValue</a>(), e.g.
83<pre>
84 header.setValue( "content-type", "text/html" );
85 <a href="qstring.html">QString</a> contentType = header.value( "content-type" );
86 </pre>
87
88<p> Some fields are so common that getters and setters are provided
89for them as a convenient alternative to using <a href="#value">value</a>() and
90<a href="#setValue">setValue</a>(), e.g. <a href="#contentLength">contentLength</a>() and <a href="#contentType">contentType</a>(),
91<a href="#setContentLength">setContentLength</a>() and <a href="#setContentType">setContentType</a>().
92<p> Each header key has a <em>single</em> value associated with it. If you
93set the value for a key which already exists the previous value
94will be discarded.
95<p> <p>See also <a href="qhttprequestheader.html">QHttpRequestHeader</a>, <a href="qhttpresponseheader.html">QHttpResponseHeader</a>, and <a href="io.html">Input/Output and Networking</a>.
96
97<hr><h2>Member Function Documentation</h2>
98<h3 class=fn><a name="QHttpHeader"></a>QHttpHeader::QHttpHeader ()
99</h3>
100Constructs an empty HTTP header.
101
102<h3 class=fn><a name="QHttpHeader-2"></a>QHttpHeader::QHttpHeader ( const&nbsp;<a href="qhttpheader.html">QHttpHeader</a>&nbsp;&amp;&nbsp;header )
103</h3>
104Constructs a copy of <em>header</em>.
105
106<h3 class=fn><a name="QHttpHeader-3"></a>QHttpHeader::QHttpHeader ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;str )
107</h3>
108Constructs a HTTP header for <em>str</em>.
109<p> This constructor parses the string <em>str</em> for header fields and
110adds this information. The <em>str</em> should consist of one or more
111"\r\n" delimited lines; each of these lines should have the format
112key, colon, space, value.
113
114<h3 class=fn><a name="~QHttpHeader"></a>QHttpHeader::~QHttpHeader ()<tt> [virtual]</tt>
115</h3>
116Destructor.
117
118<h3 class=fn>uint <a name="contentLength"></a>QHttpHeader::contentLength () const
119</h3>
120Returns the value of the special HTTP header field <tt>content-length</tt>.
121<p> <p>See also <a href="#setContentLength">setContentLength</a>() and <a href="#hasContentLength">hasContentLength</a>().
122
123<h3 class=fn><a href="qstring.html">QString</a> <a name="contentType"></a>QHttpHeader::contentType () const
124</h3>
125Returns the value of the special HTTP header field <tt>content-type</tt>.
126<p> <p>See also <a href="#setContentType">setContentType</a>() and <a href="#hasContentType">hasContentType</a>().
127
128<h3 class=fn>bool <a name="hasContentLength"></a>QHttpHeader::hasContentLength () const
129</h3>
130Returns TRUE if the header has an entry for the special HTTP
131header field <tt>content-length</tt>; otherwise returns FALSE.
132<p> <p>See also <a href="#contentLength">contentLength</a>() and <a href="#setContentLength">setContentLength</a>().
133
134<h3 class=fn>bool <a name="hasContentType"></a>QHttpHeader::hasContentType () const
135</h3>
136Returns TRUE if the header has an entry for the the special HTTP
137header field <tt>content-type</tt>; otherwise returns FALSE.
138<p> <p>See also <a href="#contentType">contentType</a>() and <a href="#setContentType">setContentType</a>().
139
140<h3 class=fn>bool <a name="hasKey"></a>QHttpHeader::hasKey ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;key ) const
141</h3>
142Returns TRUE if the HTTP header has an entry with the given <em>key</em>; otherwise returns FALSE.
143<p> <p>See also <a href="#value">value</a>(), <a href="#setValue">setValue</a>(), and <a href="#keys">keys</a>().
144
145<h3 class=fn>bool <a name="isValid"></a>QHttpHeader::isValid () const
146</h3>
147Returns TRUE if the HTTP header is valid; otherwise returns FALSE.
148<p> A QHttpHeader is invalid if it was created by parsing a malformed string.
149
150<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="keys"></a>QHttpHeader::keys () const
151</h3>
152Returns a list of the keys in the HTTP header.
153<p> <p>See also <a href="#hasKey">hasKey</a>().
154
155<h3 class=fn>int <a name="majorVersion"></a>QHttpHeader::majorVersion () const<tt> [pure virtual]</tt>
156</h3>
157
158<p> Returns the major protocol-version of the HTTP header.
159
160<p>Reimplemented in <a href="qhttpresponseheader.html#majorVersion">QHttpResponseHeader</a> and <a href="qhttprequestheader.html#majorVersion">QHttpRequestHeader</a>.
161<h3 class=fn>int <a name="minorVersion"></a>QHttpHeader::minorVersion () const<tt> [pure virtual]</tt>
162</h3>
163
164<p> Returns the minor protocol-version of the HTTP header.
165
166<p>Reimplemented in <a href="qhttpresponseheader.html#minorVersion">QHttpResponseHeader</a> and <a href="qhttprequestheader.html#minorVersion">QHttpRequestHeader</a>.
167<h3 class=fn><a href="qhttpheader.html">QHttpHeader</a>&nbsp;&amp; <a name="operator-eq"></a>QHttpHeader::operator= ( const&nbsp;<a href="qhttpheader.html">QHttpHeader</a>&nbsp;&amp;&nbsp;h )
168</h3>
169Assigns <em>h</em> and returns a reference to this http header.
170
171<h3 class=fn>void <a name="removeValue"></a>QHttpHeader::removeValue ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;key )
172</h3>
173Removes the entry with the key <em>key</em> from the HTTP header.
174<p> <p>See also <a href="#value">value</a>() and <a href="#setValue">setValue</a>().
175
176<h3 class=fn>void <a name="setContentLength"></a>QHttpHeader::setContentLength ( int&nbsp;len )
177</h3>
178Sets the value of the special HTTP header field <tt>content-length</tt>
179to <em>len</em>.
180<p> <p>See also <a href="#contentLength">contentLength</a>() and <a href="#hasContentLength">hasContentLength</a>().
181
182<h3 class=fn>void <a name="setContentType"></a>QHttpHeader::setContentType ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;type )
183</h3>
184Sets the value of the special HTTP header field <tt>content-type</tt> to
185<em>type</em>.
186<p> <p>See also <a href="#contentType">contentType</a>() and <a href="#hasContentType">hasContentType</a>().
187
188<p>Example: <a href="archivesearch-example.html#x475">network/archivesearch/archivedialog.ui.h</a>.
189<h3 class=fn>void <a name="setValue"></a>QHttpHeader::setValue ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;key, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;value )
190</h3>
191Sets the value of the entry with the <em>key</em> to <em>value</em>.
192<p> If no entry with <em>key</em> exists, a new entry with the given <em>key</em>
193and <em>value</em> is created. If an entry with the <em>key</em> already
194exists, its value is discarded and replaced with the given <em>value</em>.
195<p> <p>See also <a href="#value">value</a>(), <a href="#hasKey">hasKey</a>(), and <a href="#removeValue">removeValue</a>().
196
197<p>Example: <a href="archivesearch-example.html#x476">network/archivesearch/archivedialog.ui.h</a>.
198<h3 class=fn><a href="qstring.html">QString</a> <a name="toString"></a>QHttpHeader::toString () const<tt> [virtual]</tt>
199</h3>
200Returns a string representation of the HTTP header.
201<p> The string is suitable for use by the constructor that takes a
202<a href="qstring.html">QString</a>. It consists of lines with the format: key, colon, space,
203value, "\r\n".
204
205<h3 class=fn><a href="qstring.html">QString</a> <a name="value"></a>QHttpHeader::value ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;key ) const
206</h3>
207Returns the value for the entry with the given <em>key</em>. If no entry
208has this <em>key</em>, an empty string is returned.
209<p> <p>See also <a href="#setValue">setValue</a>(), <a href="#removeValue">removeValue</a>(), <a href="#hasKey">hasKey</a>(), and <a href="#keys">keys</a>().
210
211<!-- eof -->
212<hr><p>
213This file is part of the <a href="index.html">Qt toolkit</a>.
214Copyright &copy; 1995-2007
215<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
216<table width=100% cellspacing=0 border=0><tr>
217<td>Copyright &copy; 2007
218<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
219<td align=right><div align=right>Qt 3.3.8</div>
220</table></div></address></body>
221</html>
Note: See TracBrowser for help on using the repository browser.