TWspPrimitiveDecoder Class Reference

class TWspPrimitiveDecoder

Decoder for WSP Primitves - WAP-WSP Section 8.4.1

Public Member Functions
TWspPrimitiveDecoder(TPtrC8)
IMPORT_C TIntDate(TDateTime &)
IMPORT_C TIntInteger(TUint32 &)
IMPORT_C TIntLengthVal(TInt &)
IMPORT_C TIntLongInt(TUint32 &)
IMPORT_C TIntString(TPtrC8 &)
IMPORT_C TIntUintVar(TUint32 &)
IMPORT_C TIntVal7Bit(TUint8 &)
IMPORT_C TWspHeaderTypeVarType()
IMPORT_C TIntVersionL(RStringPool, RStringF &)
Public Member Enumerations
enumTWspHeaderType { ENotSet, ELengthVal, EQuotedString, EString, E7BitVal }
Private Attributes
TPtrC8 iBuffer
TInt iOffset

Constructor & Destructor Documentation

TWspPrimitiveDecoder(TPtrC8)

TWspPrimitiveDecoder(TPtrC8aBuffer)[inline]

Constructor

Parameters

TPtrC8 aBufferIn - the buffer containing the value in its raw format

Member Functions Documentation

Date(TDateTime &)

IMPORT_C TIntDate(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 & aDateTimeOut - a WAP Date

Integer(TUint32 &)

IMPORT_C TIntInteger(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 & aValOut - the long int

LengthVal(TInt &)

IMPORT_C TIntLengthVal(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 & aValOut - the length encoded in this byte that indicates the size of the data that follows.

LongInt(TUint32 &)

IMPORT_C TIntLongInt(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 & aValOut - the long int

String(TPtrC8 &)

IMPORT_C TIntString(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 & aStringOut - the string

UintVar(TUint32 &)

IMPORT_C TIntUintVar(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 & aValOut - the TUint32 decoded

Val7Bit(TUint8 &)

IMPORT_C TIntVal7Bit(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 & aValOut - the 7 bit value with top bit cleared

VarType()

IMPORT_C TWspHeaderTypeVarType()const

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

VersionL(RStringPool, RStringF &)

IMPORT_C TIntVersionL(RStringPoolaPool,
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 aPoolIn - an opened string pool
RStringF & aVerOut - 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