CWspHeaderEncoder Class Reference
class CWspHeaderEncoder : public CBase |
This class can be used to encode one header field at a time, with all its values and parameters.
It has no knowledge of encoding the BNF of a particular header field, but the functions provided can be used in combination, producing an 8-bit buffer containing the encoded header.
Intended usage would be to call a series of functions. The first one being StartHeader, The final one being EndHeader, which would return a buffer containing the complete encoded header field. eg: encoder->StartHeaderL(); encoder->AddLongIntL(); encoder->AddTextStringL(); HBufC8* output = encoder->EndHeaderL();
Constructor & Destructor Documentation
CWspHeaderEncoder()
CWspHeaderEncoder | ( | ) | [private] |
~CWspHeaderEncoder()
IMPORT_C | ~CWspHeaderEncoder | ( | ) | [virtual] |
Member Functions Documentation
AddDataL(const TDesC8 &)
IMPORT_C void | AddDataL | ( | const TDesC8 & | aData | ) | |
Encodes input and adds it to the encoded field. Adds value as-is to the encoded field.
Parameters
const TDesC8 & aData | value to be encoded. |
AddDateL(const TDateTime)
Encodes input and adds it to the encoded field.Encodes parameter value using WSP Date method.
- Pre-condition
- StartHeaderL needs to have been called.
-
leave
- KErrNoMemory
AddIntegerL(const TUint)
IMPORT_C void | AddIntegerL | ( | const TUint | aInt | ) | |
Encodes input Integer value and adds it to the encoded field. Choice of encoded form dependent on the size of the input.Either ShortInt or LongInt method chosen.
- Pre-condition
- StartHeaderL needs to have been called.
-
leave
- KErrNoMemory
Parameters
const TUint aInt | Integer value to be encoded. |
AddLongIntL(const TUint32)
IMPORT_C void | AddLongIntL | ( | const TUint32 | aValue | ) | |
Encodes input and adds it to the encoded field. Encodes parameter value using WSP LongInt method.
- Pre-condition
- StartHeaderL needs to have been called.
-
leave
- KErrNoMemory
Parameters
const TUint32 aValue | value to be encoded. |
AddShortIntL(const TUint8)
IMPORT_C void | AddShortIntL | ( | const TUint8 | aValue | ) | |
Encodes input and adds it to the encoded field. Encodes parameter value using WSP ShortInt method.
- Pre-condition
- StartHeaderL needs to have been called.
-
leave
- KErrNoMemory
Parameters
const TUint8 aValue | value to be encoded. |
AddShortLengthL(const TUint8)
IMPORT_C void | AddShortLengthL | ( | const TUint8 | aValue | ) | |
Encodes input and adds it to the encoded field. For short length the value must be between octet 0 - 31.
- Pre-condition
- StartHeaderL needs to have been called.
-
leave
- KErrNoMemory, KErrOverflow if the value is greater than 31
Parameters
const TUint8 aValue | value to be encoded. |
AddTextStringL(const RString &)
IMPORT_C void | AddTextStringL | ( | const RString & | aText | ) | |
Encodes input and adds it to the encoded field. Encodes parameter value using WSP TextString method.
- Pre-condition
- StartHeaderL needs to have been called.
-
leave
- KErrNoMemory
Parameters
const RString & aText | value to be encoded. |
AddTextStringL(const TDesC8 &)
IMPORT_C void | AddTextStringL | ( | const TDesC8 & | aText | ) | |
Encodes input and adds it to the encoded field. Encodes parameter value using WSP TextString method.
- Pre-condition
- StartHeaderL needs to have been called.
-
leave
- KErrNoMemory
Parameters
const TDesC8 & aText | value to be encoded. |
AddTokenL(const TUint8)
IMPORT_C void | AddTokenL | ( | const TUint8 | aToken | ) | |
Encodes input and adds it to the encoded field. Adds value as-is to the encoded field.
- Pre-condition
- StartHeaderL and StartValueLengthL should have been called.
- Post-condition
- EndValueLengthL needs to be called subsequently.
Parameters
const TUint8 aToken | parameter added without encodeing. Should be a valid WSP token, a 8 bit number > 0x7F (i.e. top bit set). |
AddTokenTextL(const TDesC8 &)
IMPORT_C void | AddTokenTextL | ( | const TDesC8 & | aTokenText | ) | |
Encodes input and adds it to the encoded field. Encodes parameter value using WSP TokenText method.
Parameters
const TDesC8 & aTokenText | value to be encoded. |
AddUintVarL(const TUint)
IMPORT_C void | AddUintVarL | ( | const TUint | aInt | ) | |
Encodes input and adds it to the encoded field. Encodes parameter value using WSP UIntVar method.
- Pre-condition
- StartHeaderL needs to have been called.
-
leave
- KErrNoMemory
Parameters
const TUint aInt | value to be encoded. |
ConstructL()
void | ConstructL | ( | ) | [private] |
Standard second phase construction.
EndHeaderL()
Completes and returns encoded field 8 bit buffer. This method will panic if an EndValueLengthL() is not called after a StartValueLength().
Note: The final buffer containing the entire encoded header is constructed. Returns buffer containing the encoded field constructed from the first call to StartHeaderL.
- Pre-condition
- The function StartHeaderL should have been called.
- Post-condition
- Encoder is reset ready to be used again.
-
leave
-
HBufC8::NewL leaves, if the new 8 bit heap descriptor cannot be created.
EndValueLengthL()
IMPORT_C void | EndValueLengthL | ( | ) | |
Needs to be called at the point in the construction of a header when ValueLength can be calculated.
- Pre-condition
- StartHeaderL and StartValueLengthL should have been called.
- Post-condition
- ValueLength has been calculated and added, together with the encoded header, to the internal representation of the header buffer.
-
leave
- KErrNoMemory
NewL()
Static factory constructor.
NewLC()
Static factory constructor.
StartHeaderL(TUint8)
IMPORT_C void | StartHeaderL | ( | TUint8 | aToken | ) | |
Starts a new encoded header.
Parameters
TUint8 aToken | field name being encoded as a Token value. |
StartHeaderL(const TDesC8 &)
IMPORT_C void | StartHeaderL | ( | const TDesC8 & | aString | ) | |
Starts a new encoded header.
Parameters
const TDesC8 & aString | Fieldname parameter is encoded as a TextString. |
StartHeaderL(const RStringF)
IMPORT_C void | StartHeaderL | ( | const RStringF | aString | ) | |
Starts a new encoded header.
Parameters
const RStringF aString | Fieldname parameter is encoded as a TextString. |
StartValueLengthL()
IMPORT_C void | StartValueLengthL | ( | ) | |
From calling this function, the length in bytes of all encodings added subsequently will be calculated and stored as part of the encoded string, as specified in WSP spec.Can be nested. i.e.
encoder->StartHeaderL();
encoder->StartValueLengthL();
encoder->StartValueLengthL();
encoder->AddLongIntL();
encoder->EndValueLengthL();
encoder->AddTextStringL();
encoder->EndValueLengthL();
HBufC8* output = encoder->EndHeaderL();
- Pre-condition
- StartHeaderL should have been called.
- Post-condition
- EndValueLengthL needs to be called subsequently.
-
leave
- KErrNoMemory
Member Data Documentation
RPointerArray< CDesC8Array > iArray
Array for storing the partial encoded header. Each time StartValueLength is called a new array element is used. When EndValueLength is called, the array is decremented, data from the last element being added to the one before.
TInt
iTotalLength
TInt
| iTotalLength | [private] |
Value incremented as the encoded header increases in size. Used to allocate the buffer for storing the final encoded header, output when EndHeader is called.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.