»
Developer Library »
API Reference »
C++ API reference »
Internet Protocol Utilities »
TWspPrimitiveDecoder
Location:
WSPDecoder.h
Link against: InetProtUtil.lib
Class TWspPrimitiveDecoder
class TWspPrimitiveDecoder;
Description
A decoder for WSP Primitives, as defined by WAP-WSP, Section
8.4.1
Defined in TWspPrimitiveDecoder:
Date(), E7BitVal, ELengthVal, ENotSet, EQuotedString, EString, Integer(), LengthVal(), LongInt(), String(), TWspHeaderType, TWspPrimitiveDecoder(), UintVar(), Val7Bit(), VarType(), VersionL(), iBuffer, iOffset
Construction
TWspPrimitiveDecoder(TPtrC8 aBuffer);
Description
Constructor.
Parameters
TPtrC8 aBuffer |
The buffer containing the value in its raw format. The buffer
is in the form of a pointer descriptor. The constructor takes a copy of this
pointer descriptor. |
|
TWspHeaderType VarType() const;
Description
Gets the WSP header type.
The function inspects the byte at the current location within
the buffer.
Return value
TInt LengthVal(TInt& aVal);
Description
Gets the length of the data that follows the byte at the
current location within the buffer.
Ensure that a call to
VarType() returns
ELengthVal before calling this
function.
Parameters
TInt& aVal |
On return, the size of the data that follows the byte at the
current location within the buffer. |
|
Return value
TInt
|
The number of bytes read from the buffer; this is a positive
number.
KErrCorrupt, if the data is not formatted
correctly. |
|
TInt String(TPtrC8& aString);
Description
Gets a pointer descriptor representing the string at the
current location within the buffer.
Ensure that a call to
VarType() returns either
EString or
EQuotedString before calling this
function.
Note the following:
-
the Null terminator is not included in the returned
buffer
-
if the string is a quoted string, then the quotes are not
included in the returned buffer.
Parameters
TPtrC8& aString |
On return, a pointer descriptor representing the string. |
|
Return value
TInt
|
The number of bytes read from the buffer; this is a positive
number.
KErrCorrupt, if the data is not formatted
correctly. |
|
TInt Val7Bit(TUint8& aVal);
Description
Gets a token, a short integer or an octet value with the top
bit cleared.
Ensure that a call to
VarType() returns
E7BitVal before calling this function.
Parameters
TUint8& aVal |
On return, the 7 bit value with top bit cleared. |
|
Return value
TInt
|
The number of bytes read from the buffer; this is a positive
number.
KErrCorrupt, if the data is not formatted
correctly. |
|
TInt Integer(TUint32& aVal);
Description
Gets a short or long integer at the current location within the
buffer.
Ensure that a call to
VarType() returns
ELengthVal before calling this
function.
Parameters
TUint32& aVal |
On return, the value as a long integer. |
|
Return value
TInt |
The number of bytes read from the buffer; this is a positive
number.
KErrCorrupt, if the data is not formatted
correctly. |
|
TInt LongInt(TUint32& aVal);
Description
Gets the long integer at the current location within the
buffer.
Parameters
TUint32& aVal |
On return, the long integer value. |
|
Return value
TInt |
The number of bytes read from the buffer; this is a positive
number.
KErrCorrupt, if the data is not formatted
correctly. |
|
Panic codes
WSPDECODER 0 |
If the specified value is greater then the maximum allowable
integer size (32 bits). |
|
TInt UintVar(TUint32& aVal);
Description
Gets the decoded 32 bit unsigned integer at the current
location within the buffer.
Ensure that a call to
VarType() returns either
ELengthVal or
E7BitVal before calling this function.
Parameters
TUint32& aVal |
On return, the decoded 32 bit unsigned integer. |
|
Return value
TInt
|
The number of bytes read from the buffer; this is a positive
number.
KErrCorrupt, if the data is not formatted
correctly. |
|
TInt VersionL(RStringPool aPool, RStringF& aVer);
Description
Gets a formatted version string at the current location within
the buffer.
Ensure that a call to
VarType() returns
ELengthVal before calling this
function.
Parameters
RStringPool aPool |
An opened string pool. |
RStringF& aVer |
On return, a formatted version string. Note that the caller is
responsible for closing this string. |
|
Return value
TInt
|
The number of bytes read from the buffer; this is a positive
number.
KErrCorrupt, if the data is not formatted
correctly. |
|
TInt Date(TDateTime& aDateTime);
Description
Gets the date/time value at the current location within the
buffer, calculated as an offset from 1st January 1970.
This is as defined by WAP-WSP Section 8.4.2.3.
Ensure that a call to
VarType() returns
ELengthVal before calling this
function.
Parameters
TDateTime& aDateTime |
On return, the date /time as WAP format date. |
|
Return value
TInt
|
The number of bytes read from the buffer; this is a positive
number.
KErrCorrupt, if the data is not formatted
correctly. |
|
Panic codes
WSPDECODER 1 |
If the time value is greater then the maximum allowable integer
size (32 bits). |
|
TWspHeaderType
Description
The header types as defined by WAP-WSP, Section 8.4.1.2
ENotSet |
The type has not been set. |
ELengthVal |
A header value in the range 0-31, the type represents a
length. |
EQuotedString |
A header value of 34, the type represents a quoted text
string, terminated by a '\0'. |
EString |
A header value in the range 32-127, the type represents a
text string, terminated by a '\0'. |
E7BitVal |
A header value in the range 128-255, the type represents an
encoded 7 bit value; this header has no further data. |
|
private: TPtrC8 iBuffer;
Description
This is internal and is not intended for use..
private: TInt iOffset;
Description
This is internal and is not intended for use..