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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
<!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/qhttp.cpp:331 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TQHttpHeader 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>TQHttpHeader Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
<p>The TQHttpHeader class contains header information for HTTP.
<a href="#details">More...</a>
<p><tt>#include <<a href="qhttp-h.html">ntqhttp.h</a>></tt>
<p>Inherited by <a href="qhttpresponseheader.html">TQHttpResponseHeader</a> and <a href="qhttprequestheader.html">TQHttpRequestHeader</a>.
<p><a href="qhttpheader-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#TQHttpHeader"><b>TQHttpHeader</b></a> ()</li>
<li class=fn><a href="#TQHttpHeader-2"><b>TQHttpHeader</b></a> ( const TQHttpHeader & header )</li>
<li class=fn><a href="#TQHttpHeader-3"><b>TQHttpHeader</b></a> ( const TQString & str )</li>
<li class=fn>virtual <a href="#~TQHttpHeader"><b>~TQHttpHeader</b></a> ()</li>
<li class=fn>TQHttpHeader & <a href="#operator-eq"><b>operator=</b></a> ( const TQHttpHeader & h )</li>
<li class=fn>TQString <a href="#value"><b>value</b></a> ( const TQString & key ) const</li>
<li class=fn>void <a href="#setValue"><b>setValue</b></a> ( const TQString & key, const TQString & value )</li>
<li class=fn>void <a href="#removeValue"><b>removeValue</b></a> ( const TQString & key )</li>
<li class=fn>TQStringList <a href="#keys"><b>keys</b></a> () const</li>
<li class=fn>bool <a href="#hasKey"><b>hasKey</b></a> ( const TQString & key ) const</li>
<li class=fn>bool <a href="#hasContentLength"><b>hasContentLength</b></a> () const</li>
<li class=fn>uint <a href="#contentLength"><b>contentLength</b></a> () const</li>
<li class=fn>void <a href="#setContentLength"><b>setContentLength</b></a> ( int len )</li>
<li class=fn>bool <a href="#hasContentType"><b>hasContentType</b></a> () const</li>
<li class=fn>TQString <a href="#contentType"><b>contentType</b></a> () const</li>
<li class=fn>void <a href="#setContentType"><b>setContentType</b></a> ( const TQString & type )</li>
<li class=fn>virtual TQString <a href="#toString"><b>toString</b></a> () const</li>
<li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
<li class=fn>virtual int <a href="#majorVersion"><b>majorVersion</b></a> () const = 0</li>
<li class=fn>virtual int <a href="#minorVersion"><b>minorVersion</b></a> () const = 0</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>
The TQHttpHeader class contains header information for HTTP.
<p>
<p> In most cases you should use the more specialized derivatives of
this class, <a href="qhttpresponseheader.html">TQHttpResponseHeader</a> and <a href="qhttprequestheader.html">TQHttpRequestHeader</a>, rather
than directly using TQHttpHeader.
<p> TQHttpHeader provides the HTTP header fields. A HTTP header field
consists of a name followed by a colon, a single space, and the
field value. (See RFC 1945.) Field names are case-insensitive. A
typical header field looks like this:
<pre>
content-type: text/html
</pre>
<p> In the API the header field name is called the "key" and the
content is called the "value". You can get and set a header
field's value by using its key with <a href="#value">value</a>() and <a href="#setValue">setValue</a>(), e.g.
<pre>
header.setValue( "content-type", "text/html" );
<a href="ntqstring.html">TQString</a> contentType = header.value( "content-type" );
</pre>
<p> Some fields are so common that getters and setters are provided
for them as a convenient alternative to using <a href="#value">value</a>() and
<a href="#setValue">setValue</a>(), e.g. <a href="#contentLength">contentLength</a>() and <a href="#contentType">contentType</a>(),
<a href="#setContentLength">setContentLength</a>() and <a href="#setContentType">setContentType</a>().
<p> Each header key has a <em>single</em> value associated with it. If you
set the value for a key which already exists the previous value
will be discarded.
<p> <p>See also <a href="qhttprequestheader.html">TQHttpRequestHeader</a>, <a href="qhttpresponseheader.html">TQHttpResponseHeader</a>, and <a href="io.html">Input/Output and Networking</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="TQHttpHeader"></a>TQHttpHeader::TQHttpHeader ()
</h3>
Constructs an empty HTTP header.
<h3 class=fn><a name="TQHttpHeader-2"></a>TQHttpHeader::TQHttpHeader ( const <a href="qhttpheader.html">TQHttpHeader</a> & header )
</h3>
Constructs a copy of <em>header</em>.
<h3 class=fn><a name="TQHttpHeader-3"></a>TQHttpHeader::TQHttpHeader ( const <a href="ntqstring.html">TQString</a> & str )
</h3>
Constructs a HTTP header for <em>str</em>.
<p> This constructor parses the string <em>str</em> for header fields and
adds this information. The <em>str</em> should consist of one or more
"\r\n" delimited lines; each of these lines should have the format
key, colon, space, value.
<h3 class=fn><a name="~TQHttpHeader"></a>TQHttpHeader::~TQHttpHeader ()<tt> [virtual]</tt>
</h3>
Destructor.
<h3 class=fn>uint <a name="contentLength"></a>TQHttpHeader::contentLength () const
</h3>
Returns the value of the special HTTP header field <tt>content-length</tt>.
<p> <p>See also <a href="#setContentLength">setContentLength</a>() and <a href="#hasContentLength">hasContentLength</a>().
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="contentType"></a>TQHttpHeader::contentType () const
</h3>
Returns the value of the special HTTP header field <tt>content-type</tt>.
<p> <p>See also <a href="#setContentType">setContentType</a>() and <a href="#hasContentType">hasContentType</a>().
<h3 class=fn>bool <a name="hasContentLength"></a>TQHttpHeader::hasContentLength () const
</h3>
Returns TRUE if the header has an entry for the special HTTP
header field <tt>content-length</tt>; otherwise returns FALSE.
<p> <p>See also <a href="#contentLength">contentLength</a>() and <a href="#setContentLength">setContentLength</a>().
<h3 class=fn>bool <a name="hasContentType"></a>TQHttpHeader::hasContentType () const
</h3>
Returns TRUE if the header has an entry for the the special HTTP
header field <tt>content-type</tt>; otherwise returns FALSE.
<p> <p>See also <a href="#contentType">contentType</a>() and <a href="#setContentType">setContentType</a>().
<h3 class=fn>bool <a name="hasKey"></a>TQHttpHeader::hasKey ( const <a href="ntqstring.html">TQString</a> & key ) const
</h3>
Returns TRUE if the HTTP header has an entry with the given <em>key</em>; otherwise returns FALSE.
<p> <p>See also <a href="#value">value</a>(), <a href="#setValue">setValue</a>(), and <a href="#keys">keys</a>().
<h3 class=fn>bool <a name="isValid"></a>TQHttpHeader::isValid () const
</h3>
Returns TRUE if the HTTP header is valid; otherwise returns FALSE.
<p> A TQHttpHeader is invalid if it was created by parsing a malformed string.
<h3 class=fn><a href="ntqstringlist.html">TQStringList</a> <a name="keys"></a>TQHttpHeader::keys () const
</h3>
Returns a list of the keys in the HTTP header.
<p> <p>See also <a href="#hasKey">hasKey</a>().
<h3 class=fn>int <a name="majorVersion"></a>TQHttpHeader::majorVersion () const<tt> [pure virtual]</tt>
</h3>
<p> Returns the major protocol-version of the HTTP header.
<p>Reimplemented in <a href="qhttpresponseheader.html#majorVersion">TQHttpResponseHeader</a> and <a href="qhttprequestheader.html#majorVersion">TQHttpRequestHeader</a>.
<h3 class=fn>int <a name="minorVersion"></a>TQHttpHeader::minorVersion () const<tt> [pure virtual]</tt>
</h3>
<p> Returns the minor protocol-version of the HTTP header.
<p>Reimplemented in <a href="qhttpresponseheader.html#minorVersion">TQHttpResponseHeader</a> and <a href="qhttprequestheader.html#minorVersion">TQHttpRequestHeader</a>.
<h3 class=fn><a href="qhttpheader.html">TQHttpHeader</a> & <a name="operator-eq"></a>TQHttpHeader::operator= ( const <a href="qhttpheader.html">TQHttpHeader</a> & h )
</h3>
Assigns <em>h</em> and returns a reference to this http header.
<h3 class=fn>void <a name="removeValue"></a>TQHttpHeader::removeValue ( const <a href="ntqstring.html">TQString</a> & key )
</h3>
Removes the entry with the key <em>key</em> from the HTTP header.
<p> <p>See also <a href="#value">value</a>() and <a href="#setValue">setValue</a>().
<h3 class=fn>void <a name="setContentLength"></a>TQHttpHeader::setContentLength ( int len )
</h3>
Sets the value of the special HTTP header field <tt>content-length</tt>
to <em>len</em>.
<p> <p>See also <a href="#contentLength">contentLength</a>() and <a href="#hasContentLength">hasContentLength</a>().
<h3 class=fn>void <a name="setContentType"></a>TQHttpHeader::setContentType ( const <a href="ntqstring.html">TQString</a> & type )
</h3>
Sets the value of the special HTTP header field <tt>content-type</tt> to
<em>type</em>.
<p> <p>See also <a href="#contentType">contentType</a>() and <a href="#hasContentType">hasContentType</a>().
<p>Example: <a href="archivesearch-example.html#x475">network/archivesearch/archivedialog.ui.h</a>.
<h3 class=fn>void <a name="setValue"></a>TQHttpHeader::setValue ( const <a href="ntqstring.html">TQString</a> & key, const <a href="ntqstring.html">TQString</a> & value )
</h3>
Sets the value of the entry with the <em>key</em> to <em>value</em>.
<p> If no entry with <em>key</em> exists, a new entry with the given <em>key</em>
and <em>value</em> is created. If an entry with the <em>key</em> already
exists, its value is discarded and replaced with the given <em>value</em>.
<p> <p>See also <a href="#value">value</a>(), <a href="#hasKey">hasKey</a>(), and <a href="#removeValue">removeValue</a>().
<p>Example: <a href="archivesearch-example.html#x476">network/archivesearch/archivedialog.ui.h</a>.
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="toString"></a>TQHttpHeader::toString () const<tt> [virtual]</tt>
</h3>
Returns a string representation of the HTTP header.
<p> The string is suitable for use by the constructor that takes a
<a href="ntqstring.html">TQString</a>. It consists of lines with the format: key, colon, space,
value, "\r\n".
<h3 class=fn><a href="ntqstring.html">TQString</a> <a name="value"></a>TQHttpHeader::value ( const <a href="ntqstring.html">TQString</a> & key ) const
</h3>
Returns the value for the entry with the given <em>key</em>. If no entry
has this <em>key</em>, an empty string is returned.
<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>().
<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>
|