Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: WSPEncoder.h
Link against: inetprotutil.lib

Class CWspHeaderEncoder

class CWspHeaderEncoder : public CBase;

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->StartHeaderL(); encoder->AddLongIntL(); encoder->AddTextStringL(); HBufC8* output = encoder->EndHeaderL();

Derivation

Members

Defined in CWspHeaderEncoder:
AddDataL(), AddDateL(), AddIntegerL(), AddLongIntL(), AddShortIntL(), AddShortLengthL(), AddTextStringL(), AddTextStringL(), AddTokenL(), AddTokenTextL(), AddUintVarL(), EndHeaderL(), EndValueLengthL(), NewL(), NewLC(), StartHeaderL(), StartHeaderL(), StartHeaderL(), StartValueLengthL(), ~CWspHeaderEncoder()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

static IMPORT_C CWspHeaderEncoder *NewL();

Description

Static factory constructor.

Return value

CWspHeaderEncoder *

Leave codes

KErrNoMemory


NewLC()

static IMPORT_C CWspHeaderEncoder *NewLC();

Description

Static factory constructor.

Return value

CWspHeaderEncoder *

Leave codes

KErrNoMemory


~CWspHeaderEncoder()

virtual IMPORT_C ~CWspHeaderEncoder();

Description

Default destructor

[Top]


Member functions


StartHeaderL()

IMPORT_C void StartHeaderL(TUint8 aToken);

Description

Starts a new encoded header.

Parameters

TUint8 aToken

field name being encoded as a Token value.

Leave codes

KErrNoMemory


StartHeaderL()

IMPORT_C void StartHeaderL(const TDesC8 &aString);

Description

Starts a new encoded header.

Parameters

const TDesC8 &aString

Fieldname parameter is encoded as a TextString.

Leave codes

KErrNoMemory


StartHeaderL()

IMPORT_C void StartHeaderL(const RStringF aString);

Description

Starts a new encoded header.

Parameters

const RStringF aString

Fieldname parameter is encoded as a TextString.

Leave codes

KErrNotSupported


EndHeaderL()

IMPORT_C HBufC8 *EndHeaderL();

Pre-Condition

The function StartHeaderL should have been called.

Description

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

Post-Condition

Encoder is reset ready to be used again.

Return value

HBufC8 *

Pointer to buffer containing the entire encoded field. Responsibility for deallocating the memory is also passed.

Leave codes

HBufC8::NewL

leaves, if the new 8 bit heap descriptor cannot be created.


AddIntegerL()

IMPORT_C void AddIntegerL(const TUint aInt);

Pre-Condition

StartHeaderL needs to have been called.

Description

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.

Parameters

const TUint aInt

Integer value to be encoded.

Leave codes

KErrNoMemory


AddShortIntL()

IMPORT_C void AddShortIntL(const TUint8 aValue);

Pre-Condition

StartHeaderL needs to have been called.

Description

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

Parameters

const TUint8 aValue

value to be encoded.

Leave codes

KErrNoMemory


AddShortLengthL()

IMPORT_C void AddShortLengthL(const TUint8 aValue);

Pre-Condition

StartHeaderL needs to have been called.

Description

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

Parameters

const TUint8 aValue

value to be encoded.

Leave codes

KErrNoMemory,

KErrOverflow if the value is greater than 31


AddLongIntL()

IMPORT_C void AddLongIntL(const TUint32 aValue);

Pre-Condition

StartHeaderL needs to have been called.

Description

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

Parameters

const TUint32 aValue

value to be encoded.

Leave codes

KErrNoMemory


AddUintVarL()

IMPORT_C void AddUintVarL(const TUint aInt);

Pre-Condition

StartHeaderL needs to have been called.

Description

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

Parameters

const TUint aInt

value to be encoded.

Leave codes

KErrNoMemory


AddTextStringL()

IMPORT_C void AddTextStringL(const RString &aText);

Pre-Condition

StartHeaderL needs to have been called.

Description

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

Parameters

const RString &aText

value to be encoded.

Leave codes

KErrNoMemory


AddTextStringL()

IMPORT_C void AddTextStringL(const TDesC8 &aText);

Pre-Condition

StartHeaderL needs to have been called.

Description

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

Parameters

const TDesC8 &aText

value to be encoded.

Leave codes

KErrNoMemory


AddDateL()

IMPORT_C void AddDateL(const TDateTime aDate);

Pre-Condition

StartHeaderL needs to have been called.

Description

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

Parameters

const TDateTime aDate

value to be encoded.

Leave codes

KErrNoMemory


AddTokenL()

IMPORT_C void AddTokenL(const TUint8 aToken);

Pre-Condition

StartHeaderL and StartValueLengthL should have been called.

Description

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

Post-Condition

EndValueLengthL needs to be called subsequently.

Parameters

const TUint8 aToken

parameter added without encodeing. Should be a valid WSP token, a 8 bit number > 0x7F (i.e. top bit set)


AddTokenTextL()

IMPORT_C void AddTokenTextL(const TDesC8 &aTokenText);

Description

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

Parameters

const TDesC8 &aTokenText

Leave codes

KErrNoMemory


AddDataL()

IMPORT_C void AddDataL(const TDesC8 &aData);

Description

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

Parameters

const TDesC8 &aData

value to be encoded.

Leave codes

KErrNoMemory


StartValueLengthL()

IMPORT_C void StartValueLengthL();

Pre-Condition

StartHeaderL should have been called.

Description

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();

Post-Condition

EndValueLengthL needs to be called subsequently.

Leave codes

KErrNoMemory


EndValueLengthL()

IMPORT_C void EndValueLengthL();

Pre-Condition

StartHeaderL and StartValueLengthL should have been called.

Description

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

Post-Condition

ValueLength has been calculated and added, together with the encoded header, to the internal representation of the header buffer.

Leave codes

KErrNoMemory