CWspHeaderEncoder Class Reference

#include <wspencoder.h>

class CWspHeaderEncoder : public CBase

Inherits from

Public Member Functions
virtual ~CWspHeaderEncoder()
IMPORT_C voidAddDataL(const TDesC8 &)
IMPORT_C voidAddDateL(const TDateTime)
IMPORT_C voidAddIntegerL(const TUint)
IMPORT_C voidAddLongIntL(const TUint32)
IMPORT_C voidAddShortIntL(const TUint8)
IMPORT_C voidAddShortLengthL(const TUint8)
IMPORT_C voidAddTextStringL(const RString &)
IMPORT_C voidAddTextStringL(const TDesC8 &)
IMPORT_C voidAddTokenL(const TUint8)
IMPORT_C voidAddTokenTextL(const TDesC8 &)
IMPORT_C voidAddUintVarL(const TUint)
IMPORT_C HBufC8 *EndHeaderL()
IMPORT_C voidEndValueLengthL()
IMPORT_C CWspHeaderEncoder *NewL()
IMPORT_C CWspHeaderEncoder *NewLC()
IMPORT_C voidStartHeaderL(TUint8)
IMPORT_C voidStartHeaderL(const TDesC8 &)
IMPORT_C voidStartHeaderL(const RStringF)
IMPORT_C voidStartValueLengthL()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()

Detailed Description

This class can be used to encode one header field at a time, with all its values and parameters.

It has no knowledge of encoding the BNF of a particular header field, but the functions provided can be used in combination, producing an 8-bit buffer containing the encoded header.

Intended usage would be to call a series of functions. The first one being StartHeader, The final one being EndHeader, which would return a buffer containing the complete encoded header field. eg: encoder->DeprecatedStartHeaderL(); encoder->AddLongIntL(); encoder->AddTextStringL(); HBufC8* output = encoder->EndHeaderL();

Constructor & Destructor Documentation

~CWspHeaderEncoder ( )

IMPORT_C~CWspHeaderEncoder()[virtual]

Default destructor

Member Function Documentation

AddDataL ( const TDesC8 & )

IMPORT_C voidAddDataL(const TDesC8 &aData)

Encodes input and adds it to the encoded field. Adds value as-is to the encoded field.

Parameters
aDatavalue to be encoded.
Leave Codes
KErrNoMemory

AddDateL ( const TDateTime )

IMPORT_C voidAddDateL(const TDateTimeaDate)

Encodes input and adds it to the encoded field.Encodes parameter value using WSP Date method.

Pre-condition
StartHeaderL needs to have been called.
Parameters
aDatevalue to be encoded.
Leave Codes
KErrNoMemory

AddIntegerL ( const TUint )

IMPORT_C voidAddIntegerL(const TUintaInt)

Encodes input Integer value and adds it to the encoded field. Choice of encoded form dependent on the size of the input.Either ShortInt or LongInt method chosen.

Pre-condition
StartHeaderL needs to have been called.
Parameters
aIntInteger value to be encoded.
Leave Codes
KErrNoMemory

AddLongIntL ( const TUint32 )

IMPORT_C voidAddLongIntL(const TUint32aValue)

Encodes input and adds it to the encoded field. Encodes parameter value using WSP LongInt method.

Pre-condition
StartHeaderL needs to have been called.
Parameters
aValuevalue to be encoded.
Leave Codes
KErrNoMemory

AddShortIntL ( const TUint8 )

IMPORT_C voidAddShortIntL(const TUint8aValue)

Encodes input and adds it to the encoded field. Encodes parameter value using WSP ShortInt method.

Pre-condition
StartHeaderL needs to have been called.
Parameters
aValuevalue to be encoded.
Leave Codes
KErrNoMemory

AddShortLengthL ( const TUint8 )

IMPORT_C voidAddShortLengthL(const TUint8aValue)

Encodes input and adds it to the encoded field. For short length the value must be between octet 0 - 31.

Pre-condition
StartHeaderL needs to have been called.
Parameters
aValuevalue to be encoded.
Leave Codes
KErrNoMemory,KErrOverflow if the value is greater than 31

AddTextStringL ( const RString & )

IMPORT_C voidAddTextStringL(const RString &aText)

Encodes input and adds it to the encoded field. Encodes parameter value using WSP TextString method.

Pre-condition
StartHeaderL needs to have been called.
Parameters
aTextvalue to be encoded.
Leave Codes
KErrNoMemory

AddTextStringL ( const TDesC8 & )

IMPORT_C voidAddTextStringL(const TDesC8 &aText)

Encodes input and adds it to the encoded field. Encodes parameter value using WSP TextString method.

Pre-condition
StartHeaderL needs to have been called.
Parameters
aTextvalue to be encoded.
Leave Codes
KErrNoMemory

AddTokenL ( const TUint8 )

IMPORT_C voidAddTokenL(const TUint8aToken)

Encodes input and adds it to the encoded field. Adds value as-is to the encoded field.

Pre-condition
StartHeaderL and StartValueLengthL should have been called.
Post-condition
EndValueLengthL needs to be called subsequently.
Parameters
aTokenparameter added without encodeing. Should be a valid WSP token, a 8 bit number > 0x7F (i.e. top bit set).

AddTokenTextL ( const TDesC8 & )

IMPORT_C voidAddTokenTextL(const TDesC8 &aTokenText)

Encodes input and adds it to the encoded field. Encodes parameter value using WSP TokenText method.

Parameters
aTokenTextvalue to be encoded.
Leave Codes
KErrNoMemory

AddUintVarL ( const TUint )

IMPORT_C voidAddUintVarL(const TUintaInt)

Encodes input and adds it to the encoded field. Encodes parameter value using WSP UIntVar method.

Pre-condition
StartHeaderL needs to have been called.
Parameters
aIntvalue to be encoded.
Leave Codes
KErrNoMemory

EndHeaderL ( )

IMPORT_C HBufC8 *EndHeaderL()

Completes and returns encoded field 8 bit buffer. This method will panic if an EndValueLengthL() is not called after a StartValueLength().

Note: The final buffer containing the entire encoded header is constructed. Returns buffer containing the encoded field constructed from the first call to StartHeaderL.

Pre-condition
The function StartHeaderL should have been called.
Post-condition
Encoder is reset ready to be used again.
Return Value
Pointer to buffer containing the entire encoded field. Responsibility for deallocating the memory is also passed.
Leave Codes

EndValueLengthL ( )

IMPORT_C voidEndValueLengthL()

Needs to be called at the point in the construction of a header when ValueLength can be calculated.

Pre-condition
StartHeaderL and StartValueLengthL should have been called.
Post-condition
ValueLength has been calculated and added, together with the encoded header, to the internal representation of the header buffer.
Leave Codes
KErrNoMemory

NewL ( )

IMPORT_C CWspHeaderEncoder *NewL()[static]

Static factory constructor.

Return Value
returns a Pointer to fully constructed CWspHeaderEncoder object.
Leave Codes
KErrNoMemory

NewLC ( )

IMPORT_C CWspHeaderEncoder *NewLC()[static]

Static factory constructor.

Return Value
returns a Pointer to fully constructed CWspHeaderEncoder object on the Heap.
Leave Codes
KErrNoMemory

StartHeaderL ( TUint8 )

IMPORT_C voidStartHeaderL(TUint8aToken)

Starts a new encoded header.

Parameters
aTokenfield name being encoded as a Token value.
Leave Codes
KErrNoMemory

StartHeaderL ( const TDesC8 & )

IMPORT_C voidStartHeaderL(const TDesC8 &aString)

Starts a new encoded header.

Parameters
aStringFieldname parameter is encoded as a TextString.
Leave Codes
KErrNoMemory

StartHeaderL ( const RStringF )

IMPORT_C voidStartHeaderL(const RStringFaString)

Starts a new encoded header.

Parameters
aStringFieldname parameter is encoded as a TextString.
Leave Codes
KErrNotSupported

StartValueLengthL ( )

IMPORT_C voidStartValueLengthL()
From calling this function, the length in bytes of all encodings added subsequently will be calculated and stored as part of the encoded string, as specified in WSP spec.Can be nested. i.e.
	 encoder->StartHeaderL();
	 encoder->StartValueLengthL();
	 encoder->StartValueLengthL();
	 encoder->AddLongIntL();
	 encoder->EndValueLengthL();
	 encoder->AddTextStringL();
	 encoder->EndValueLengthL();
	 HBufC8* output = encoder->EndHeaderL();
Pre-condition
StartHeaderL should have been called.
Post-condition
EndValueLengthL needs to be called subsequently.
Leave Codes
KErrNoMemory