TQHttpHeader(3qt)

NAME
TQHttpHeader - Header information for HTTP

SYNOPSIS
#include <tqhttp.h>

Inherited by TQHttpResponseHeader and TQHttpRequestHeader.

  Public Members
TQHttpHeader ()
TQHttpHeader ( const TQHttpHeader & header )
TQHttpHeader ( const TQString & str )
virtual ~TQHttpHeader ()
TQHttpHeader & operator= ( const TQHttpHeader & h )
TQString value ( const TQString & key ) const
void setValue ( const TQString & key, const TQString & value )
void removeValue ( const TQString & key )
TQStringList keys () const
bool hasKey ( const TQString & key ) const
bool hasContentLength () const
uint contentLength () const
void setContentLength ( int len )
bool hasContentType () const
TQString contentType () const
void setContentType ( const TQString & type )
virtual TQString toString () const
bool isValid () const
virtual int majorVersion () const = 0
virtual int minorVersion () const = 0

DESCRIPTION
The TQHttpHeader class contains header information for HTTP.

In most cases you should use the more specialized derivatives of this class, TQHttpResponseHeader and TQHttpRequestHeader, rather than directly using TQHttpHeader.

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:

    content-type: text/html

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 value() and setValue(), e.g.

    header.setValue( "content-type", "text/html" );
    TQString contentType = header.value( "content-type" );

Some fields are so common that getters and setters are provided for them as a convenient alternative to using value() and setValue(), e.g. contentLength() and contentType(), setContentLength() and setContentType().

Each header key has a single value associated with it. If you set the value for a key which already exists the previous value will be discarded.

See also TQHttpRequestHeader, TQHttpResponseHeader, and Input/Output and Networking.

MEMBER FUNCTION DOCUMENTATION

TQHttpHeader::TQHttpHeader ()
Constructs an empty HTTP header.

TQHttpHeader::TQHttpHeader ( const TQHttpHeader & header )
Constructs a copy of header.

TQHttpHeader::TQHttpHeader ( const TQString & str )
Constructs a HTTP header for str.

This constructor parses the string str for header fields and adds this information. The str should consist of one or more" \r\n" delimited lines; each of these lines should have the format key, colon, space, value.

TQHttpHeader::~TQHttpHeader () [virtual]
Destructor.

uint TQHttpHeader::contentLength () const
Returns the value of the special HTTP header field content-length.

See also setContentLength() and hasContentLength().

TQString TQHttpHeader::contentType () const
Returns the value of the special HTTP header field content-type.

See also setContentType() and hasContentType().

bool TQHttpHeader::hasContentLength () const
Returns true if the header has an entry for the special HTTP header field content-length; otherwise returns false.

See also contentLength() and setContentLength().

bool TQHttpHeader::hasContentType () const
Returns true if the header has an entry for the the special HTTP header field content-type; otherwise returns false.

See also contentType() and setContentType().

bool TQHttpHeader::hasKey ( const TQString & key ) const
Returns true if the HTTP header has an entry with the given key; otherwise returns false.

See also value(), setValue(), and keys().

bool TQHttpHeader::isValid () const
Returns true if the HTTP header is valid; otherwise returns false.

A TQHttpHeader is invalid if it was created by parsing a malformed string.

TQStringList TQHttpHeader::keys () const
Returns a list of the keys in the HTTP header.

See also hasKey().

int TQHttpHeader::majorVersion () const [pure virtual]
Returns the major protocol-version of the HTTP header.

Reimplemented in TQHttpResponseHeader and TQHttpRequestHeader.

int TQHttpHeader::minorVersion () const [pure virtual]
Returns the minor protocol-version of the HTTP header.

Reimplemented in TQHttpResponseHeader and TQHttpRequestHeader.

TQHttpHeader & TQHttpHeader::operator= ( const TQHttpHeader & h )
Assigns h and returns a reference to this http header.

void TQHttpHeader::removeValue ( const TQString & key )
Removes the entry with the key key from the HTTP header.

See also value() and setValue().

void TQHttpHeader::setContentLength ( int len )
Sets the value of the special HTTP header field content-length to len.

See also contentLength() and hasContentLength().

void TQHttpHeader::setContentType ( const TQString & type )
Sets the value of the special HTTP header field content-type to type.

See also contentType() and hasContentType().

Example: network/archivesearch/archivedialog.ui.h.

void TQHttpHeader::setValue ( const TQString & key, const TQString & value )
Sets the value of the entry with the key to value.

If no entry with key exists, a new entry with the given key and value is created. If an entry with the key already exists, its value is discarded and replaced with the given value.

See also value(), hasKey(), and removeValue().

Example: network/archivesearch/archivedialog.ui.h.

TQString TQHttpHeader::toString () const [virtual]
Returns a string representation of the HTTP header.

The string is suitable for use by the constructor that takes a TQString. It consists of lines with the format: key, colon, space, value, "\r\n".

TQString TQHttpHeader::value ( const TQString & key ) const
Returns the value for the entry with the given key. If no entry has this key, an empty string is returned.

See also setValue(), removeValue(), hasKey(), and keys().

SEE ALSO
http://doc.trolltech.com/tqhttpheader.html http://www.trolltech.com/faq/tech.html

COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.

AUTHOR
Generated automatically from the source code.

BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you.

The definitive TQt documentation is provided in HTML format; it is located at $TQTDIR/doc/html and can be read using TQt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech.

If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (tqhttpheader.3qt) and the Qt version (3.3.8).