class CHeaderField : public CBase |
Generalised internal representation of a single HTTP header field. The field's value may be contained as raw data as received by HTTP, or in a object-oriented parsed form, which is accessible to the client via the class API.
Each field has a type and a (potentially complex) value. The type must be chosen at construction time, and remains the same during the header's lifetime.
Simple headers are represented using a single 'part'. Several factory methods are provided for each type the part can take; e.g.
Max-Forwards: 3 -- a single integer value Location: http://ayg.com/ -- a single string token value Expires: Mon, 15 Jan 2001 10:30:25 GMT -- a single date/time value
More complex headers are possible (see the RFC2116 for many more examples) which are built up from several parts; e.g.
Accept: text/wml, application/vnd.wap.wmlc -- a header with two string token parts Allow: GET, POST, HEAD -- a header with three string token parts
Multiple parts are supported by the CHeaderFieldPart class.
Furthermore, some headers allow parameters to be supplied in the form of attribute-value pairs. These may be present on any part of the header, according to the syntax defined in the RFC; e.g.
Accept-Charset: utf-8; q=0.8, us-ascii; q=0.2 Cache-Control: maxage=6000
Parameters are supported by the CHeaderFieldParam class.
The classes CHeaderField, CHeaderFieldPart and CHeaderFieldParam are internal header representations and will only be manipulated by protocol handlers and filters. Only the RHTTPHeaders and THTTPHdrVal classes are intended for use by the Client. RHTTPHeaders THTTPHdrVal CHeaderFieldPart CHeaderFieldParam
Public Member Functions | |
---|---|
~CHeaderField() | |
TInt | AddPart(CHeaderFieldPart *) |
void | AddPartL(CHeaderFieldPart *) |
void | BeginRawDataL(TInt) |
void | CommitRawData() |
TInt | ConvertToParsedFormat() |
void | InsertPartL(CHeaderFieldPart *, TInt) |
RStringF | Name() |
CHeaderField * | New(RStringF, CHeaders &) |
CHeaderField * | NewL(RStringF, CHeaders &) |
CHeaderField * | NewL(RStringF, CHeaders &, THTTPHdrVal) |
CHeaderField * | NewL(RStringF, CHeaders &, const TDesC8 &) |
TInt | NumPartsL() |
TInt | Part(TInt, CHeaderFieldPart *&) |
CHeaderFieldPart * | PartL(TInt) |
THeaderFieldPartIter | PartsL() |
IMPORT_C void | RawDataL(TPtrC8 &) |
TInt | RemovePartL(CHeaderFieldPart *) |
TInt | RemovePartL(TInt) |
void | SetPartL(CHeaderFieldPart *, TInt) |
TInt | SplitValueAndParameterArray() |
void | WriteRawDataL(const TDesC8 &) |
void | WriteRawDataL(TChar) |
Private Member Functions | |
---|---|
CHeaderField(RStringF, CHeaders &) | |
void | ClearParsedData() |
void | ClearRawData() |
void | ConstructL(const TDesC8 &) |
void | ConvertToParsedFormatL() |
void | ConvertToRawFormatL() |
Private Member Enumerations | |
---|---|
enum | TDataState { ENoDataSupplied = 0x00, EDataInRawForm = 0x01, EDataParsedOK = 0x02, EDataParseError = 0x03 } |
CHeaderField | ( | RStringF | aHeaderFieldName, |
CHeaders & | aOwner | ||
) | [private] |
Standard constructor. Used when client constructs headers.
TInt | AddPart | ( | CHeaderFieldPart * | aPart | ) |
CHeaderFieldPart * aPart |
void | AddPartL | ( | CHeaderFieldPart * | aPart | ) |
CHeaderFieldPart * aPart | The part to be added. The header takes ownership of the new part. |
void | BeginRawDataL | ( | TInt | aChunkSize = KHttpDefaultRawChunkSize | ) |
TInt aChunkSize = KHttpDefaultRawChunkSize |
void | CommitRawData | ( | ) |
Commit the Raw data. The parsed header parts and parameters are removed. Note this is for use only by the header codec.
void | ConstructL | ( | const TDesC8 & | aRawData | ) | [private] |
Phase Two construction. This variant copies-to-keep the supplied Raw data buffer.
const TDesC8 & aRawData | An 8-bit buffer containing raw header data received by HTTP. |
void | ConvertToParsedFormatL | ( | ) | [private] |
void | ConvertToRawFormatL | ( | ) | [private] |
void | InsertPartL | ( | CHeaderFieldPart * | aPart, |
TInt | aIndex | |||
) |
CHeaderFieldPart * aPart | The part to be inserted. The header takes ownership of the new part. |
TInt aIndex | The index at which the part is to be inserted. |
CHeaderField * | NewL | ( | RStringF | aHeaderFieldName, |
CHeaders & | aOwner | |||
) | [static] |
CHeaderField * | NewL | ( | RStringF | aHeaderFieldName, |
CHeaders & | aOwner, | |||
THTTPHdrVal | aVal | |||
) | [static] |
RStringF aHeaderFieldName | The header field type. |
CHeaders & aOwner | The header fields collection that this field belongs to |
THTTPHdrVal aVal | The header field value. A copy is taken when storing. |
CHeaderField * | NewL | ( | RStringF | aHeaderFieldName, |
CHeaders & | aOwner, | |||
const TDesC8 & | aRawData | |||
) | [static] |
TInt | NumPartsL | ( | ) |
TInt | Part | ( | TInt | aindex, |
CHeaderFieldPart *& | aPart | |||
) |
TInt aindex | |
CHeaderFieldPart *& aPart |
CHeaderFieldPart * | PartL | ( | TInt | aIndex | ) |
TInt aIndex | The index of the desired part. 0 references the first one. |
THeaderFieldPartIter | PartsL | ( | ) |
IMPORT_C void | RawDataL | ( | TPtrC8 & | aRawData | ) |
TPtrC8 & aRawData |
TInt | RemovePartL | ( | CHeaderFieldPart * | aPart | ) |
CHeaderFieldPart * aPart | The part to be removed. The header deletes the removed part. |
TInt | RemovePartL | ( | TInt | aIndex | ) |
TInt aIndex | An index to the part to be removed. The header deletes the removed part. |
void | SetPartL | ( | CHeaderFieldPart * | aPart, |
TInt | aIndex | |||
) |
Set a part in the header. It replaces any existing parts at the specified index. Note this is for use only by the header codec, when converting Raw data into parsed header parts from parsed Raw data. This function may leave with any of the system wide error codes, if the attempt to append this part to the internal list fails. Setters
CHeaderFieldPart * aPart | The part to be added. The header takes ownership of the new part. |
TInt aIndex | The index of the part you are replacing |
void | WriteRawDataL | ( | const TDesC8 & | aData | ) |
const TDesC8 & aData |
void | WriteRawDataL | ( | TChar | aData | ) |
TChar aData |
Enumeration of the states in which this header's value data can exist.
ENoDataSupplied = 0x00 |
the header object is not populated with data after construction |
EDataInRawForm = 0x01 |
the data is in it's raw form, i.e. not accessible by part |
EDataParsedOK = 0x02 |
the data is in it's client representation, i.e. parsed into parts. |
EDataParseError = 0x03 |
the data could not be parsed so remains in Raw form |
TDataState | iDataParseState | [private] |
Has this header been parsed yet? did it parse correctly?
RPointerArray< CHeaderFieldPart > | iElementArray | [private] |
RPointerArray< CHeaderFieldParam > | iParameterArray | [private] |
RPointerArray< CHeaderFieldPart > | iParts | [private] |
Header data - in parsed format. TodoIs it worth this being a union?
TInt | iRawChunkSize | [private] |
Size of data chunk used when allocating and extending the Raw data buffer
HBufC8 * | iRawData | [private] |
Header data - in Raw format. TodoIs it worth this being a union?
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.