[190] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
---|
| 2 | <!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/network/qhttp.cpp:331 -->
|
---|
| 3 | <html>
|
---|
| 4 | <head>
|
---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
---|
| 6 | <title>QHttpHeader Class</title>
|
---|
| 7 | <style type="text/css"><!--
|
---|
| 8 | fn { margin-left: 1cm; text-indent: -1cm; }
|
---|
| 9 | a:link { color: #004faf; text-decoration: none }
|
---|
| 10 | a:visited { color: #672967; text-decoration: none }
|
---|
| 11 | body { background: #ffffff; color: black; }
|
---|
| 12 | --></style>
|
---|
| 13 | </head>
|
---|
| 14 | <body>
|
---|
| 15 |
|
---|
| 16 | <table border="0" cellpadding="0" cellspacing="0" width="100%">
|
---|
| 17 | <tr bgcolor="#E5E5E5">
|
---|
| 18 | <td valign=center>
|
---|
| 19 | <a href="index.html">
|
---|
| 20 | <font color="#004faf">Home</font></a>
|
---|
| 21 | | <a href="classes.html">
|
---|
| 22 | <font color="#004faf">All Classes</font></a>
|
---|
| 23 | | <a href="mainclasses.html">
|
---|
| 24 | <font color="#004faf">Main Classes</font></a>
|
---|
| 25 | | <a href="annotated.html">
|
---|
| 26 | <font color="#004faf">Annotated</font></a>
|
---|
| 27 | | <a href="groups.html">
|
---|
| 28 | <font color="#004faf">Grouped Classes</font></a>
|
---|
| 29 | | <a href="functions.html">
|
---|
| 30 | <font color="#004faf">Functions</font></a>
|
---|
| 31 | </td>
|
---|
| 32 | <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>
|
---|
| 33 |
|
---|
| 34 | <p>The QHttpHeader class contains header information for HTTP.
|
---|
| 35 | <a href="#details">More...</a>
|
---|
| 36 | <p><tt>#include <<a href="qhttp-h.html">qhttp.h</a>></tt>
|
---|
| 37 | <p>Inherited by <a href="qhttpresponseheader.html">QHttpResponseHeader</a> and <a href="qhttprequestheader.html">QHttpRequestHeader</a>.
|
---|
| 38 | <p><a href="qhttpheader-members.html">List of all member functions.</a>
|
---|
| 39 | <h2>Public Members</h2>
|
---|
| 40 | <ul>
|
---|
| 41 | <li class=fn><a href="#QHttpHeader"><b>QHttpHeader</b></a> ()</li>
|
---|
| 42 | <li class=fn><a href="#QHttpHeader-2"><b>QHttpHeader</b></a> ( const QHttpHeader & header )</li>
|
---|
| 43 | <li class=fn><a href="#QHttpHeader-3"><b>QHttpHeader</b></a> ( const QString & str )</li>
|
---|
| 44 | <li class=fn>virtual <a href="#~QHttpHeader"><b>~QHttpHeader</b></a> ()</li>
|
---|
| 45 | <li class=fn>QHttpHeader & <a href="#operator-eq"><b>operator=</b></a> ( const QHttpHeader & h )</li>
|
---|
| 46 | <li class=fn>QString <a href="#value"><b>value</b></a> ( const QString & key ) const</li>
|
---|
| 47 | <li class=fn>void <a href="#setValue"><b>setValue</b></a> ( const QString & key, const QString & value )</li>
|
---|
| 48 | <li class=fn>void <a href="#removeValue"><b>removeValue</b></a> ( const QString & key )</li>
|
---|
| 49 | <li class=fn>QStringList <a href="#keys"><b>keys</b></a> () const</li>
|
---|
| 50 | <li class=fn>bool <a href="#hasKey"><b>hasKey</b></a> ( const QString & key ) const</li>
|
---|
| 51 | <li class=fn>bool <a href="#hasContentLength"><b>hasContentLength</b></a> () const</li>
|
---|
| 52 | <li class=fn>uint <a href="#contentLength"><b>contentLength</b></a> () const</li>
|
---|
| 53 | <li class=fn>void <a href="#setContentLength"><b>setContentLength</b></a> ( int len )</li>
|
---|
| 54 | <li class=fn>bool <a href="#hasContentType"><b>hasContentType</b></a> () const</li>
|
---|
| 55 | <li class=fn>QString <a href="#contentType"><b>contentType</b></a> () const</li>
|
---|
| 56 | <li class=fn>void <a href="#setContentType"><b>setContentType</b></a> ( const QString & type )</li>
|
---|
| 57 | <li class=fn>virtual QString <a href="#toString"><b>toString</b></a> () const</li>
|
---|
| 58 | <li class=fn>bool <a href="#isValid"><b>isValid</b></a> () const</li>
|
---|
| 59 | <li class=fn>virtual int <a href="#majorVersion"><b>majorVersion</b></a> () const = 0</li>
|
---|
| 60 | <li class=fn>virtual int <a href="#minorVersion"><b>minorVersion</b></a> () const = 0</li>
|
---|
| 61 | </ul>
|
---|
| 62 | <hr><a name="details"></a><h2>Detailed Description</h2>
|
---|
| 63 |
|
---|
| 64 |
|
---|
| 65 | The QHttpHeader class contains header information for HTTP.
|
---|
| 66 |
|
---|
| 67 | <p>
|
---|
| 68 |
|
---|
| 69 | <p> In most cases you should use the more specialized derivatives of
|
---|
| 70 | this class, <a href="qhttpresponseheader.html">QHttpResponseHeader</a> and <a href="qhttprequestheader.html">QHttpRequestHeader</a>, rather
|
---|
| 71 | than directly using QHttpHeader.
|
---|
| 72 | <p> QHttpHeader provides the HTTP header fields. A HTTP header field
|
---|
| 73 | consists of a name followed by a colon, a single space, and the
|
---|
| 74 | field value. (See RFC 1945.) Field names are case-insensitive. A
|
---|
| 75 | typical header field looks like this:
|
---|
| 76 | <pre>
|
---|
| 77 | content-type: text/html
|
---|
| 78 | </pre>
|
---|
| 79 |
|
---|
| 80 | <p> In the API the header field name is called the "key" and the
|
---|
| 81 | content is called the "value". You can get and set a header
|
---|
| 82 | field's value by using its key with <a href="#value">value</a>() and <a href="#setValue">setValue</a>(), e.g.
|
---|
| 83 | <pre>
|
---|
| 84 | header.setValue( "content-type", "text/html" );
|
---|
| 85 | <a href="qstring.html">QString</a> contentType = header.value( "content-type" );
|
---|
| 86 | </pre>
|
---|
| 87 |
|
---|
| 88 | <p> Some fields are so common that getters and setters are provided
|
---|
| 89 | for them as a convenient alternative to using <a href="#value">value</a>() and
|
---|
| 90 | <a href="#setValue">setValue</a>(), e.g. <a href="#contentLength">contentLength</a>() and <a href="#contentType">contentType</a>(),
|
---|
| 91 | <a href="#setContentLength">setContentLength</a>() and <a href="#setContentType">setContentType</a>().
|
---|
| 92 | <p> Each header key has a <em>single</em> value associated with it. If you
|
---|
| 93 | set the value for a key which already exists the previous value
|
---|
| 94 | will be discarded.
|
---|
| 95 | <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>.
|
---|
| 96 |
|
---|
| 97 | <hr><h2>Member Function Documentation</h2>
|
---|
| 98 | <h3 class=fn><a name="QHttpHeader"></a>QHttpHeader::QHttpHeader ()
|
---|
| 99 | </h3>
|
---|
| 100 | Constructs an empty HTTP header.
|
---|
| 101 |
|
---|
| 102 | <h3 class=fn><a name="QHttpHeader-2"></a>QHttpHeader::QHttpHeader ( const <a href="qhttpheader.html">QHttpHeader</a> & header )
|
---|
| 103 | </h3>
|
---|
| 104 | Constructs a copy of <em>header</em>.
|
---|
| 105 |
|
---|
| 106 | <h3 class=fn><a name="QHttpHeader-3"></a>QHttpHeader::QHttpHeader ( const <a href="qstring.html">QString</a> & str )
|
---|
| 107 | </h3>
|
---|
| 108 | Constructs a HTTP header for <em>str</em>.
|
---|
| 109 | <p> This constructor parses the string <em>str</em> for header fields and
|
---|
| 110 | adds this information. The <em>str</em> should consist of one or more
|
---|
| 111 | "\r\n" delimited lines; each of these lines should have the format
|
---|
| 112 | key, colon, space, value.
|
---|
| 113 |
|
---|
| 114 | <h3 class=fn><a name="~QHttpHeader"></a>QHttpHeader::~QHttpHeader ()<tt> [virtual]</tt>
|
---|
| 115 | </h3>
|
---|
| 116 | Destructor.
|
---|
| 117 |
|
---|
| 118 | <h3 class=fn>uint <a name="contentLength"></a>QHttpHeader::contentLength () const
|
---|
| 119 | </h3>
|
---|
| 120 | Returns the value of the special HTTP header field <tt>content-length</tt>.
|
---|
| 121 | <p> <p>See also <a href="#setContentLength">setContentLength</a>() and <a href="#hasContentLength">hasContentLength</a>().
|
---|
| 122 |
|
---|
| 123 | <h3 class=fn><a href="qstring.html">QString</a> <a name="contentType"></a>QHttpHeader::contentType () const
|
---|
| 124 | </h3>
|
---|
| 125 | Returns the value of the special HTTP header field <tt>content-type</tt>.
|
---|
| 126 | <p> <p>See also <a href="#setContentType">setContentType</a>() and <a href="#hasContentType">hasContentType</a>().
|
---|
| 127 |
|
---|
| 128 | <h3 class=fn>bool <a name="hasContentLength"></a>QHttpHeader::hasContentLength () const
|
---|
| 129 | </h3>
|
---|
| 130 | Returns TRUE if the header has an entry for the special HTTP
|
---|
| 131 | header field <tt>content-length</tt>; otherwise returns FALSE.
|
---|
| 132 | <p> <p>See also <a href="#contentLength">contentLength</a>() and <a href="#setContentLength">setContentLength</a>().
|
---|
| 133 |
|
---|
| 134 | <h3 class=fn>bool <a name="hasContentType"></a>QHttpHeader::hasContentType () const
|
---|
| 135 | </h3>
|
---|
| 136 | Returns TRUE if the header has an entry for the the special HTTP
|
---|
| 137 | header field <tt>content-type</tt>; otherwise returns FALSE.
|
---|
| 138 | <p> <p>See also <a href="#contentType">contentType</a>() and <a href="#setContentType">setContentType</a>().
|
---|
| 139 |
|
---|
| 140 | <h3 class=fn>bool <a name="hasKey"></a>QHttpHeader::hasKey ( const <a href="qstring.html">QString</a> & key ) const
|
---|
| 141 | </h3>
|
---|
| 142 | Returns TRUE if the HTTP header has an entry with the given <em>key</em>; otherwise returns FALSE.
|
---|
| 143 | <p> <p>See also <a href="#value">value</a>(), <a href="#setValue">setValue</a>(), and <a href="#keys">keys</a>().
|
---|
| 144 |
|
---|
| 145 | <h3 class=fn>bool <a name="isValid"></a>QHttpHeader::isValid () const
|
---|
| 146 | </h3>
|
---|
| 147 | Returns TRUE if the HTTP header is valid; otherwise returns FALSE.
|
---|
| 148 | <p> A QHttpHeader is invalid if it was created by parsing a malformed string.
|
---|
| 149 |
|
---|
| 150 | <h3 class=fn><a href="qstringlist.html">QStringList</a> <a name="keys"></a>QHttpHeader::keys () const
|
---|
| 151 | </h3>
|
---|
| 152 | Returns a list of the keys in the HTTP header.
|
---|
| 153 | <p> <p>See also <a href="#hasKey">hasKey</a>().
|
---|
| 154 |
|
---|
| 155 | <h3 class=fn>int <a name="majorVersion"></a>QHttpHeader::majorVersion () const<tt> [pure virtual]</tt>
|
---|
| 156 | </h3>
|
---|
| 157 |
|
---|
| 158 | <p> Returns the major protocol-version of the HTTP header.
|
---|
| 159 |
|
---|
| 160 | <p>Reimplemented in <a href="qhttpresponseheader.html#majorVersion">QHttpResponseHeader</a> and <a href="qhttprequestheader.html#majorVersion">QHttpRequestHeader</a>.
|
---|
| 161 | <h3 class=fn>int <a name="minorVersion"></a>QHttpHeader::minorVersion () const<tt> [pure virtual]</tt>
|
---|
| 162 | </h3>
|
---|
| 163 |
|
---|
| 164 | <p> Returns the minor protocol-version of the HTTP header.
|
---|
| 165 |
|
---|
| 166 | <p>Reimplemented in <a href="qhttpresponseheader.html#minorVersion">QHttpResponseHeader</a> and <a href="qhttprequestheader.html#minorVersion">QHttpRequestHeader</a>.
|
---|
| 167 | <h3 class=fn><a href="qhttpheader.html">QHttpHeader</a> & <a name="operator-eq"></a>QHttpHeader::operator= ( const <a href="qhttpheader.html">QHttpHeader</a> & h )
|
---|
| 168 | </h3>
|
---|
| 169 | Assigns <em>h</em> and returns a reference to this http header.
|
---|
| 170 |
|
---|
| 171 | <h3 class=fn>void <a name="removeValue"></a>QHttpHeader::removeValue ( const <a href="qstring.html">QString</a> & key )
|
---|
| 172 | </h3>
|
---|
| 173 | Removes the entry with the key <em>key</em> from the HTTP header.
|
---|
| 174 | <p> <p>See also <a href="#value">value</a>() and <a href="#setValue">setValue</a>().
|
---|
| 175 |
|
---|
| 176 | <h3 class=fn>void <a name="setContentLength"></a>QHttpHeader::setContentLength ( int len )
|
---|
| 177 | </h3>
|
---|
| 178 | Sets the value of the special HTTP header field <tt>content-length</tt>
|
---|
| 179 | to <em>len</em>.
|
---|
| 180 | <p> <p>See also <a href="#contentLength">contentLength</a>() and <a href="#hasContentLength">hasContentLength</a>().
|
---|
| 181 |
|
---|
| 182 | <h3 class=fn>void <a name="setContentType"></a>QHttpHeader::setContentType ( const <a href="qstring.html">QString</a> & type )
|
---|
| 183 | </h3>
|
---|
| 184 | Sets the value of the special HTTP header field <tt>content-type</tt> to
|
---|
| 185 | <em>type</em>.
|
---|
| 186 | <p> <p>See also <a href="#contentType">contentType</a>() and <a href="#hasContentType">hasContentType</a>().
|
---|
| 187 |
|
---|
| 188 | <p>Example: <a href="archivesearch-example.html#x475">network/archivesearch/archivedialog.ui.h</a>.
|
---|
| 189 | <h3 class=fn>void <a name="setValue"></a>QHttpHeader::setValue ( const <a href="qstring.html">QString</a> & key, const <a href="qstring.html">QString</a> & value )
|
---|
| 190 | </h3>
|
---|
| 191 | Sets the value of the entry with the <em>key</em> to <em>value</em>.
|
---|
| 192 | <p> If no entry with <em>key</em> exists, a new entry with the given <em>key</em>
|
---|
| 193 | and <em>value</em> is created. If an entry with the <em>key</em> already
|
---|
| 194 | exists, its value is discarded and replaced with the given <em>value</em>.
|
---|
| 195 | <p> <p>See also <a href="#value">value</a>(), <a href="#hasKey">hasKey</a>(), and <a href="#removeValue">removeValue</a>().
|
---|
| 196 |
|
---|
| 197 | <p>Example: <a href="archivesearch-example.html#x476">network/archivesearch/archivedialog.ui.h</a>.
|
---|
| 198 | <h3 class=fn><a href="qstring.html">QString</a> <a name="toString"></a>QHttpHeader::toString () const<tt> [virtual]</tt>
|
---|
| 199 | </h3>
|
---|
| 200 | Returns a string representation of the HTTP header.
|
---|
| 201 | <p> The string is suitable for use by the constructor that takes a
|
---|
| 202 | <a href="qstring.html">QString</a>. It consists of lines with the format: key, colon, space,
|
---|
| 203 | value, "\r\n".
|
---|
| 204 |
|
---|
| 205 | <h3 class=fn><a href="qstring.html">QString</a> <a name="value"></a>QHttpHeader::value ( const <a href="qstring.html">QString</a> & key ) const
|
---|
| 206 | </h3>
|
---|
| 207 | Returns the value for the entry with the given <em>key</em>. If no entry
|
---|
| 208 | has this <em>key</em>, an empty string is returned.
|
---|
| 209 | <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>().
|
---|
| 210 |
|
---|
| 211 | <!-- eof -->
|
---|
| 212 | <hr><p>
|
---|
| 213 | This file is part of the <a href="index.html">Qt toolkit</a>.
|
---|
| 214 | Copyright © 1995-2007
|
---|
| 215 | <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
---|
| 216 | <table width=100% cellspacing=0 border=0><tr>
|
---|
| 217 | <td>Copyright © 2007
|
---|
| 218 | <a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
---|
| 219 | <td align=right><div align=right>Qt 3.3.8</div>
|
---|
| 220 | </table></div></address></body>
|
---|
| 221 | </html>
|
---|