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
.
Example:
TPtrC8 aBuf; TWspPrimitiveDecoder dec(aBuf); TInt length; // get length in bytes of data TInt int = dec.LengthVal(length);
Decode the string value of the header using String()
.
Example:
TPtrC8 aBuf; TWspPrimitiveDecoder dec(aBuf); TPtrC8 str; //get the string that the buffer is pointing to TInt int = dec.String(str);
Decode the integer value of the header using Integer()
.
Example:
TPtrC8 aBuf; TWspPrimitiveDecoder dec(aBuf); TUint32 val; // get the integer that the buffer is pointing to TInt int = dec.Integer(val);
Decode the integer value of the header using UIntVar()
.
Example:
TPtrC8 aBuf; TWspPrimitiveDecoder dec(aBuf); TUint32 val; //get the TUint32 value of the header TUint32 uInt =dec.UintVar(val);