WSP Header Primitive Decoding

TWspPrimitiveDecoder allows decoding the primitive values of the header. This allows interpreting the encoded header.


Call String(), Val7Bit(), LongInt(), Integer(), UIntVar(), LengthVal(), Date() as appropriate to get the required byte to which the buffer is currently pointing. Before calling these functions, check if the data type that is passed to the functions is one of the type supported by TWspHeaderType. To get the type of the variable, call VarType(), which returns either ELengthVal, EQuotedString, EString or E7BitVal of TWspHeaderType as appropriate. If no data type is set to the data it points, the function returns ENotSet.

TPtrC8 aBuf;
TWspPrimitiveDecoder dec(aBuf);
TInt length;
// get length in bytes of data 
TInt int = dec.LengthVal(length);

  1. Decode the string value of the header using String().

    TPtrC8 aBuf;
    TWspPrimitiveDecoder dec(aBuf);
    TPtrC8 str;
    //get the string that the buffer is pointing to
    TInt int = dec.String(str); 

  2. Decode the integer value of the header using Integer().

    TPtrC8 aBuf;
    TWspPrimitiveDecoder dec(aBuf);
    TUint32 val;
    // get the integer that the buffer is pointing to
    TInt int = dec.Integer(val); 

  3. Decode the integer value of the header using UIntVar().

    TPtrC8 aBuf;
    TWspPrimitiveDecoder dec(aBuf);
    TUint32 val;
    //get the TUint32 value of the header
    TUint32 uInt =dec.UintVar(val);