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.
tqt3/doc/html/tqhttpheader.html

221 lines
12 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<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&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>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 &lt;<a href="tqhttp-h.html">tqhttp.h</a>&gt;</tt>
<p>Inherited by <a href="tqhttpresponseheader.html">TQHttpResponseHeader</a> and <a href="tqhttprequestheader.html">TQHttpRequestHeader</a>.
<p><a href="tqhttpheader-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&nbsp;TQHttpHeader&nbsp;&amp;&nbsp;header )</li>
<li class=fn><a href="#TQHttpHeader-3"><b>TQHttpHeader</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;str )</li>
<li class=fn>virtual <a href="#~TQHttpHeader"><b>~TQHttpHeader</b></a> ()</li>
<li class=fn>TQHttpHeader &amp; <a href="#operator-eq"><b>operator=</b></a> ( const&nbsp;TQHttpHeader&nbsp;&amp;&nbsp;h )</li>
<li class=fn>TQString <a href="#value"><b>value</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;key ) const</li>
<li class=fn>void <a href="#setValue"><b>setValue</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;key, const&nbsp;TQString&nbsp;&amp;&nbsp;value )</li>
<li class=fn>void <a href="#removeValue"><b>removeValue</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;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&nbsp;TQString&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>TQString <a href="#contentType"><b>contentType</b></a> () const</li>
<li class=fn>void <a href="#setContentType"><b>setContentType</b></a> ( const&nbsp;TQString&nbsp;&amp;&nbsp;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="tqhttpresponseheader.html">TQHttpResponseHeader</a> and <a href="tqhttprequestheader.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="tqstring.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="tqhttprequestheader.html">TQHttpRequestHeader</a>, <a href="tqhttpresponseheader.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&nbsp;<a href="tqhttpheader.html">TQHttpHeader</a>&nbsp;&amp;&nbsp;header )
</h3>
Constructs a copy of <em>header</em>.
<h3 class=fn><a name="TQHttpHeader-3"></a>TQHttpHeader::TQHttpHeader ( const&nbsp;<a href="tqstring.html">TQString</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="~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="tqstring.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&nbsp;<a href="tqstring.html">TQString</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>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="tqstringlist.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="tqhttpresponseheader.html#majorVersion">TQHttpResponseHeader</a> and <a href="tqhttprequestheader.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="tqhttpresponseheader.html#minorVersion">TQHttpResponseHeader</a> and <a href="tqhttprequestheader.html#minorVersion">TQHttpRequestHeader</a>.
<h3 class=fn><a href="tqhttpheader.html">TQHttpHeader</a>&nbsp;&amp; <a name="operator-eq"></a>TQHttpHeader::operator= ( const&nbsp;<a href="tqhttpheader.html">TQHttpHeader</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>TQHttpHeader::removeValue ( const&nbsp;<a href="tqstring.html">TQString</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>TQHttpHeader::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>TQHttpHeader::setContentType ( const&nbsp;<a href="tqstring.html">TQString</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>TQHttpHeader::setValue ( const&nbsp;<a href="tqstring.html">TQString</a>&nbsp;&amp;&nbsp;key, const&nbsp;<a href="tqstring.html">TQString</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="tqstring.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="tqstring.html">TQString</a>. It consists of lines with the format: key, colon, space,
value, "\r\n".
<h3 class=fn><a href="tqstring.html">TQString</a> <a name="value"></a>TQHttpHeader::value ( const&nbsp;<a href="tqstring.html">TQString</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">TQt 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>TQt 3.3.8</div>
</table></div></address></body>
</html>