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.
qt3/doc/html/qhttpheader.html

222 lines
12 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/qhttp.cpp:331 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QHttpHeader 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>QHttpHeader Class Reference<br><small>[<a href="network.html">network module</a>]</small></h1>
<p>The QHttpHeader class contains header information for HTTP.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qhttp-h.html">qhttp.h</a>&gt;</tt>
<p>Inherited by <a href="qhttpresponseheader.html">QHttpResponseHeader</a> and <a href="qhttprequestheader.html">QHttpRequestHeader</a>.
<p><a href="qhttpheader-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QHttpHeader"><b>QHttpHeader</b></a> ()</li>
<li class=fn><a href="#QHttpHeader-2"><b>QHttpHeader</b></a> ( const&nbsp;QHttpHeader&nbsp;&amp;&nbsp;header )</li>
<li class=fn><a href="#QHttpHeader-3"><b>QHttpHeader</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;str )</li>
<li class=fn>virtual <a href="#~QHttpHeader"><b>~QHttpHeader</b></a> ()</li>
<li class=fn>QHttpHeader &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;QHttpHeader&nbsp;&amp;&nbsp;h )</li>
<li class=fn>QString <a href="#value"><b>value</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;key ) const</li>
<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>
<li class=fn>void <a href="#removeValue"><b>removeValue</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;key )</li>
<li class=fn>QStringList <a href="#keys"><b>keys</b></a> () const</li>
<li class=fn>bool <a href="#hasKey"><b>hasKey</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;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&nbsp;len )</li>
<li class=fn>bool <a href="#hasContentType"><b>hasContentType</b></a> () const</li>
<li class=fn>QString <a href="#contentType"><b>contentType</b></a> () const</li>
<li class=fn>void <a href="#setContentType"><b>setContentType</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;type )</li>
<li class=fn>virtual QString <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 QHttpHeader 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">QHttpResponseHeader</a> and <a href="qhttprequestheader.html">QHttpRequestHeader</a>, rather
than directly using QHttpHeader.
<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:
<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="qstring.html">QString</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">QHttpRequestHeader</a>, <a href="qhttpresponseheader.html">QHttpResponseHeader</a>, and <a href="io.html">Input/Output and Networking</a>.
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QHttpHeader"></a>QHttpHeader::QHttpHeader ()
</h3>
Constructs an empty HTTP header.
<h3 class=fn><a name="QHttpHeader-2"></a>QHttpHeader::QHttpHeader ( const&nbsp;<a href="qhttpheader.html">QHttpHeader</a>&nbsp;&amp;&nbsp;header )
</h3>
Constructs a copy of <em>header</em>.
<h3 class=fn><a name="QHttpHeader-3"></a>QHttpHeader::QHttpHeader ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;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="~QHttpHeader"></a>QHttpHeader::~QHttpHeader ()<tt> [virtual]</tt>
</h3>
Destructor.
<h3 class=fn>uint <a name="contentLength"></a>QHttpHeader::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="qstring.html">QString</a> <a name="contentType"></a>QHttpHeader::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>QHttpHeader::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>QHttpHeader::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>QHttpHeader::hasKey ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;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>QHttpHeader::isValid () const
</h3>
Returns TRUE if the HTTP header is valid; otherwise returns FALSE.
<p> A QHttpHeader is invalid if it was created by parsing a malformed string.
<h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="keys"></a>QHttpHeader::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>QHttpHeader::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">QHttpResponseHeader</a> and <a href="qhttprequestheader.html#majorVersion">QHttpRequestHeader</a>.
<h3 class=fn>int <a name="minorVersion"></a>QHttpHeader::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">QHttpResponseHeader</a> and <a href="qhttprequestheader.html#minorVersion">QHttpRequestHeader</a>.
<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 )
</h3>
Assigns <em>h</em> and returns a reference to this http header.
<h3 class=fn>void <a name="removeValue"></a>QHttpHeader::removeValue ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;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>QHttpHeader::setContentLength ( int&nbsp;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>QHttpHeader::setContentType ( const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;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>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 )
</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="qstring.html">QString</a> <a name="toString"></a>QHttpHeader::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="qstring.html">QString</a>. It consists of lines with the format: key, colon, space,
value, "\r\n".
<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
</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">Qt 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>Qt 3.3.8</div>
</table></div></address></body>
</html>