Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <cheadercodec.h>
Link against: http.lib
This item is not part of the S60 5th Edition SDK

Class CHeaderCodec

class CHeaderCodec : public CBase;

Description

An abstract HTTP header codec.

Each instance of a concrete subclass of CHeaderCodec is associated with, and owned by, a specific CProtocolHandler. It provides on-demand encoding/decoding of HTTP header data, between the generic format used by clients/filters to formulate requests and interpret responses, and the raw format used by the transport handlers (and origin servers/gateways/etc.)

The CHeaderCodec has an associated instance of a sub-class of each of CHeaderReader and CHeaderWriter. It delegates the actual encoding and decoding function to these instances.

Header codecs provide a mechanism for extensibility whereby if one codec can't decode (or encode) a given header, it locates a codec that can, and then delegates the task to that codec instead.

Derivation

Members

Defined in CHeaderCodec:

Inherited from CBase:


Construction and destruction


~CHeaderCodec()

IMPORT_C virtual ~CHeaderCodec();

Description

Intended Usage: Destructor - cleans up and releases resources to the system.


CHeaderCodec()

protected: IMPORT_C CHeaderCodec();

Description

Default constructor.


ConstructL()

protected: IMPORT_C void ConstructL();

Description

Second phase construction in which any necessary allocation is done Implementations of this interface may leave with standard erros like KErrNoMemory if there is insufficient memory for allocation in the second phase.

[Top]


Member functions


EncodeHeaderL(RHeaderField &)const

IMPORT_C void EncodeHeaderL(RHeaderField &aHeader) const;

Description

Encode the supplied header field. This method uses the associated concrete CHeaderWriter object to do a conversion of the field into raw form from the generic internal representation.

Parameters

RHeaderField &aHeader

(in) A proxy for the header field to be encoded

Leave codes

KErrNotSupported

if a codec that supports encoding this header cannot be found


DecodeHeaderL(RHeaderField &)const

IMPORT_C void DecodeHeaderL(RHeaderField &aHeader) const;

Description

Decode the supplied header field. This method uses the associated concrete CHeaderReader object to do a conversion of the field into the generic internal representation from the raw form.

Parameters

RHeaderField &aHeader

(in) A proxy for the header field to be decoded

Leave codes

KErrNotSupported

if a codec that supports decoding this header cannot be found


CanEncode(RStringF)const

virtual TBool CanEncode(RStringF aHeaderField) const=0;

Description

Intended Usage: Concrete header codec classes must implement this method to indicate to the framework whether their concrete CHeaderWriter is capable of encoding the named header field.

Parameters

RStringF aHeaderField

(in) A proxy for the header field to be encoded

Return value

TBool

A flag indicating ETrue if the field can be encoded.


CanDecode(RStringF)const

virtual TBool CanDecode(RStringF aHeaderField) const=0;

Description

Intended Usage: Concrete header codec classes must implement this method to indicate to the framework whether their concrete CHeaderReader is capable of decoding the named header field.

Parameters

RStringF aHeaderField

(in) A proxy for the header field to be encoded

Return value

TBool

A flag indicating ETrue if the field can be decoded.


FindDelegateCodecL(RStringF)const

virtual CHeaderCodec* FindDelegateCodecL(RStringF aHeaderField) const=0;

Description

Intended Usage: Concrete header codecs must be implement this method if they wish to delegate the encoding/decoding of particular header fields to a different codec. This would be done if the codec doesn't have the ability itself to do the encode/decode but can locate an alternative that does. This function may leave with a Standard Symbian OS error code. eg. KErrNoMemory

The caller takes ownership of the returned codec.

Parameters

RStringF aHeaderField

(in) A proxy for the header field to be encoded

Return value

CHeaderCodec *

A pointer to the new CHeaderCodec, or NULL if one couldn't be found.

Leave codes

KErrNoMemory,

Not enough memory to create object.


Reserved1()

private: inline virtual void Reserved1();

Description

Intended Usage: Reserve a slot in the v-table to preserve future BC


Reserved2()

private: inline virtual void Reserved2();

Description

Intended Usage: Reserve a slot in the v-table to preserve future BC

[Top]


Member data


iWriter

protected: CHeaderWriter * iWriter;

Description

The owned header writer object that does actual encoding of header fields.


iReader

protected: CHeaderReader * iReader;

Description

The owned header reader object that does actual decoding of header fields.