TWspPrimitiveDecoder Class Reference

class TWspPrimitiveDecoder

Decoder for WSP Primitves - WAP-WSP Section 8.4.1

Constructor & Destructor Documentation

TWspPrimitiveDecoder(TPtrC8)

TWspPrimitiveDecoder ( TPtrC8 aBuffer ) [inline]

Constructor

Parameters

TPtrC8 aBuffer In - the buffer containing the value in its raw format

Member Functions Documentation

Date(TDateTime &)

IMPORT_C TInt Date ( TDateTime & aDateTime )

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).

Pre-condition
iBuffer[iOffset] must be valid, VarType() == TWspHeaderType::ELengthVal
Post-condition
internal offset gets updated to move past this primitive

Parameters

TDateTime & aDateTime Out - a WAP Date

Integer(TUint32 &)

IMPORT_C TInt Integer ( TUint32 & aVal )

Returns an Integer - could be short or long.

Pre-condition
iBuffer[iOffset] must be valid, VarType() == TWspHeaderType::ELengthVal or VarType() == TWspHeaderType::E7BitVal
Post-condition
internal offset gets updated to move past this primitive

Parameters

TUint32 & aVal Out - the long int

LengthVal(TInt &)

IMPORT_C TInt LengthVal ( TInt & aVal )

Returns length of the data following this byte.

Pre-condition
iBuffer[iOffset] must be valid, VarType() == TWspHeaderType::ELengthVal
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.

LongInt(TUint32 &)

IMPORT_C TInt LongInt ( TUint32 & aVal )

Returns a long int the buffer is currently pointing at.

Pre-condition
iBuffer[iOffset] must be valid, VarType() == TWspHeaderType::ELengthVal
Post-condition
internal offset gets updated to move past this primitive

Parameters

TUint32 & aVal Out - the long int

String(TPtrC8 &)

IMPORT_C TInt String ( TPtrC8 & aString )

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.

Pre-condition
iBuffer[iOffset] must be valid, VarType() == TWspType::EString
Post-condition
internal offset gets updated to move past this primitive

Parameters

TPtrC8 & aString Out - the string

UintVar(TUint32 &)

IMPORT_C TInt UintVar ( TUint32 & aVal )

Returns a TUint32

Pre-condition
iBuffer[iOffset] must be valid, VarType() == TWspHeaderType::ELengthVal or VarType() == TWspHeaderType::E7BitVal
Post-condition
internal offset gets updated to move past this primitive

Parameters

TUint32 & aVal Out - the TUint32 decoded

Val7Bit(TUint8 &)

IMPORT_C TInt Val7Bit ( TUint8 & aVal )

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

Pre-condition
iBuffer[iOffset] must be valid, VarType() == TWspHeaderType::E7BitVal
Post-condition
internal offset gets updated to move past this primitive

Parameters

TUint8 & aVal Out - the 7 bit value with top bit cleared

VarType()

IMPORT_C TWspHeaderType VarType ( ) const

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

VersionL(RStringPool, RStringF &)

IMPORT_C TInt VersionL ( RStringPool aPool,
RStringF & aVer
)

Returns a formatted version string

Pre-condition
iBuffer[iOffset] must be valid, VarType() == TWspHeaderType::ELengthVal
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.

Member Enumerations Documentation

Enum TWspHeaderType

TWspHeaderType describe the types from WAP-WSP Section 8.4.1.2

Enumerators

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

Member Data Documentation

TPtrC8 iBuffer

TPtrC8 iBuffer [private]

The raw buffer

TInt iOffset

TInt iOffset [private]

The current offset