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.
222 lines
12 KiB
222 lines
12 KiB
13 years ago
|
<!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">qhttp.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="qstring.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="qstring.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="qstring.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="qstring.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="qstringlist.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="qstring.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="qstring.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="qstring.html">TQString</a> & key, const <a href="qstring.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="qstring.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="qstring.html">TQString</a>. It consists of lines with the format: key, colon, space,
|
||
|
value, "\r\n".
|
||
|
|
||
|
<h3 class=fn><a href="qstring.html">TQString</a> <a name="value"></a>TQHttpHeader::value ( const <a href="qstring.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>
|