Symbian3/SDK/Source/GUID-5FEA4AF7-5837-4D9A-9022-92A746BED0C4.dita
author Graeme Price <GRAEME.PRICE@NOKIA.COM>
Fri, 15 Oct 2010 14:32:18 +0100
changeset 15 307f4279f433
parent 7 51a74ef9ed63
permissions -rw-r--r--
Initial contribution of the Adaptation Documentation.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-5FEA4AF7-5837-4D9A-9022-92A746BED0C4" xml:lang="en"><title>WSP
Header Primitive Encoding </title><shortdesc><codeph>TWspPrimitiveEncoder</codeph> allows encoding of header
values. This encodes the input using various WSP encoding methods as follows: <codeph>TWspPrimitiveEncoder</codeph> is
used to convert data into binary strings. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
<steps-unordered>
<step id="GUID-9857F443-84C1-4225-BF4C-11787464C84F"><cmd/>
<info><p> <codeph>ShortInt()</codeph> encodes the <codeph>TUint8</codeph> parameter
value. </p></info>
<stepxmp><codeblock xml:space="preserve">TUint8 input;
input=0x7F; // MAX input value
// encode short integer 
TUInt8 uInt8 = TWspPrimitiveEncoder::ShortInt(input);</codeblock></stepxmp>
<stepresult><p>If the input value is greater that 127, it returns 0. </p></stepresult>
</step>
<step id="GUID-B407C2DD-EE72-494E-BE59-867207CFDB48"><cmd/>
<info><p> <codeph>LongIntL()</codeph> encodes the <codeph>TUint32</codeph> parameter
value. </p></info>
<stepxmp><codeblock xml:space="preserve">TUint32 input;
input=0x10000;
// encode long int
HBufC8  buf = TWspPrimitiveEncoder::LongIntL(input);</codeblock></stepxmp>
</step>
<step id="GUID-C721283B-307E-4A56-B283-0535D0FC45CA"><cmd/>
<info><p><codeph>TextStringL()</codeph> encodes the string value. </p></info>
<stepxmp><codeblock xml:space="preserve">_LIT8(KString1,"X-Header-1.foo");
// encode field name
HBufC8  buf = TWspPrimitiveEncoder::TextStringL(KString1);</codeblock></stepxmp>
</step>
<step id="GUID-E5BA35FB-9F0F-42C7-AE98-F71F07A9AC52"><cmd/>
<info><p> <codeph>UintVarL()</codeph> encodes the <codeph>TUint32</codeph> parameter
value. </p></info>
<stepxmp><codeblock xml:space="preserve">TUint32 input;
input=0x3FFF;
//encode UintVar
HBufC8 buf = TWspPrimitiveEncoder::UintVarL(input);</codeblock></stepxmp>
</step>
<step id="GUID-C491AC1F-495D-4E13-8F1F-DE7F7FE5E2F5"><cmd/>
<info><p><codeph>DateL()</codeph> encodes the date value. </p></info>
<stepxmp><codeblock xml:space="preserve">TDateTime date(1970,EJanuary,0,0,0,0,0);
//encode the date value
HBufC8  buf = TWspPrimitiveEncoder::DateL(date);</codeblock></stepxmp>
</step>
</steps-unordered>
</taskbody></task>