Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <WSPDecoder.h>
Link against: inetprotutil.lib

Class TWspPrimitiveDecoder

class TWspPrimitiveDecoder;

Description

Decoder for WSP Primitves - WAP-WSP Section 8.4.1

Members

Defined in TWspPrimitiveDecoder:


Construction and destruction


TWspPrimitiveDecoder(TPtrC8)

inline TWspPrimitiveDecoder(TPtrC8 aBuffer);

Description

Constructor

Parameters

TPtrC8 aBuffer

In - the buffer containing the value in its raw format

[Top]


Member functions


VarType()const

IMPORT_C TWspHeaderType VarType() const;

Description

Looks at the byte currently pointed at in this buffer and returns the type.

Return value

TWspPrimitiveDecoder::TWspHeaderType

TWspHeaderType - the type of this data octet


LengthVal(TInt &)

IMPORT_C TInt LengthVal(TInt &aVal);

Pre-Condition

iBuffer[iOffset] must be valid, TWspPrimitiveDecoder::VarType()const == TWspHeaderType::ELengthVal

Description

Returns length of the data following this byte.

Post-Condition

internal offset gets updated to move past this primitive

Parameters

TInt &aVal

Out - the length encoded in this byte that indicates the size of the data that follows.

Return value

TInt

postive number indicating the number of bytes read from the buffer KErrCorrupt if data is not formatted correctly.


String(TPtrC8 &)

IMPORT_C TInt String(TPtrC8 &aString);

Pre-Condition

iBuffer[iOffset] must be valid, TWspPrimitiveDecoder::VarType()const == TWspType::EString

Description

Returns a TPtrC holding the string the buffer currently points at without the NULL termination. If the String type is a quoted string then the quotes are not included in the returned buffer.

Post-Condition

internal offset gets updated to move past this primitive

Parameters

TPtrC8 &aString

Out - the string

Return value

TInt

postive number indicating the number of bytes read from the buffer KErrCorrupt if data is not formatted correctly.


Val7Bit(TUint8 &)

IMPORT_C TInt Val7Bit(TUint8 &aVal);

Pre-Condition

iBuffer[iOffset] must be valid, TWspPrimitiveDecoder::VarType()const == TWspHeaderType::E7BitVal

Description

Returns a token, a short int or an octet value with the top bit cleared

Post-Condition

internal offset gets updated to move past this primitive

Parameters

TUint8 &aVal

Out - the 7 bit value with top bit cleared

Return value

TInt

postive number indicating the number of bytes read from the buffer KErrCorrupt if data is not formatted correctly.


Integer(TUint32 &)

IMPORT_C TInt Integer(TUint32 &aVal);

Pre-Condition

iBuffer[iOffset] must be valid, TWspPrimitiveDecoder::VarType()const == TWspHeaderType::ELengthVal or TWspPrimitiveDecoder::VarType()const == TWspHeaderType::E7BitVal

Description

Returns an Integer - could be short or long.

Post-Condition

internal offset gets updated to move past this primitive

Parameters

TUint32 &aVal

Out - the long int

Return value

TInt

postive number indicating the number of bytes read from the buffer KErrCorrupt if data is not formatted correctly.


LongInt(TUint32 &)

IMPORT_C TInt LongInt(TUint32 &aVal);

Pre-Condition

iBuffer[iOffset] must be valid, TWspPrimitiveDecoder::VarType()const == TWspHeaderType::ELengthVal

Description

Returns a long int the buffer is currently pointing at.

Post-Condition

internal offset gets updated to move past this primitive

Parameters

TUint32 &aVal

Out - the long int

Return value

TInt

postive number indicating the number of bytes read from the buffer KErrCorrupt if data is not formatted correctly.


UintVar(TUint32 &)

IMPORT_C TInt UintVar(TUint32 &aVal);

Pre-Condition

iBuffer[iOffset] must be valid, TWspPrimitiveDecoder::VarType()const == TWspHeaderType::ELengthVal or TWspPrimitiveDecoder::VarType()const == TWspHeaderType::E7BitVal

Description

Returns a TUint32

Post-Condition

internal offset gets updated to move past this primitive

Parameters

TUint32 &aVal

Out - the TUint32 decoded

Return value

TInt

postive number indicating the number of bytes read from the buffer KErrCorrupt if data is not formatted correctly.


VersionL(RStringPool,RStringF &)

IMPORT_C TInt VersionL(RStringPool aPool, RStringF &aVer);

Pre-Condition

iBuffer[iOffset] must be valid, TWspPrimitiveDecoder::VarType()const == TWspHeaderType::ELengthVal

Description

Returns a formatted version string

Post-Condition

internal offset gets updated to move past this primitive

Parameters

RStringPool aPool

In - an opened string pool

RStringF &aVer

Out - a formatted version string. Caller must close this string.

Return value

TInt

postive number indicating the number of bytes read from the buffer KErrCorrupt if data is not formatted correctly.


Date(TDateTime &)

IMPORT_C TInt Date(TDateTime &aDateTime);

Pre-Condition

iBuffer[iOffset] must be valid, TWspPrimitiveDecoder::VarType()const == TWspHeaderType::ELengthVal

Description

Returns a TDateTime offset from January 1, 1970 - WAP WSP Section 8.4.2.3 Panics if the time val is greater then the maximum allowable integer size (32 bits).

Post-Condition

internal offset gets updated to move past this primitive

Parameters

TDateTime &aDateTime

Out - a WAP Date

Return value

TInt

postive number indicating the number of bytes read from the buffer KErrCorrupt if data is not formatted correctly.

[Top]


Member enumerations


Enum TWspHeaderType

TWspHeaderType

Description

TWspHeaderType describe the types from WAP-WSP Section 8.4.1.2

ENotSet

The type has not been set

ELengthVal

0-31 - octet is a value length

EQuotedString

34 - value is a quoted text string, terminated by a Null

EString

32-127 - value is a text string, terminated by a Null

E7BitVal

128-255 - encoded 7 bit value, this header has no more data