~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/qhttpheader.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/network/qhttp.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: QHttpHeader Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">QHttpHeader Class Reference</h1>
 
21
<p>The QHttpHeader class contains header information for HTTP. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;QHttpHeader&gt;</pre><p>Part of the <a href="qtnetwork.html">QtNetwork</a> module.</p>
 
23
<p>Inherited by <a href="qhttprequestheader.html">QHttpRequestHeader</a> and <a href="qhttpresponseheader.html">QHttpResponseHeader</a>.</p>
 
24
<ul>
 
25
<li><a href="qhttpheader-members.html">List of all members, including inherited members</a></li>
 
26
</ul>
 
27
<a name="public-functions"></a>
 
28
<h3>Public Functions</h3>
 
29
<ul>
 
30
<li><div class="fn"/><b><a href="qhttpheader.html#QHttpHeader">QHttpHeader</a></b> ()</li>
 
31
<li><div class="fn"/><b><a href="qhttpheader.html#QHttpHeader-2">QHttpHeader</a></b> ( const QHttpHeader &amp; <i>header</i> )</li>
 
32
<li><div class="fn"/><b><a href="qhttpheader.html#QHttpHeader-3">QHttpHeader</a></b> ( const QString &amp; <i>str</i> )</li>
 
33
<li><div class="fn"/>virtual <b><a href="qhttpheader.html#dtor.QHttpHeader">~QHttpHeader</a></b> ()</li>
 
34
<li><div class="fn"/>uint <b><a href="qhttpheader.html#contentLength">contentLength</a></b> () const</li>
 
35
<li><div class="fn"/>QString <b><a href="qhttpheader.html#contentType">contentType</a></b> () const</li>
 
36
<li><div class="fn"/>bool <b><a href="qhttpheader.html#hasContentLength">hasContentLength</a></b> () const</li>
 
37
<li><div class="fn"/>bool <b><a href="qhttpheader.html#hasContentType">hasContentType</a></b> () const</li>
 
38
<li><div class="fn"/>bool <b><a href="qhttpheader.html#hasKey">hasKey</a></b> ( const QString &amp; <i>key</i> ) const</li>
 
39
<li><div class="fn"/>bool <b><a href="qhttpheader.html#isValid">isValid</a></b> () const</li>
 
40
<li><div class="fn"/>QStringList <b><a href="qhttpheader.html#keys">keys</a></b> () const</li>
 
41
<li><div class="fn"/>virtual int <b><a href="qhttpheader.html#majorVersion">majorVersion</a></b> () const = 0</li>
 
42
<li><div class="fn"/>virtual int <b><a href="qhttpheader.html#minorVersion">minorVersion</a></b> () const = 0</li>
 
43
<li><div class="fn"/>void <b><a href="qhttpheader.html#removeValue">removeValue</a></b> ( const QString &amp; <i>key</i> )</li>
 
44
<li><div class="fn"/>void <b><a href="qhttpheader.html#setContentLength">setContentLength</a></b> ( int <i>len</i> )</li>
 
45
<li><div class="fn"/>void <b><a href="qhttpheader.html#setContentType">setContentType</a></b> ( const QString &amp; <i>type</i> )</li>
 
46
<li><div class="fn"/>void <b><a href="qhttpheader.html#setValue">setValue</a></b> ( const QString &amp; <i>key</i>, const QString &amp; <i>value</i> )</li>
 
47
<li><div class="fn"/>virtual QString <b><a href="qhttpheader.html#toString">toString</a></b> () const</li>
 
48
<li><div class="fn"/>QString <b><a href="qhttpheader.html#value">value</a></b> ( const QString &amp; <i>key</i> ) const</li>
 
49
<li><div class="fn"/>QHttpHeader &amp; <b><a href="qhttpheader.html#operator-eq">operator=</a></b> ( const QHttpHeader &amp; <i>h</i> )</li>
 
50
</ul>
 
51
<a name="details"></a>
 
52
<hr />
 
53
<h2>Detailed Description</h2>
 
54
<p>The QHttpHeader class contains header information for HTTP.</p>
 
55
<p>In most cases you should use the more specialized derivatives of this class, <a href="qhttpresponseheader.html">QHttpResponseHeader</a> and <a href="qhttprequestheader.html">QHttpRequestHeader</a>, rather than directly using QHttpHeader.</p>
 
56
<p>QHttpHeader 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:</p>
 
57
<pre>&nbsp;   content-type: text/html</pre>
 
58
<p>In the API the header field name is called the &quot;key&quot; and the content is called the &quot;value&quot;. You can get and set a header field's value by using its key with <a href="qhttpheader.html#value">value</a>() and <a href="qhttpheader.html#setValue">setValue</a>(), e.g.</p>
 
59
<pre>&nbsp;   header.setValue(&quot;content-type&quot;, &quot;text/html&quot;);
 
60
    QString contentType = header.value(&quot;content-type&quot;);</pre>
 
61
<p>Some fields are so common that getters and setters are provided for them as a convenient alternative to using <a href="qhttpheader.html#value">value</a>() and <a href="qhttpheader.html#setValue">setValue</a>(), e.g. <a href="qhttpheader.html#contentLength">contentLength</a>() and <a href="qhttpheader.html#contentType">contentType</a>(), <a href="qhttpheader.html#setContentLength">setContentLength</a>() and <a href="qhttpheader.html#setContentType">setContentType</a>().</p>
 
62
<p>Each header key has a <i>single</i> value associated with it. If you set the value for a key which already exists the previous value will be discarded.</p>
 
63
<p>See also <a href="qhttprequestheader.html">QHttpRequestHeader</a> and <a href="qhttpresponseheader.html">QHttpResponseHeader</a>.</p>
 
64
<hr />
 
65
<h2>Member Function Documentation</h2>
 
66
<h3 class="fn"><a name="QHttpHeader"></a>QHttpHeader::QHttpHeader ()</h3>
 
67
<p>Constructs an empty HTTP header.</p>
 
68
<h3 class="fn"><a name="QHttpHeader-2"></a>QHttpHeader::QHttpHeader ( const QHttpHeader &amp; <i>header</i> )</h3>
 
69
<p>Constructs a copy of <i>header</i>.</p>
 
70
<h3 class="fn"><a name="QHttpHeader-3"></a>QHttpHeader::QHttpHeader ( const <a href="qstring.html">QString</a> &amp; <i>str</i> )</h3>
 
71
<p>Constructs a HTTP header for <i>str</i>.</p>
 
72
<p>This constructor parses the string <i>str</i> for header fields and adds this information. The <i>str</i> should consist of one or more &quot;\r\n&quot; delimited lines; each of these lines should have the format key, colon, space, value.</p>
 
73
<h3 class="fn"><a name="dtor.QHttpHeader"></a>QHttpHeader::~QHttpHeader ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
74
<p>Destructor.</p>
 
75
<h3 class="fn"><a name="contentLength"></a><a href="qtglobal.html#uint-typedef">uint</a> QHttpHeader::contentLength () const</h3>
 
76
<p>Returns the value of the special HTTP header field <tt>content-length</tt>.</p>
 
77
<p>See also <a href="qhttpheader.html#setContentLength">setContentLength</a>() and <a href="qhttpheader.html#hasContentLength">hasContentLength</a>().</p>
 
78
<h3 class="fn"><a name="contentType"></a><a href="qstring.html">QString</a> QHttpHeader::contentType () const</h3>
 
79
<p>Returns the value of the special HTTP header field <tt>content-type</tt>.</p>
 
80
<p>See also <a href="qhttpheader.html#setContentType">setContentType</a>() and <a href="qhttpheader.html#hasContentType">hasContentType</a>().</p>
 
81
<h3 class="fn"><a name="hasContentLength"></a>bool QHttpHeader::hasContentLength () const</h3>
 
82
<p>Returns true if the header has an entry for the special HTTP header field <tt>content-length</tt>; otherwise returns false.</p>
 
83
<p>See also <a href="qhttpheader.html#contentLength">contentLength</a>() and <a href="qhttpheader.html#setContentLength">setContentLength</a>().</p>
 
84
<h3 class="fn"><a name="hasContentType"></a>bool QHttpHeader::hasContentType () const</h3>
 
85
<p>Returns true if the header has an entry for the the special HTTP header field <tt>content-type</tt>; otherwise returns false.</p>
 
86
<p>See also <a href="qhttpheader.html#contentType">contentType</a>() and <a href="qhttpheader.html#setContentType">setContentType</a>().</p>
 
87
<h3 class="fn"><a name="hasKey"></a>bool QHttpHeader::hasKey ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const</h3>
 
88
<p>Returns true if the HTTP header has an entry with the given <i>key</i>; otherwise returns false.</p>
 
89
<p>See also <a href="qhttpheader.html#value">value</a>(), <a href="qhttpheader.html#setValue">setValue</a>(), and <a href="qhttpheader.html#keys">keys</a>().</p>
 
90
<h3 class="fn"><a name="isValid"></a>bool QHttpHeader::isValid () const</h3>
 
91
<p>Returns true if the HTTP header is valid; otherwise returns false.</p>
 
92
<p>A <a href="qhttpheader.html">QHttpHeader</a> is invalid if it was created by parsing a malformed string.</p>
 
93
<h3 class="fn"><a name="keys"></a><a href="qstringlist.html">QStringList</a> QHttpHeader::keys () const</h3>
 
94
<p>Returns a list of the keys in the HTTP header.</p>
 
95
<p>See also <a href="qhttpheader.html#hasKey">hasKey</a>().</p>
 
96
<h3 class="fn"><a name="majorVersion"></a>int QHttpHeader::majorVersion () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
97
<p>Returns the major protocol-version of the HTTP header.</p>
 
98
<h3 class="fn"><a name="minorVersion"></a>int QHttpHeader::minorVersion () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
 
99
<p>Returns the minor protocol-version of the HTTP header.</p>
 
100
<h3 class="fn"><a name="removeValue"></a>void QHttpHeader::removeValue ( const <a href="qstring.html">QString</a> &amp; <i>key</i> )</h3>
 
101
<p>Removes the entry with the key <i>key</i> from the HTTP header.</p>
 
102
<p>See also <a href="qhttpheader.html#value">value</a>() and <a href="qhttpheader.html#setValue">setValue</a>().</p>
 
103
<h3 class="fn"><a name="setContentLength"></a>void QHttpHeader::setContentLength ( int <i>len</i> )</h3>
 
104
<p>Sets the value of the special HTTP header field <tt>content-length</tt> to <i>len</i>.</p>
 
105
<p>See also <a href="qhttpheader.html#contentLength">contentLength</a>() and <a href="qhttpheader.html#hasContentLength">hasContentLength</a>().</p>
 
106
<h3 class="fn"><a name="setContentType"></a>void QHttpHeader::setContentType ( const <a href="qstring.html">QString</a> &amp; <i>type</i> )</h3>
 
107
<p>Sets the value of the special HTTP header field <tt>content-type</tt> to <i>type</i>.</p>
 
108
<p>See also <a href="qhttpheader.html#contentType">contentType</a>() and <a href="qhttpheader.html#hasContentType">hasContentType</a>().</p>
 
109
<h3 class="fn"><a name="setValue"></a>void QHttpHeader::setValue ( const <a href="qstring.html">QString</a> &amp; <i>key</i>, const <a href="qstring.html">QString</a> &amp; <i>value</i> )</h3>
 
110
<p>Sets the value of the entry with the <i>key</i> to <i>value</i>.</p>
 
111
<p>If no entry with <i>key</i> exists, a new entry with the given <i>key</i> and <i>value</i> is created. If an entry with the <i>key</i> already exists, its value is discarded and replaced with the given <i>value</i>.</p>
 
112
<p>See also <a href="qhttpheader.html#value">value</a>(), <a href="qhttpheader.html#hasKey">hasKey</a>(), and <a href="qhttpheader.html#removeValue">removeValue</a>().</p>
 
113
<h3 class="fn"><a name="toString"></a><a href="qstring.html">QString</a> QHttpHeader::toString () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
114
<p>Returns a string representation of the HTTP header.</p>
 
115
<p>The string is suitable for use by the constructor that takes a <a href="qstring.html">QString</a>. It consists of lines with the format: key, colon, space, value, &quot;\r\n&quot;.</p>
 
116
<h3 class="fn"><a name="value"></a><a href="qstring.html">QString</a> QHttpHeader::value ( const <a href="qstring.html">QString</a> &amp; <i>key</i> ) const</h3>
 
117
<p>Returns the value for the entry with the given <i>key</i>. If no entry has this <i>key</i>, an empty string is returned.</p>
 
118
<p>See also <a href="qhttpheader.html#setValue">setValue</a>(), <a href="qhttpheader.html#removeValue">removeValue</a>(), <a href="qhttpheader.html#hasKey">hasKey</a>(), and <a href="qhttpheader.html#keys">keys</a>().</p>
 
119
<h3 class="fn"><a name="operator-eq"></a>QHttpHeader &amp; QHttpHeader::operator= ( const QHttpHeader &amp; <i>h</i> )</h3>
 
120
<p>Assigns <i>h</i> and returns a reference to this http header.</p>
 
121
<p /><address><hr /><div align="center">
 
122
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
123
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
124
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
125
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
126
</tr></table></div></address></body>
 
127
</html>