Adaptation/GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita
changeset 15 307f4279f433
equal deleted inserted replaced
14:578be2adaf3e 15:307f4279f433
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7" xml:lang="en"><title>Basic
       
    13 APIs</title><shortdesc>Accessing APIs and basic functions in kernel-side programs.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>Device drivers, like user-side programs, need to use APIs for basic tasks
       
    15 such as managing buffers and arrays. However, the EKA2 architecture does not
       
    16 allow kernel-side programs such as drivers to link and use the User Library
       
    17 (<filepath>euser.dll</filepath>) that provides these APIs to user-side programs.
       
    18 This means kernel side code <i>cannot use the majority</i> of classes and
       
    19 functions that are available to user side code. </p>
       
    20 <p>However, some classes are available for use on both the user side and the
       
    21 kernel side. The first section of this document, <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-2CE47F55-D160-50A3-B05E-318569FDEF1F">Available EUSER functionality</xref>, explains what these are. In other cases,
       
    22 there are alternative Kernel-specific APIs or techniques that you can use.
       
    23 The second section, <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-6AE21206-A29D-5CB6-83E9-69C2E7DA566A">Coding
       
    24 techniques to replace EUSER functionality</xref>, describes these. </p>
       
    25 <p>The detailed contents are given below: </p>
       
    26 <p><b>Contents </b> </p>
       
    27 <ul>
       
    28 <li id="GUID-F2669D60-00E3-520C-BACA-E363BFEDD487"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-2CE47F55-D160-50A3-B05E-318569FDEF1F">Available EUSER functionality</xref>  </p> <ul>
       
    29 <li id="GUID-AB9D2617-556C-556B-81F2-A9E0E3CA2A60"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-1A26C8D7-E915-5280-BA1E-0B837E296EE4">8-bit descriptors</xref>  </p> </li>
       
    30 <li id="GUID-2D0B05B0-BEBB-5A71-A6CA-1FFC5848D80B"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-F8164DF1-8875-5C83-9165-9902EB51A97C">Arrays</xref> </p> </li>
       
    31 <li id="GUID-962C0A1C-5A7B-5201-956D-F38BDF59C836"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-0BC2B8B1-F797-5B65-9EE7-36A2EC5C9BC5">Character representation</xref>  </p> </li>
       
    32 <li id="GUID-36D2B096-181D-51E5-B502-E385565E7693"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-682EF1C2-4756-5E5A-B4E9-00AABD5D4CE2">Basic utility functions and classes</xref>  </p> </li>
       
    33 <li id="GUID-F9264F5E-2D3D-551D-B9DD-DCECC027021D"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-331E0310-69A3-58A6-B932-F2B44201530D">The Package Buffers API</xref>  </p> </li>
       
    34 <li id="GUID-293A58CA-F57E-5323-9B1B-A8F51D351AA2"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-5707529F-6145-58C3-A0A9-8789FF8F1C93">The UID manipulation APIs</xref>  </p> </li>
       
    35 <li id="GUID-022766DC-6F40-55BE-B02A-6544A213141B"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-E9F32C01-5C4F-5706-B992-A4F8B01171FD">Version handling API</xref>  </p> </li>
       
    36 <li id="GUID-5CA1160C-8EEC-5795-853D-C568D519534F"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-E67B4238-3CFF-5448-B711-FCD14D8D3C10">TRequestStatus</xref> </p> </li>
       
    37 <li id="GUID-AE09C566-0664-5341-9D8D-386D9CE3DFBA"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-0CA35DBF-C10D-5C35-90CD-24C53AEA41BF">TIpcArgs</xref> </p> </li>
       
    38 <li id="GUID-EE77EAFA-50E6-58E4-B64E-4E7AB5FCAEF2"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-111081C5-5BDA-516B-9B3D-9D24FAD31E5D">Basic graphic classes</xref>  </p> </li>
       
    39 </ul> </li>
       
    40 <li id="GUID-7772333C-EB62-58E1-B1FD-64B500567C9D"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-6AE21206-A29D-5CB6-83E9-69C2E7DA566A">Coding techniques to replace EUSER functionality</xref> </p> <ul>
       
    41 <li id="GUID-EF0FA499-7F16-54D6-B1BA-A0AB3071CFB5"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-CA520DD3-3601-5774-87F2-D5BA4DA2BF8E">Buffers: replacing HBufC8 with HBuf</xref>  </p> </li>
       
    42 <li id="GUID-6CAA6B7F-7F07-5047-82CE-CCAF960880AF"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-310ADB7F-A03C-5994-A918-634B7BAB7DD8">Buffers: replacing HBufC8 with C style pointers</xref>  </p> </li>
       
    43 <li id="GUID-8858CFAA-EF27-54B0-8083-74A990C5E614"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-586DD3B4-69DB-564B-AB8D-B3A02607CE02">Handling 16-bit data items</xref>  </p> </li>
       
    44 <li id="GUID-AA63211F-E5AD-554A-AAFC-3FB1336553D5"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-77C88D19-50C3-5D69-8084-BE750F100BA0">Replacing CBase with DBase</xref>  </p> </li>
       
    45 <li id="GUID-E264271B-64F3-59A3-AD65-56C9ACEB5ABF"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-585EE1D8-6080-5B37-A3BD-278B8731B7F9">Replacing User::QueryVersionSupported() with Kern::QueryVersionSupported()</xref>  </p> </li>
       
    46 </ul> </li>
       
    47 </ul>
       
    48 <section id="GUID-2CE47F55-D160-50A3-B05E-318569FDEF1F"><title>Available EUSER
       
    49 functionality</title> <p>This is a list of USER side classes, types and APIs
       
    50 that can still be used on the kernel side. However, a subset of the class
       
    51 member functions may not be available. </p> <ul>
       
    52 <li id="GUID-81D6F170-FAB0-5DE6-93BC-0027CF8E382F"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-1A26C8D7-E915-5280-BA1E-0B837E296EE4">8-bit descriptors</xref>  </p> </li>
       
    53 <li id="GUID-BF477CD1-6079-5C60-A658-0DD64111081F"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-F8164DF1-8875-5C83-9165-9902EB51A97C">Arrays</xref> </p> </li>
       
    54 <li id="GUID-63E56F9D-B261-58E7-B9F9-ED9726C7F16F"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-0BC2B8B1-F797-5B65-9EE7-36A2EC5C9BC5">Character representation (TChar)</xref>  </p> </li>
       
    55 <li id="GUID-6F9BC926-0367-57DC-8356-29A2D29D60B8"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-682EF1C2-4756-5E5A-B4E9-00AABD5D4CE2">Basic utility functions and classes</xref>  </p> </li>
       
    56 <li id="GUID-17051C1E-21DE-567C-ADB4-11D18314B0FC"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-331E0310-69A3-58A6-B932-F2B44201530D">The Package Buffers API</xref>  </p> </li>
       
    57 <li id="GUID-3BCFE3A4-9B93-5D2D-BA1E-71F2544028AC"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-5707529F-6145-58C3-A0A9-8789FF8F1C93">The UID manipulation APIs</xref>  </p> </li>
       
    58 <li id="GUID-4C2730C0-D22F-5855-9D11-8049B1BDEF5E"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-E9F32C01-5C4F-5706-B992-A4F8B01171FD">Version handling API</xref>  </p> </li>
       
    59 <li id="GUID-44CEA8AD-36B9-59DF-9469-9A905A600ED4"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-E67B4238-3CFF-5448-B711-FCD14D8D3C10">TRequestStatus</xref> </p> </li>
       
    60 <li id="GUID-A867EDC0-DD2E-5E6D-ABC8-E57CECDA6158"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-0CA35DBF-C10D-5C35-90CD-24C53AEA41BF">TIpcArgs</xref> </p> </li>
       
    61 <li id="GUID-D0E83441-2258-5660-99F1-5BCBB799DEA8"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-111081C5-5BDA-516B-9B3D-9D24FAD31E5D">Basic graphic classes</xref>  </p> </li>
       
    62 </ul> <p id="GUID-1A26C8D7-E915-5280-BA1E-0B837E296EE4"><b>8-bit descriptors</b> </p> <p>The
       
    63 following classes, defined in <filepath>e32des8.h</filepath>, <i>can</i> be
       
    64 used on the kernel side. </p> <p>For some classes, the kernel side can use
       
    65 the same member functions that are available to the user side. However, for
       
    66 other classes, the kernel side is restricted to using a subset of functions;
       
    67 where this is the case, the functions are listed </p> <table id="GUID-CCC5A82F-8A1B-52F2-8B0A-036801F68C68">
       
    68 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
    69 <tbody>
       
    70 <row>
       
    71 <entry><p> <b>Classes available </b>  </p> </entry>
       
    72 <entry><p> <b>Public member functions that are available to kernel side code</b>  </p> </entry>
       
    73 </row>
       
    74 <row>
       
    75 <entry><p> <xref href="GUID-FB97E0A3-352A-316F-97C6-69E4741A8120.dita"><apiname>TDesC8</apiname></xref>  </p> </entry>
       
    76 <entry><p> <codeph>TInt operator&lt;(const TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt
       
    77 operator&lt;=(const TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt
       
    78 operator&gt;(const TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt operator&gt;=(const
       
    79 TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt operator==(const
       
    80 TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt operator!=(const
       
    81 TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph> const TUint8 &amp;operator[](TInt
       
    82 anIndex) const;</codeph> </p> <p> <codeph>TInt Length() const;</codeph>  </p> <p> <codeph>TInt
       
    83 Size() const;</codeph>  </p> <p> <codeph>const TUint8 *Ptr() const;</codeph>  </p> <p> <codeph>TInt
       
    84 Compare(const TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt Match(const
       
    85 TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt MatchF(const TDesC8
       
    86 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt MatchC(const TDesC8 &amp;aDes)
       
    87 const;</codeph>  </p> <p> <codeph>TInt Locate(TChar aChar) const;</codeph>  </p> <p> <codeph>TInt
       
    88 LocateReverse(TChar aChar) const;</codeph>  </p> <p> <codeph>TInt Find(const
       
    89 TDesC8 &amp;aDes) const;</codeph>  </p> <p> <codeph>TInt Find(const TUint8
       
    90 *pS,TInt aLenS) const;</codeph>  </p> <p> <codeph>TPtrC8 Left(TInt aLength)
       
    91 const;</codeph>  </p> <p> <codeph>TPtrC8 Right(TInt aLength) const;</codeph>  </p> <p> <codeph>TPtrC8
       
    92 Mid(TInt aPos) const;</codeph>  </p> <p> <codeph>TPtrC8 Mid(TInt aPos,TInt
       
    93 aLength) const;</codeph>  </p> <p> <codeph>TInt CompareF(const TDesC8 &amp;aDes)
       
    94 const;</codeph>  </p> </entry>
       
    95 </row>
       
    96 <row>
       
    97 <entry><p> <xref href="GUID-445B19E5-E2EE-32E2-8D6C-C7D6A9B3C507.dita"><apiname>TDes8</apiname></xref>  </p> </entry>
       
    98 <entry><p> <codeph>TDes8&amp; operator=(const TUint8 *aString);</codeph>  </p> <p> <codeph>TDes8&amp;
       
    99 operator=(const TDesC8 &amp;aDes);</codeph>  </p> <p> <codeph>TDes8&amp; operator=(const
       
   100 TDes8 &amp;aDes);</codeph>  </p> <p> <codeph>TInt MaxLength() const;</codeph>  </p> <p> <codeph>TInt
       
   101 MaxSize() const;</codeph>  </p> <p> <codeph>const TUint8 &amp;operator[](TInt
       
   102 anIndex) const;</codeph>  </p> <p> <codeph>TUint8 &amp;operator[](TInt anIndex);</codeph>  </p> <p> <codeph>TDes8
       
   103 &amp;operator+=(const TDesC8 &amp;aDes);</codeph>  </p> <p> <codeph>void Zero();</codeph>  </p> <p> <codeph>void
       
   104 SetLength(TInt aLength);</codeph>  </p> <p> <codeph>void SetMax();</codeph>  </p> <p> <codeph>void
       
   105 Copy(const TDesC8 &amp;aDes);</codeph>  </p> <p> <codeph>void Copy(const TUint8
       
   106 *aBuf,TInt aLength);</codeph>  </p> <p> <codeph>void Copy(const TUint8 *aString);</codeph>  </p> <p> <codeph>void
       
   107 Copy(const TDesC16 &amp;aDes);</codeph>  </p> <p> <codeph>void Append(TChar
       
   108 aChar);</codeph>  </p> <p> <codeph>void Append(const TDesC8 &amp;aDes);</codeph>  </p> <p> <codeph>void
       
   109 Append(const TDesC16 &amp;aDes);</codeph>  </p> <p> <codeph>void Append(const
       
   110 TUint8 *aBuf,TInt aLength);</codeph>  </p> <p> <codeph>void Fill(TChar aChar);</codeph>  </p> <p> <codeph>void
       
   111 Fill(TChar aChar,TInt aLength);</codeph>  </p> <p> <codeph>void FillZ();</codeph>  </p> <p> <codeph>void
       
   112 FillZ(TInt aLength);</codeph>  </p> <p> <codeph>void Num(TInt64 aVal);</codeph>  </p> <p> <codeph> void
       
   113 Num(TUint64 aVal, TRadix aRadix);</codeph>  </p> <p> <codeph>void NumFixedWidth(TUint
       
   114 aVal,TRadix aRadix,TInt                      aWidth);</codeph>  </p> <p> <codeph>void
       
   115 AppendNum(TInt64 aVal);</codeph>  </p> <p> <codeph>void AppendNum(TUint64
       
   116 aVal, TRadix aRadix);</codeph>  </p> <p> <codeph>void AppendNumFixedWidth(TUint
       
   117 aVal,TRadix aRadix,TInt                      aWidth);</codeph>  </p> </entry>
       
   118 </row>
       
   119 <row>
       
   120 <entry><p> <xref href="GUID-6DF731E4-5691-31C4-BEE0-03A3873F15EC.dita"><apiname>TPtrC8</apiname></xref>  </p> </entry>
       
   121 <entry><p>Same as for user side code. </p> </entry>
       
   122 </row>
       
   123 <row>
       
   124 <entry><p> <xref href="GUID-C0D29B11-1535-3D11-B318-B18D30A6120B.dita"><apiname>TPtr8</apiname></xref>  </p> </entry>
       
   125 <entry><p>Same as for user side code. </p> </entry>
       
   126 </row>
       
   127 <row>
       
   128 <entry><p> <xref href="GUID-5B1CA2E7-E3A7-3AF8-9EB0-662E130C45DA.dita"><apiname>TBufC8</apiname></xref>  </p> </entry>
       
   129 <entry><p>Same as for user side code. </p> </entry>
       
   130 </row>
       
   131 <row>
       
   132 <entry><p> <xref href="GUID-78E993D5-A845-32B4-B41A-947ABEF16AA0.dita"><apiname>TBuf8</apiname></xref>  </p> </entry>
       
   133 <entry><p>Same as for user side code. </p> </entry>
       
   134 </row>
       
   135 <row>
       
   136 <entry><p> <xref href="GUID-6A13E649-D15A-3BD7-B5C2-4DC23211F276.dita"><apiname>TDes8Overflow</apiname></xref>  </p> </entry>
       
   137 <entry><p>Same as for user side code. </p> </entry>
       
   138 </row>
       
   139 <row>
       
   140 <entry><p> <xref href="GUID-A188447C-9DAA-3963-B6F2-893910450FC7.dita"><apiname>TLitC8</apiname></xref>  </p> </entry>
       
   141 <entry><p>Same as for user side code. </p> </entry>
       
   142 </row>
       
   143 </tbody>
       
   144 </tgroup>
       
   145 </table> <p id="GUID-F8164DF1-8875-5C83-9165-9902EB51A97C"><b>Arrays</b> </p> <p>The
       
   146 following classes, defined in <filepath>e32cmn.h</filepath>, <i>can</i> be
       
   147 used on the kernel side. </p> <p>For some classes, the kernel side can use
       
   148 the same member functions that are available to the user side. However, for
       
   149 other classes, the kernel side is restricted to using a subset of functions;
       
   150 where this is the case, the functions are listed </p> <table id="GUID-858768C2-7159-5AF9-9704-C95F6FB14204">
       
   151 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
   152 <tbody>
       
   153 <row>
       
   154 <entry><p> <b>Classes available </b>  </p> </entry>
       
   155 <entry><p> <b>Public member functions that are available to kernel side code</b>  </p> </entry>
       
   156 </row>
       
   157 <row>
       
   158 <entry><p> <xref href="GUID-FAEBF321-6B08-3041-A01F-B1E7282D0707.dita"><apiname> RArray</apiname></xref> &lt;class T&gt; </p> </entry>
       
   159 <entry><p> <codeph>RArray();</codeph>  </p> <p> <codeph>RArray(TInt aGranularity);</codeph>  </p> <p> <codeph>RArray(TInt
       
   160 aGranularity, TInt aKeyOffset);</codeph>  </p> <p> <codeph>RArray(TInt aMinGrowBy,
       
   161 TInt aKeyOffset, TInt                      aFactor);</codeph>  </p> <p> <codeph>void
       
   162 Close(); inline TInt Count() const;</codeph>  </p> <p> <codeph>const T&amp;
       
   163 operator[](TInt anIndex) const;</codeph>  </p> <p> <codeph>T&amp; operator[](TInt
       
   164 anIndex);</codeph>  </p> <p> <codeph>TInt Append(const T&amp; anEntry);</codeph>  </p> <p> <codeph>TInt
       
   165 Insert(const T&amp; anEntry, TInt aPos);</codeph>  </p> <p> <codeph>void Remove(TInt
       
   166 anIndex);</codeph>  </p> <p> <codeph>void Compress();</codeph>  </p> <p> <codeph>void
       
   167 Reset();</codeph>  </p> <p> <codeph>TInt Find(const T&amp; anEntry) const;</codeph>  </p> <p> <codeph>TInt
       
   168 Find(const T&amp; anEntry,                      TIdentityRelation&lt;T&gt; anIdentity)
       
   169 const;</codeph>  </p> <p> <codeph>TInt FindInSignedKeyOrder(const T&amp; anEntry)
       
   170                      const;</codeph>  </p> <p> <codeph> TInt FindInUnsignedKeyOrder(const
       
   171 T&amp; anEntry)                      const;</codeph>  </p> <p> <codeph>TInt
       
   172 FindInOrder(const T&amp; anEntry,                      TLinearOrder&lt;T&gt;
       
   173 anOrder) const;</codeph>  </p> <p> <codeph>TInt FindInSignedKeyOrder(const
       
   174 T&amp; anEntry, TInt&amp;                      anIndex) const;</codeph>  </p> <p> <codeph>TInt
       
   175 FindInUnsignedKeyOrder(const T&amp; anEntry,                      TInt&amp;
       
   176 anIndex) const;</codeph>  </p> <p> <codeph>TInt FindInOrder(const T&amp; anEntry,
       
   177 TInt&amp; anIndex,                      TLinearOrder&lt;T&gt; anOrder) const;</codeph>  </p> <p> <codeph>TInt
       
   178 SpecificFindInSignedKeyOrder(const T&amp; anEntry,                      TInt
       
   179 aMode) const;</codeph>  </p> <p> <codeph>TInt SpecificFindInUnsignedKeyOrder(const
       
   180 T&amp; anEntry,                      TInt aMode) const;</codeph>  </p> <p> <codeph>TInt
       
   181 SpecificFindInOrder(const T&amp; anEntry,                      TLinearOrder&lt;T&gt;
       
   182 anOrder, TInt aMode) const;</codeph>  </p> <p> <codeph>TInt SpecificFindInSignedKeyOrder(const
       
   183 T&amp; anEntry,                      TInt&amp; anIndex, TInt aMode) const;</codeph>  </p> <p> <codeph>TInt
       
   184 SpecificFindInUnsignedKeyOrder(const T&amp; anEntry,                     
       
   185 TInt&amp; anIndex, TInt aMode) const;</codeph>  </p> <p> <codeph>TInt SpecificFindInOrder(const
       
   186 T&amp; anEntry, TInt&amp;                      anIndex, TLinearOrder&lt;T&gt;
       
   187 anOrder, TInt aMode) const;</codeph>  </p> <p> <codeph>TInt InsertInSignedKeyOrder(const
       
   188 T&amp; anEntry);</codeph> </p> <p> <codeph>TInt InsertInUnsignedKeyOrder(const
       
   189 T&amp;                      anEntry);</codeph>  </p> <p> <codeph>TInt InsertInOrder(const
       
   190 T&amp; anEntry,                      TLinearOrder&lt;T&gt; anOrder);</codeph>  </p> <p> <codeph>TInt
       
   191 InsertInSignedKeyOrderAllowRepeats(const T&amp;                      anEntry);</codeph>  </p> <p> <codeph>TInt
       
   192 InsertInUnsignedKeyOrderAllowRepeats(const T&amp;                      anEntry);</codeph>  </p> <p> <codeph>TInt
       
   193 InsertInOrderAllowRepeats(const T&amp; anEntry,                      TLinearOrder&lt;T&gt;
       
   194 anOrder);</codeph>  </p> </entry>
       
   195 </row>
       
   196 <row>
       
   197 <entry><p> <xref href="GUID-FAEBF321-6B08-3041-A01F-B1E7282D0707.dita"><apiname>RArray</apiname></xref> &lt;TInt&gt; </p> </entry>
       
   198 <entry><p> <codeph>RArray();</codeph>  </p> <p> <codeph>RArray(TInt aGranularity);</codeph>  </p> <p> <codeph>RArray(TInt
       
   199 aMinGrowBy, TInt aFactor);</codeph>  </p> <p> <codeph>void Close();</codeph>  </p> <p> <codeph>TInt
       
   200 Count() const;</codeph>  </p> <p> <codeph>const TInt&amp; operator[](TInt
       
   201 anIndex) const;</codeph>  </p> <p> <codeph>TInt&amp; operator[](TInt anIndex);</codeph>  </p> <p> <codeph>TInt
       
   202 Append(TInt anEntry);</codeph>  </p> <p> <codeph>TInt Insert(TInt anEntry,
       
   203 TInt aPos);</codeph>  </p> <p> <codeph>void Remove(TInt anIndex);</codeph>  </p> <p> <codeph>void
       
   204 Compress();</codeph>  </p> <p> <codeph>void Reset();</codeph>  </p> <p> <codeph>TInt
       
   205 Find(TInt anEntry) const;</codeph>  </p> <p> <codeph>TInt FindInOrder(TInt
       
   206 anEntry) const;</codeph>  </p> <p> <codeph>TInt FindInOrder(TInt anEntry,
       
   207 TInt&amp; anIndex) const;                      </codeph>  </p> <p> <codeph>TInt
       
   208 SpecificFindInOrder(TInt anEntry, TInt aMode)                      const;</codeph>  </p> <p> <codeph>TInt
       
   209 SpecificFindInOrder(TInt anEntry, TInt&amp; anIndex,                     
       
   210 TInt aMode) const;</codeph>  </p> <p> <codeph>TInt InsertInOrder(TInt anEntry);</codeph>  </p> <p> <codeph>TInt
       
   211 InsertInOrderAllowRepeats(TInt anEntry);</codeph>  </p> </entry>
       
   212 </row>
       
   213 <row>
       
   214 <entry><p> <xref href="GUID-FAEBF321-6B08-3041-A01F-B1E7282D0707.dita"><apiname>RArray</apiname></xref> &lt;TUint&gt; </p> </entry>
       
   215 <entry><p> <codeph>RArray();</codeph>  </p> <p> <codeph>RArray(TInt aGranularity);</codeph>  </p> <p> <codeph>RArray(TInt
       
   216 aMinGrowBy, TInt aFactor);</codeph>  </p> <p> <codeph>void Close();</codeph>  </p> <p> <codeph>TInt
       
   217 Count() const;</codeph>  </p> <p> <codeph>const TUint&amp; operator[](TInt
       
   218 anIndex) const;</codeph>  </p> <p> <codeph>TUint&amp; operator[](TInt anIndex);</codeph>  </p> <p> <codeph>TInt
       
   219 Append(TUint anEntry);</codeph>  </p> <p> <codeph>TInt Insert(TUint anEntry,
       
   220 TInt aPos);</codeph>  </p> <p> <codeph>void Remove(TInt anIndex);</codeph>  </p> <p> <codeph>void
       
   221 Compress();</codeph>  </p> <p> <codeph>void Reset();</codeph>  </p> <p> <codeph>TInt
       
   222 Find(TUint anEntry) const;</codeph>  </p> <p> <codeph>TInt FindInOrder(TUint
       
   223 anEntry) const;</codeph>  </p> <p> <codeph>TInt FindInOrder(TUint anEntry,
       
   224 TInt&amp; anIndex) const;                      </codeph>  </p> <p> <codeph>TInt
       
   225 SpecificFindInOrder(TUint anEntry, TInt aMode)                      const;</codeph>  </p> <p> <codeph>TInt
       
   226 SpecificFindInOrder(TUint anEntry, TInt&amp;                      anIndex,
       
   227 TInt aMode) const;</codeph>  </p> <p> <codeph>TInt InsertInOrder(TUint anEntry);</codeph>  </p> <p> <codeph>TInt
       
   228 InsertInOrderAllowRepeats(TUint anEntry);</codeph>  </p> </entry>
       
   229 </row>
       
   230 <row>
       
   231 <entry><p> <xref href="GUID-AAA13D1F-1BD7-3331-BB8C-11FA2795B53F.dita"><apiname>RPointerArray</apiname></xref> &lt;class T&gt; </p> </entry>
       
   232 <entry><p> <codeph>RPointerArray();</codeph>  </p> <p> <codeph>RPointerArray(TInt
       
   233 aGranularity);</codeph>  </p> <p> <codeph>RPointerArray(TInt aMinGrowBy, TInt
       
   234 aFactor);</codeph>  </p> <p> <codeph>void Close();</codeph>  </p> <p> <codeph>TInt
       
   235 Count() const;</codeph>  </p> <p> <codeph>T* const&amp; operator[](TInt anIndex)
       
   236 const;</codeph>  </p> <p> <codeph>T*&amp; operator[](TInt anIndex);</codeph>  </p> <p> <codeph>TInt
       
   237 Append(const T* anEntry);</codeph>  </p> <p> <codeph>TInt Insert(const T*
       
   238 anEntry, TInt aPos);</codeph>  </p> <p> <codeph>void Remove(TInt anIndex);</codeph>  </p> <p> <codeph>void
       
   239 Compress();</codeph>  </p> <p> <codeph>void Reset();</codeph>  </p> <p> <codeph>void
       
   240 ResetAndDestroy();</codeph>  </p> <p> <codeph>TInt Find(const T* anEntry)
       
   241 const;</codeph>  </p> <p> <codeph>TInt Find(const T* anEntry, TIdentityRelation&lt;T&gt;
       
   242                      anIdentity) const;</codeph>  </p> <p> <codeph>TInt FindInAddressOrder(const
       
   243 T* anEntry) const;</codeph>  </p> <p> <codeph>TInt FindInOrder(const T* anEntry,
       
   244 TLinearOrder&lt;T&gt;                      anOrder) const;</codeph>  </p> <p> <codeph>TInt
       
   245 FindInAddressOrder(const T* anEntry, TInt&amp;                      anIndex)
       
   246 const;</codeph>  </p> <p> <codeph>TInt FindInOrder(const T* anEntry, TInt&amp;
       
   247 anIndex,                      TLinearOrder&lt;T&gt; anOrder) const;</codeph>  </p> <p> <codeph>TInt
       
   248 SpecificFindInAddressOrder(const T* anEntry, TInt                      aMode)
       
   249 const;);</codeph>  </p> <p> <codeph>TInt SpecificFindInOrder(const T* anEntry,
       
   250                      TLinearOrder&lt;T&gt; anOrder, TInt aMode) const;</codeph>  </p> <p> <codeph>TInt
       
   251 SpecificFindInAddressOrder(const T* anEntry,                      TInt&amp;
       
   252 anIndex, TInt aMode) const;</codeph>  </p> <p> <codeph>TInt SpecificFindInOrder(const
       
   253 T* anEntry, TInt&amp;                      anIndex, TLinearOrder&lt;T&gt; anOrder,
       
   254 TInt aMode) const;</codeph>  </p> <p> <codeph>TInt InsertInAddressOrder(const
       
   255 T* anEntry);</codeph>  </p> <p> <codeph>TInt InsertInOrder(const T* anEntry,
       
   256                      TLinearOrder&lt;T&gt; anOrder);</codeph>  </p> <p> <codeph>TInt
       
   257 InsertInAddressOrderAllowRepeats(const T*                      anEntry);</codeph>  </p> <p> <codeph>TInt
       
   258 InsertInOrderAllowRepeats(const T* anEntry,                      TLinearOrder&lt;T&gt;
       
   259 anOrder);</codeph>  </p> </entry>
       
   260 </row>
       
   261 <row>
       
   262 <entry><p> <xref href="GUID-E75F040A-CEC6-3751-8F96-F16AEDC209A3.dita"><apiname>TIdentityRelation </apiname></xref> &lt;class T&gt; </p> </entry>
       
   263 <entry><p>Same as for user side code. </p> </entry>
       
   264 </row>
       
   265 <row>
       
   266 <entry><p> <xref href="GUID-C028C373-CE25-3832-855E-17FB738721CF.dita"><apiname>TLinearOrder</apiname></xref> &lt;class T&gt; </p> </entry>
       
   267 <entry><p>Same as for user side code. </p> </entry>
       
   268 </row>
       
   269 </tbody>
       
   270 </tgroup>
       
   271 </table> <p id="GUID-0BC2B8B1-F797-5B65-9EE7-36A2EC5C9BC5"><b>Character representation</b> </p> <p>The
       
   272 following class, defined in <filepath>e32cmn.h</filepath>, <i>can</i> be used
       
   273 on the kernel side. </p> <p>For some classes, the kernel side can use the
       
   274 same member functions that are available to the user side. However, for other
       
   275 classes, the kernel side is restricted to using a subset of functions; where
       
   276 this is the case, the functions are listed </p> <table id="GUID-F24ABED3-1122-5FE2-8E00-87B610F7E2A6">
       
   277 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
   278 <tbody>
       
   279 <row>
       
   280 <entry><p> <b>Classes available </b>  </p> </entry>
       
   281 <entry><p> <b>Public member functions that are available to kernel side code</b>  </p> </entry>
       
   282 </row>
       
   283 <row>
       
   284 <entry><p> <xref href="GUID-CDCFA2A5-EA8A-3B39-B90F-77AC41571E2D.dita"><apiname>TChar</apiname></xref>  </p> </entry>
       
   285 <entry><p> <codeph>TChar();</codeph>  </p> <p> <codeph>TChar(TUint aChar);</codeph>  </p> <p> <codeph>TChar&amp;
       
   286 operator-=(TUint aChar);</codeph>  </p> <p> <codeph>TChar&amp; operator+=(TUint
       
   287 aChar);</codeph>  </p> <p> <codeph>TChar operator-(TUint aChar);</codeph>  </p> <p> <codeph>TChar
       
   288 operator+(TUint aChar);</codeph>  </p> <p> <codeph>operator TUint() const;</codeph>  </p> </entry>
       
   289 </row>
       
   290 </tbody>
       
   291 </tgroup>
       
   292 </table> <p id="GUID-682EF1C2-4756-5E5A-B4E9-00AABD5D4CE2"><b>Basic utility
       
   293 functions and classes</b> </p> <p>The following global utility functions and
       
   294 classes, defined in <filepath>e32cmn.h</filepath>, <i>can</i> be used on the
       
   295 kernel side. </p> <table id="GUID-1754BDC5-BFB7-5E32-A956-2289FDB1C172">
       
   296 <tgroup cols="1"><colspec colname="col0"/>
       
   297 <tbody>
       
   298 <row>
       
   299 <entry><p> <xref href="GUID-5391E485-A019-358F-85D2-3B55BA439BD1.dita"><apiname>TRefByValue</apiname></xref>  </p> </entry>
       
   300 </row>
       
   301 <row>
       
   302 <entry><p> <codeph>TInt Lim(TInt aVal,TUint aLimit);</codeph>  </p> </entry>
       
   303 </row>
       
   304 <row>
       
   305 <entry><p> <codeph>TInt LimX(TInt aVal,TUint aLimit);</codeph>  </p> </entry>
       
   306 </row>
       
   307 <row>
       
   308 <entry><p>template &lt;class T&gt; <codeph>T Min(T aLeft,T aRight);</codeph>  </p> </entry>
       
   309 </row>
       
   310 <row>
       
   311 <entry><p>template &lt;class T&gt; <codeph>T Min(T aLeft,TUint              
       
   312        aRight);</codeph>  </p> </entry>
       
   313 </row>
       
   314 <row>
       
   315 <entry><p>template &lt;class T&gt; <codeph>T Max(T aLeft,T aRight);</codeph>  </p> </entry>
       
   316 </row>
       
   317 <row>
       
   318 <entry><p>template &lt;class T&gt; <codeph>T Max(T aLeft,TUint              
       
   319        aRight);</codeph>  </p> </entry>
       
   320 </row>
       
   321 <row>
       
   322 <entry><p>template &lt;class T&gt; <codeph>T Abs(T aVal);</codeph>  </p> </entry>
       
   323 </row>
       
   324 <row>
       
   325 <entry><p>template &lt;class T&gt; <codeph>TBool Rng(T aMin,T aVal,T        
       
   326              aMax);</codeph>  </p> </entry>
       
   327 </row>
       
   328 <row>
       
   329 <entry><p>template &lt;class T,class S&gt; <codeph>T* PtrAdd(T* aPtr,S      
       
   330                aVal);</codeph>  </p> </entry>
       
   331 </row>
       
   332 <row>
       
   333 <entry><p>template &lt;class T,class S&gt; <codeph>T* PtrSub(T* aPtr,S      
       
   334                aVal);</codeph>  </p> </entry>
       
   335 </row>
       
   336 <row>
       
   337 <entry><p>template &lt;class T&gt; <codeph>T Align2(T aValue);</codeph>  </p> </entry>
       
   338 </row>
       
   339 <row>
       
   340 <entry><p>template &lt;class T&gt; <codeph>T Align4(T aValue);</codeph>  </p> </entry>
       
   341 </row>
       
   342 </tbody>
       
   343 </tgroup>
       
   344 </table> <p id="GUID-331E0310-69A3-58A6-B932-F2B44201530D"><b>The Package
       
   345 Buffers API</b> </p> <p>The package buffers API, represented by classes defined
       
   346 in <filepath>e32cmn.h</filepath>, <i>can</i> be used on the kernel side. </p> <table id="GUID-CE1782C9-E59A-567C-8F6F-DA5AE7C50476">
       
   347 <tgroup cols="1"><colspec colname="col0"/>
       
   348 <tbody>
       
   349 <row>
       
   350 <entry><p> <xref href="GUID-C7A094BD-846F-3ED2-8CCE-C0743DB3712A.dita"><apiname>TPckgBuf</apiname></xref>  </p> </entry>
       
   351 </row>
       
   352 <row>
       
   353 <entry><p> <xref href="GUID-36B29964-420D-38D0-AF08-4DA70BED8B6E.dita"><apiname>TPckgC</apiname></xref>  </p> </entry>
       
   354 </row>
       
   355 <row>
       
   356 <entry><p> <xref href="GUID-4DFB8E64-81FF-3D3B-9694-CE51B11DA69A.dita"><apiname>TPckg</apiname></xref>  </p> </entry>
       
   357 </row>
       
   358 </tbody>
       
   359 </tgroup>
       
   360 </table> <p id="GUID-5707529F-6145-58C3-A0A9-8789FF8F1C93"><b>The UID manipulation
       
   361 APIs</b> </p> <p>The UID manipulation APIs, represented by classes defined
       
   362 in <filepath>e32cmn.h</filepath> can be used on the kernel side. However,
       
   363 only a <i>subset</i> of functions are available. See the detailed notes in
       
   364 the following table. </p> <table id="GUID-4E17CB02-80F9-5D3A-A3F0-0C6208D759F5">
       
   365 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
   366 <tbody>
       
   367 <row>
       
   368 <entry><p> <xref href="GUID-530281E6-29FC-33F2-BC9B-610FBA389444.dita"><apiname>TUid</apiname></xref>  </p> </entry>
       
   369 <entry><p>Only the two inline functions can be used: </p> <ul>
       
   370 <li id="GUID-1FA84853-4983-500F-B38E-AA82BB5456D6"><p> <xref href="GUID-530281E6-29FC-33F2-BC9B-610FBA389444.dita#GUID-530281E6-29FC-33F2-BC9B-610FBA389444/GUID-65B526E7-8629-3DEC-970B-1D48263D7AFD"><apiname>TUid::Uid</apiname></xref>  </p> </li>
       
   371 <li id="GUID-B588EEC3-4DB9-51D3-9DCA-DAF822006C4B"><p> <xref href="GUID-530281E6-29FC-33F2-BC9B-610FBA389444.dita#GUID-530281E6-29FC-33F2-BC9B-610FBA389444/GUID-B7F5CA42-157B-3D74-BA2E-00B290F71345"><apiname>TUid::Null()</apiname></xref>  </p> </li>
       
   372 </ul> </entry>
       
   373 </row>
       
   374 <row>
       
   375 <entry><p> <xref href="GUID-B6D6B0AD-B15C-339A-8540-40540885089A.dita"><apiname>TUidType</apiname></xref>  </p> </entry>
       
   376 <entry><p>None of the member functions can be used; however, the <codeph>iUid</codeph> data
       
   377 member is declared as public on the kernel side. </p> </entry>
       
   378 </row>
       
   379 <row>
       
   380 <entry><p> <xref href="GUID-1FB6F0D5-96F9-3D31-8508-9CE731A2E8E4.dita"><apiname>TUidName</apiname></xref>  </p> </entry>
       
   381 <entry><p>This will only ever be an 8-bit type descriptor. </p> </entry>
       
   382 </row>
       
   383 </tbody>
       
   384 </tgroup>
       
   385 </table> <p id="GUID-E9F32C01-5C4F-5706-B992-A4F8B01171FD"><b>Version handling
       
   386 API</b> </p> <p>The version handling API, represented by the <xref href="GUID-D82DEC7A-71C2-3004-BFC2-C82C009A2715.dita"><apiname>TVersion</apiname></xref> class
       
   387 defined in <filepath>e32cmn.h</filepath> can be used on the kernel side. </p> <p id="GUID-E67B4238-3CFF-5448-B711-FCD14D8D3C10"><b>TRequestStatus</b> </p> <p>The <xref href="GUID-E0B34F3E-D4C4-3232-B8B1-7DB35B454646.dita"><apiname>TRequestStatus</apiname></xref> class
       
   388 representing the completion status of an asynchronous request, and defined
       
   389 in <filepath>e32cmn.h</filepath> can be used on the kernel side. </p> <p id="GUID-0CA35DBF-C10D-5C35-90CD-24C53AEA41BF"><b>TIpcArgs</b> </p> <p>The <xref href="GUID-4AD02F14-1142-372F-9D11-224595932034.dita"><apiname>TIpcArgs</apiname></xref> class, which is part of the Version2 client/server APIs,
       
   390 and defined in <filepath>e32cmn.h</filepath>, can be used on the kernel side.
       
   391 However, the <codeph>Set()</codeph> and <codeph>Type()</codeph> member functions
       
   392 that take 16-bit descriptors are not available. </p> <p id="GUID-111081C5-5BDA-516B-9B3D-9D24FAD31E5D"><b>Basic
       
   393 graphic classes</b> </p> <p>The basic graphic classes <xref href="GUID-339EC4C5-89DC-3972-9579-6DD38D418317.dita"><apiname>TPoint</apiname></xref> and <xref href="GUID-938244B2-5E1A-39F7-8ACA-E6DE4C44A313.dita"><apiname>TSize</apiname></xref> are
       
   394 defined on the kernel side. However, only the public data members are defined
       
   395 - the member functions are not defined, and are not available for use. </p> </section>
       
   396 <section id="GUID-6AE21206-A29D-5CB6-83E9-69C2E7DA566A"><title>Coding techniques
       
   397 to replace EUSER functionality</title> <ul>
       
   398 <li id="GUID-19997154-7682-5FA8-85EA-2E24683398D5"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-CA520DD3-3601-5774-87F2-D5BA4DA2BF8E">Buffers: replacing HBufC8 with HBuf</xref>  </p> </li>
       
   399 <li id="GUID-DBAA1CE6-9A00-5A97-8954-C2B3E4DC8B3C"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-310ADB7F-A03C-5994-A918-634B7BAB7DD8">Buffers: replacing HBufC8 with C style pointers</xref>  </p> </li>
       
   400 <li id="GUID-44A25AD2-1970-5D1E-8B51-B92232F14E6F"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-586DD3B4-69DB-564B-AB8D-B3A02607CE02">Handling 16-bit data items</xref>  </p> </li>
       
   401 <li id="GUID-E9549A58-6921-5521-ACCA-E74DD962FFBC"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-77C88D19-50C3-5D69-8084-BE750F100BA0">Replacing CBase with DBase</xref>  </p> </li>
       
   402 <li id="GUID-BC1219A8-4F8F-5E91-ABE9-E8D89F904D58"><p> <xref href="GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7.dita#GUID-8EB25927-D49E-578F-BD93-294C4EECB7E7/GUID-585EE1D8-6080-5B37-A3BD-278B8731B7F9">Replacing User::QueryVersionSupported() with Kern::QueryVersionSupported()</xref>  </p> </li>
       
   403 </ul> <p id="GUID-CA520DD3-3601-5774-87F2-D5BA4DA2BF8E"><b>Buffers: replacing
       
   404 HBufC8 with HBuf</b> </p> <p>In EKA2, the heap descriptor buffer, <xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita"><apiname>HBufC8</apiname></xref> is
       
   405 not available. However, the kernel side defines and implements an equivalent
       
   406 (kernel) heap descriptor buffer: <xref href="GUID-1E0F353F-2532-3FF2-9992-06EC687C3998.dita"><apiname>HBuf8</apiname></xref>. <xref href="GUID-1E0F353F-2532-3FF2-9992-06EC687C3998.dita"><apiname>HBuf8</apiname></xref> is
       
   407 behaves in a similar way to <xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita"><apiname>HBufC8</apiname></xref>, so nearly all of your
       
   408 code can be reused, but note the following points: </p> <ul>
       
   409 <li id="GUID-409FC5CB-F502-54ED-972E-D00AF311180C"><p>If your code uses the
       
   410 typedef <xref href="GUID-A103FB19-60B3-3E45-97A5-1F295934ACA1.dita"><apiname>HBufC</apiname></xref>, then you need to change it to <xref href="GUID-5BEA9976-B969-3949-B855-E657FFF38EE2.dita"><apiname>HBuf</apiname></xref>. </p> </li>
       
   411 <li id="GUID-889793AE-1F58-5FAE-9C58-04E3549526F9"><p>On the kernel side,
       
   412 there is no explicit support for 16-bit buffers, which means that there is
       
   413 no class called HBuf16. In practice, this means that, <xref href="GUID-5BEA9976-B969-3949-B855-E657FFF38EE2.dita"><apiname>HBuf</apiname></xref> is
       
   414 always the same as <xref href="GUID-1E0F353F-2532-3FF2-9992-06EC687C3998.dita"><apiname>HBuf8</apiname></xref>. </p> </li>
       
   415 <li id="GUID-58F6F261-69EA-5D2E-BAF1-9EF844F13B5A"><p>Unlike <xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita"><apiname>HBufC8</apiname></xref>, <xref href="GUID-1E0F353F-2532-3FF2-9992-06EC687C3998.dita"><apiname>HBuf8</apiname></xref> is
       
   416 a modifiable type descriptor. It has <xref href="GUID-445B19E5-E2EE-32E2-8D6C-C7D6A9B3C507.dita"><apiname>TDes8</apiname></xref> in its derivation
       
   417 hierarchy, and this means that you can manipulate the descriptor's data (using
       
   418 the <xref href="GUID-445B19E5-E2EE-32E2-8D6C-C7D6A9B3C507.dita"><apiname>TDes8</apiname></xref> member functions). </p> </li>
       
   419 <li id="GUID-3D649264-94C6-598A-9F90-5ED6988A3B66"><p>The number of functions
       
   420 available to create an <xref href="GUID-1E0F353F-2532-3FF2-9992-06EC687C3998.dita"><apiname>HBuf8</apiname></xref> object is more limited than
       
   421 for <xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita"><apiname>HBufC8</apiname></xref> - there are only three variants - although in
       
   422 practice this is not a problem: </p> <ul>
       
   423 <li id="GUID-3B3B2A9D-13E0-57D4-A9F9-F308580B8F28"><p> <codeph>HBuf8::New(TInt
       
   424 aMaxLength)</codeph> to allocate a heap descriptor buffer (on the kernel heap)
       
   425 and set its length to zero; this behaves the same as the user side <codeph>HBufC8::New(TInt
       
   426 aMaxLength)</codeph>  </p> </li>
       
   427 <li id="GUID-213F8721-16E5-5E64-9D0A-E84E75831FB5"><p> <codeph>HBuf8::New(const
       
   428 TDesC8&amp; aDes)</codeph> to allocate a heap descriptor buffer (on the kernel
       
   429 heap) and initialise it by copying an existing descriptor's data into it. </p> </li>
       
   430 <li id="GUID-EBC5B863-9671-52C8-B22A-D303AA963697"><p> <codeph>HBuf8::ReAlloc(TInt
       
   431 aNewMax)</codeph> to re-allocate (i.e. to resize) a heap descriptor buffer
       
   432 (on the kernel heap); this behaves the same as the user side <codeph>HBufC8::New(TInt
       
   433 aMaxLength)</codeph>  </p> </li>
       
   434 </ul> </li>
       
   435 <li id="GUID-67068834-2B86-5901-9BB7-C8E0158BBDA5"><p>There are no "leaving"
       
   436 variants of these functions - if you have NewL(), NewLC(), and other "leaving"
       
   437 variants, then you will need to change your code to explicitly check the return
       
   438 code to make sure that the creation, or the reallocation of the heap descriptor
       
   439 buffer has worked. </p> </li>
       
   440 <li id="GUID-D6FE65EF-A142-5B19-9F6E-718C9844B04B"><p>As the descriptor is
       
   441 modifiable, there is no need for, and there is no equivalent of the function <xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita#GUID-2A528453-0279-3E47-838C-F8A8D29B88F1/GUID-155C7682-B1C4-38D0-9542-3829DF383050"><apiname>HBufC8::Des()</apiname></xref>;
       
   442 you just use the base class <xref href="GUID-445B19E5-E2EE-32E2-8D6C-C7D6A9B3C507.dita"><apiname>TDes8</apiname></xref> functions. </p> </li>
       
   443 <li id="GUID-28F7E8E5-4E78-5175-93B2-CA8365978A10"><p>If your code uses the
       
   444 assignment operators (i.e. the <codeph>=</codeph> operator), you don't need
       
   445 to change your code; the compiler will use the operators implemented in the <xref href="GUID-445B19E5-E2EE-32E2-8D6C-C7D6A9B3C507.dita"><apiname>TDes8</apiname></xref> base
       
   446 class, which will do the right thing. </p> </li>
       
   447 <li id="GUID-2909D8CE-D267-5EB7-9870-5253438F7E98"><p>The descriptor function <xref href="GUID-FB97E0A3-352A-316F-97C6-69E4741A8120.dita#GUID-FB97E0A3-352A-316F-97C6-69E4741A8120/GUID-FF9F5F8C-A240-354E-BBD3-44772AE5C4A4"><apiname>TDesC8::Alloc()</apiname></xref> is
       
   448 no longer available on the kernel side, so you cannot create a heap descriptor
       
   449 buffer from a general descriptor. </p> </li>
       
   450 </ul> <p>The following code fragments show code that is approximately equivalent
       
   451 between EKA1 and EKA2. The fragments are a little artificial, and make assumptions
       
   452 that would not necessarily be made in real code, but nevertheless still show
       
   453 the essential differences. </p> <table id="GUID-C5338045-8A9C-5605-AB94-04D2770183E0">
       
   454 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
   455 <tbody>
       
   456 <row>
       
   457 <entry><p> <b>EKA1</b>  </p> </entry>
       
   458 <entry><p> <b>EKA2</b>  </p> </entry>
       
   459 </row>
       
   460 <row>
       
   461 <entry><p>This is a function that allocates a heap descriptor buffer (<xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita"><apiname>HBufC8</apiname></xref>),
       
   462 puts data into it, changes its size, replaces the data, deletes a part of
       
   463 the data, and then deletes it. </p> <codeblock id="GUID-DEA8F91F-DE46-5DCF-BF06-9F4E89C5F366" xml:space="preserve">_LIT8(KTxSmall,"abcdef");
       
   464 _LIT8(KTxBig,"ghijklmnopqrstuvwxyz");
       
   465 
       
   466 void X::FunctionL()
       
   467     {
       
   468     // Create a buffer big enough to contain
       
   469     // the text "abcdef".
       
   470     // This uses the "leaving" variant, and leaves
       
   471     // if there is insufficient memory.
       
   472     HBufC8* pBuf = HBufC8::NewL(KTxSmall().Length());
       
   473 
       
   474     // Copy the text "abcdedf" into it
       
   475     *pBUf = KTxSmall;
       
   476         
       
   477     // Make the buffer bigger...
       
   478     // ... and check that it worked OK
       
   479     // Note that we are using the non-leaving version.
       
   480     // We could use the leaving version, but we would
       
   481     // need to handle the cleanup of pBuf 
       
   482     HBuf8* pNewBuf = pBuf-&gt;ReAlloc(KTxBig().Length());;
       
   483 
       
   484     if (pNewBuf)
       
   485         {
       
   486         pBuf = pNewBuf;
       
   487         }
       
   488      else
       
   489         {
       
   490         delete pBuf;
       
   491         User::Leave(KErrNoMemory);
       
   492         }
       
   493 
       
   494     // Replace content of the descriptor with 
       
   495     // the text "ghijkl......"
       
   496     *pBuf = KTxBig;
       
   497 
       
   498     // Need to use the Des() function to create 
       
   499     // a modifiable descriptor before we can make
       
   500     // changes to the text in the descriptor.
       
   501     TPtr8 pDesPtr;
       
   502     pDesPtr = pBuf-&gt;Des();
       
   503 
       
   504     // Delete the 1st two characters.
       
   505     PDesPtr.Delete(0,2)
       
   506      
       
   507     delete pBUf;
       
   508 
       
   509     return;
       
   510     }</codeblock> </entry>
       
   511 <entry><p>A similar function, but it uses <xref href="GUID-1E0F353F-2532-3FF2-9992-06EC687C3998.dita"><apiname>HBuf8</apiname></xref> instead. </p> <codeblock id="GUID-927B0A0C-D65B-5E5C-811D-285437C473BE" xml:space="preserve">_LIT8(KTxSmall,"abcdef");
       
   512 _LIT8(KTxBig,"ghijklmnopqrstuvwxyz");
       
   513 
       
   514 TInt X::Function()
       
   515     {
       
   516     // Create a buffer big enough to contain
       
   517     // the text "abcdef", and copy the text
       
   518     // from its source into the buffer.
       
   519     //
       
   520     // You need to check explicitly that this
       
   521     // has worked.
       
   522     HBuf8* pBuf = HBuf8::New(KTxSmall);
       
   523     if (!pBuf)
       
   524         {
       
   525         return KErrNoMemory;
       
   526         }
       
   527         
       
   528     // Make the buffer bigger...
       
   529     // .. and check that it worked OK
       
   530     HBuf8* pNewBuf = pBuf-&gt;ReAlloc(KTxBig().Length());
       
   531 
       
   532     if (pNewBuf)
       
   533         {
       
   534         pBuf = pNewBuf;
       
   535         }
       
   536      else
       
   537         {
       
   538         delete pBuf;
       
   539         return KErrNoMemory;
       
   540         }
       
   541 
       
   542     // You can still use the =operator to replace 
       
   543     // the content of the heap descriptor !
       
   544     // Replace content with 
       
   545     // the text "ghijkl......"
       
   546     *pBuf = KTxBig;
       
   547 
       
   548 
       
   549     // Can now use use the TDes8 functions
       
   550     // directly.
       
   551     // This deletes the 1st two characters.
       
   552     pBuf-&gt;Delete(0,2);
       
   553 
       
   554     // delete the heap descriptor
       
   555     delete pBUf;
       
   556 
       
   557     return KErrNone;
       
   558     }</codeblock> </entry>
       
   559 </row>
       
   560 <row>
       
   561 <entry><p>A small code fragment that uses <xref href="GUID-FB97E0A3-352A-316F-97C6-69E4741A8120.dita#GUID-FB97E0A3-352A-316F-97C6-69E4741A8120/GUID-FF9F5F8C-A240-354E-BBD3-44772AE5C4A4"><apiname>TDesC8::Alloc()</apiname></xref> to
       
   562 create an <xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita"><apiname>HBufC8</apiname></xref> heap descriptor buffer from an existing
       
   563 descriptor. </p> <codeblock id="GUID-7545CD6E-8849-5CE0-88A8-975F141A7877" xml:space="preserve">HBufC8* X::Function(const TDesC8&amp; aDes)
       
   564     {
       
   565     // Returns NULL if creation
       
   566     // of the heap descriptor buffer fails.
       
   567 
       
   568     return aDes.Alloc();
       
   569     }</codeblock> <p>or possibly: </p> <codeblock id="GUID-0E01D617-B83F-558A-8C6B-BF9BD8B2E449" xml:space="preserve">HBufC8* X::FunctionL(const TDesC8&amp; aDes)
       
   570     {
       
   571     // Leaves if creation of the heap
       
   572     // descriptor buffer fails, otherwise it 
       
   573     // returns a valid pointer.
       
   574 
       
   575     return(aDes.AllocL());
       
   576     }</codeblock> </entry>
       
   577 <entry><p>An equivalent code fragment that creates an <xref href="GUID-1E0F353F-2532-3FF2-9992-06EC687C3998.dita"><apiname>HBuf8</apiname></xref> heap
       
   578 descriptor buffer. </p> <codeblock id="GUID-EA7187B6-8365-5F77-941A-CCCC359BF5D0" xml:space="preserve">HBuf8* X::Function(const TDesC8&amp; aDes)
       
   579     {
       
   580     // Returns NULL if creation
       
   581     // of the heap descriptor buffer fails.
       
   582    
       
   583     return (HBuf8::New(aDes));
       
   584     }</codeblock> </entry>
       
   585 </row>
       
   586 </tbody>
       
   587 </tgroup>
       
   588 </table> <p id="GUID-310ADB7F-A03C-5994-A918-634B7BAB7DD8"><b>Buffers: replacing
       
   589 HBufC8 with C style pointers</b> </p> <p>Instead of replacing <xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita"><apiname>HBufC8</apiname></xref> with <xref href="GUID-5BEA9976-B969-3949-B855-E657FFF38EE2.dita"><apiname>HBuf</apiname></xref>,
       
   590 it may be more suitable to replace your heap descriptor buffers with C style
       
   591 pointers - effectively managing your buffers in open code or as part of the
       
   592 implementation of your own purpose written classes. </p> <p>You allocate memory
       
   593 from the kernel heap using <xref href="GUID-C6946ECB-775F-3EC2-A56F-78F25B9FBE3D.dita#GUID-C6946ECB-775F-3EC2-A56F-78F25B9FBE3D/GUID-DCB1C323-54D4-3C43-849A-503C19075C18"><apiname>Kern::Alloc()</apiname></xref> or <xref href="GUID-C6946ECB-775F-3EC2-A56F-78F25B9FBE3D.dita#GUID-C6946ECB-775F-3EC2-A56F-78F25B9FBE3D/GUID-25A2BC43-08AB-34E8-93B4-AD4B82A98666"><apiname>Kern::AllocZ()</apiname></xref> and
       
   594 track the pointers to that memory. The following code fragments show how the
       
   595 use of HBufC8 translates to the direct use of these functions. </p> <p>Although
       
   596 the EKA2 code here uses <xref href="GUID-E2C25A1E-46B4-3697-A939-613CA366D87A.dita"><apiname>memcpy()</apiname></xref>, and <xref href="GUID-AC5005AE-EDC0-36EE-B877-2F91B09B0068.dita"><apiname>memmove()</apiname></xref>,
       
   597 you will also find the functions <xref href="GUID-5F6B1E3D-4F68-3870-96E2-8EA88D70C888.dita"><apiname>memclr()</apiname></xref>, <xref href="GUID-5A95E126-A82F-3F29-9810-FA1CD35E8B19.dita"><apiname>memset()</apiname></xref>, <xref href="GUID-9A49DF44-1742-32CF-8C13-AF732C3971A6.dita"><apiname>wordmove()</apiname></xref> and <xref href="GUID-57B71C3A-3F1E-3304-AA6C-EF53CD6682AD.dita"><apiname>memcompare()</apiname></xref> useful in your code. </p> <table id="GUID-A6F83848-EEE6-5656-BBD9-6CA8CC986AAD">
       
   598 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
   599 <tbody>
       
   600 <row>
       
   601 <entry><p> <b>EKA1</b>  </p> </entry>
       
   602 <entry><p> <b>EKA2</b>  </p> </entry>
       
   603 </row>
       
   604 <row>
       
   605 <entry><p>This is a function that allocates a heap descriptor buffer (<xref href="GUID-2A528453-0279-3E47-838C-F8A8D29B88F1.dita"><apiname>HBufC8</apiname></xref>),
       
   606 puts data into it, changes its size, replaces the data, deletes a part of
       
   607 the data, and then deletes the whole buffer. </p> <codeblock id="GUID-7541F426-A84A-5496-A75D-A5235DD0B45E" xml:space="preserve">_LIT8(KTxSmall,"abcdef");
       
   608 _LIT8(KTxBig,"ghijklmnopqrstuvwxyz");
       
   609 
       
   610 void X::FunctionL()
       
   611     {
       
   612     // Create a buffer big enough to contain
       
   613     // the text "abcdef".
       
   614     // This uses the "leaving" variant, and leaves
       
   615     // if there is insufficient memory.
       
   616     HBufC8* pBuf = HBufC8::NewL(KTxSmall().Length());
       
   617 
       
   618     // Copy the text "abcdedf" into it
       
   619     *pBUf = KTxSmall;
       
   620         
       
   621     // Make the buffer bigger...
       
   622     // ... and check that it worked OK
       
   623     // Note that we are using the non-leaving version.
       
   624     // We could use the leaving version, but we would
       
   625     // need to handle the cleanup of pBuf 
       
   626     HBuf8* pNewBuf = pBuf-&gt;ReAlloc(KTxBig().Length());;
       
   627 
       
   628     if (pNewBuf)
       
   629         {
       
   630         pBuf = pNewBuf;
       
   631         }
       
   632      else
       
   633         {
       
   634         delete pBuf;
       
   635         User::Leave(KErrNoMemory);
       
   636         }
       
   637 
       
   638     // Replace content of the descriptor with 
       
   639     // the text "ghijkl......"
       
   640     *pBuf = KTxBig;
       
   641 
       
   642     // Need to use the Des() function to create 
       
   643     // a modifiable descriptor before we can make
       
   644     // changes to the text in the descriptor.
       
   645     TPtr8 pDesPtr;
       
   646     pDesPtr = pBuf-&gt;Des();
       
   647 
       
   648     // Delete the 1st two characters.
       
   649     PDesPtr.Delete(0,2)
       
   650      
       
   651     delete pBUf;
       
   652 
       
   653     return;
       
   654     }</codeblock> </entry>
       
   655 <entry><p>A similar function, but allocates memory on the kernel heap explicitly,
       
   656 and manages its own pointers instead. Note the use of the nanokernel utility
       
   657 function: <xref href="GUID-E2C25A1E-46B4-3697-A939-613CA366D87A.dita"><apiname>memcpy()</apiname></xref>, and <xref href="GUID-AC5005AE-EDC0-36EE-B877-2F91B09B0068.dita"><apiname>memmove()</apiname></xref>  </p> <codeblock id="GUID-DB644074-0F80-58CE-9FE9-D5C5AF521849" xml:space="preserve">_LIT8(KTxSmall,"abcdef");
       
   658 _LIT8(KTxBig,"ghijklmnopqrstuvwxyz");
       
   659 
       
   660 TInt X::Function()
       
   661     {
       
   662     // Create a buffer big enough to contain
       
   663     // the text "abcdef", and copy the text
       
   664     // from its source into the buffer.
       
   665     //
       
   666     // Steps.
       
   667     // 1. work out the size of buffer needed
       
   668     // 2. Get the buffer.
       
   669     // 3. Copy the source.
       
   670 
       
   671     TInt lengthInBuffer = 0;
       
   672      
       
   673     // 1.
       
   674     TInt Smallsize;
       
   675     SmallSize = KTxSmall().Length();
       
   676     lengthInBuffer = SmallSize;
       
   677 
       
   678     // 2.
       
   679     TUint8* pBuf;
       
   680     pBuf = Kern::Alloc(SmallSize);
       
   681     if (!pBuf)
       
   682         {
       
   683         return KErrNoMemory;
       
   684         }
       
   685 
       
   686     // 3.
       
   687     memcpy(pBuf,KTxSmall().Ptr(),SmallSize));
       
   688 
       
   689 
       
   690     // Make the buffer bigger.
       
   691     // If it works ok, then copy the data
       
   692     // to the new buffer, delete the old buffer
       
   693     TInt BiggerSize;
       
   694     TUint8* pNewBuf;
       
   695 
       
   696     BiggerSize = KTxBig().Length();
       
   697     pNewBuf = Kern::Alloc(BiggerSize);
       
   698     if (pNewBuf)
       
   699         {
       
   700         memcpy(pNewBuf, pBuf, SmallSize);
       
   701         Kern::Free(pBuf);
       
   702         pBuf = pNewBuf;       
       
   703         }
       
   704      else
       
   705         {
       
   706         Kern::Free(pBuf);
       
   707         return KErrNoMemory;
       
   708         }
       
   709      lengthInBuffer = BiggerSize;
       
   710 
       
   711     // Replace content with 
       
   712     // the text "ghijkl......"
       
   713     memcpy(pNewBuf, KTxBig().Ptr(), BiggerSize);
       
   714    
       
   715 
       
   716     // Delete 1st two characters 
       
   717     memmove(pNewBuf, pNewBuf+2, lengthInBuffer;
       
   718     lengthInBuffer -= 2;
       
   719    
       
   720     Kern::Free(pBuf);
       
   721 
       
   722     return KErrNone;
       
   723     }</codeblock> </entry>
       
   724 </row>
       
   725 </tbody>
       
   726 </tgroup>
       
   727 </table> <p id="GUID-586DD3B4-69DB-564B-AB8D-B3A02607CE02"><b>Handling 16-bit
       
   728 data items</b> </p> <p>If you need to handle 16-bit items on the kernel side,
       
   729 then you can still use 8-bit heap descriptor buffers. You just need to be
       
   730 aware that the data is 16 bit and cast accordingly. The following code fragments
       
   731 are simplistic, but show you the basic idea. </p> <table id="GUID-65BA6847-9FC7-53B2-B9F6-2D649D4B75AE">
       
   732 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
   733 <tbody>
       
   734 <row>
       
   735 <entry><p> <b>EKA1</b>  </p> </entry>
       
   736 <entry><p> <b>EKA2</b>  </p> </entry>
       
   737 </row>
       
   738 <row>
       
   739 <entry><p>This is a function which is passed a 16-bit descriptor containing
       
   740 16-bit wide characters. </p> <codeblock id="GUID-52B25979-B624-5D89-8D38-ADEDF3F27BED" xml:space="preserve">void X::FunctionL(const TDes16&amp; aDes)
       
   741     {
       
   742     HBuf16* pBuf = aDes.AllocL();
       
   743 
       
   744     TInt     noOfCharacters;
       
   745     TUint16* pointerToData;
       
   746 
       
   747     noOfCharacters = pBuf-&gt;Length();
       
   748     pointerToData  = pBuf-&gt;Ptr();
       
   749 
       
   750     ...
       
   751     }</codeblock> </entry>
       
   752 <entry><p>This is a similar function which is also passed 16-bit wide characters.
       
   753 The function needs slight changes as it can only receive data through an 8-bit
       
   754 descriptor. </p> <codeblock id="GUID-DD5720C2-1132-5991-B2E1-71B1BECAC15C" xml:space="preserve">TInt X::Function(const TDes8&amp; aDes)
       
   755     {
       
   756     HBuf8* pBuf = HBuf8::New(aDes);
       
   757     if (!pBuf)
       
   758        {
       
   759        return KErrNoMemory;
       
   760        }
       
   761 
       
   762     TInt     noOfCharacters;
       
   763     TUint16* pointerToData;
       
   764      
       
   765     noOfCharacters = ((pBuf-&gt;Length()) &gt;&gt; 1);
       
   766     pointerToData  = (TUint16*)(pBuf-&gt;Ptr());
       
   767 
       
   768     ...
       
   769 
       
   770     return KErrNone;
       
   771     }</codeblock> </entry>
       
   772 </row>
       
   773 </tbody>
       
   774 </tgroup>
       
   775 </table> <p id="GUID-77C88D19-50C3-5D69-8084-BE750F100BA0"><b>Replacing CBase
       
   776 with DBase</b> </p> <p>The <xref href="GUID-4FCB6127-84F3-38F6-8AD2-FC3B94D67DA3.dita"><apiname>DBase</apiname></xref> class is the kernel-side
       
   777 equivalent of the user-side <xref href="GUID-8F6FE089-E2A8-30F4-B67E-10F286347681.dita"><apiname>CBase</apiname></xref> class. It provides zero-filling
       
   778 of memory prior to object construction and a virtual destructor in a similar
       
   779 way to <xref href="GUID-8F6FE089-E2A8-30F4-B67E-10F286347681.dita"><apiname>CBase</apiname></xref>. </p> <p>If you have a class derived from <xref href="GUID-8F6FE089-E2A8-30F4-B67E-10F286347681.dita"><apiname>CBase</apiname></xref>,
       
   780 then all you need to do is: </p> <ul>
       
   781 <li id="GUID-B5ABF979-A6E0-5733-AFB2-DAC8FC132BA0"><p>change your class definition
       
   782 so that it is derived from <xref href="GUID-4FCB6127-84F3-38F6-8AD2-FC3B94D67DA3.dita"><apiname>DBase</apiname></xref>. </p> </li>
       
   783 <li id="GUID-03B04EF1-32FE-5B37-A67C-AE57F8902F8E"><p>Remember to include
       
   784 the <filepath>klib.h</filepath> header file. </p> </li>
       
   785 </ul> <p>you should not need to do anything else. </p> <p>One additional feature
       
   786 provided by <xref href="GUID-4FCB6127-84F3-38F6-8AD2-FC3B94D67DA3.dita"><apiname>DBase</apiname></xref> that is not available in <xref href="GUID-8F6FE089-E2A8-30F4-B67E-10F286347681.dita"><apiname>CBase</apiname></xref> is
       
   787 the function <xref href="GUID-4FCB6127-84F3-38F6-8AD2-FC3B94D67DA3.dita#GUID-4FCB6127-84F3-38F6-8AD2-FC3B94D67DA3/GUID-40C0DEE0-7E6F-3D28-9B33-77A3CCC4E66E"><apiname>DBase::AsyncDelete()</apiname></xref>. This allows you to delete
       
   788 an instance of a <xref href="GUID-4FCB6127-84F3-38F6-8AD2-FC3B94D67DA3.dita"><apiname>DBase</apiname></xref> derived class asynchronously, and
       
   789 is useful if you need to delete a <xref href="GUID-4FCB6127-84F3-38F6-8AD2-FC3B94D67DA3.dita"><apiname>DBase</apiname></xref> derived object
       
   790 in time-critical code. </p> <p>Internally, asynchronous deletion works by
       
   791 placing the object to be deleted onto a queue, and then triggering a DFC,
       
   792 which runs in the context of the supervisor thread. This means that only a
       
   793 small amount of code is executed by your (the calling) thread, and the actual
       
   794 deletion is done by the supervisor thread. </p> <p>Its use is straightforward. </p> <codeblock id="GUID-1C283AE2-391A-5687-BA56-D8C1DD4E7745" xml:space="preserve">class DMyObject : public DBase
       
   795     {
       
   796     ...
       
   797     }</codeblock> <codeblock id="GUID-20E2CA1A-06EE-5ADE-8B5B-14A3CE47ABDB" xml:space="preserve">DMyObject pPtr;
       
   798     ...
       
   799     pPtr = new DMyObject;
       
   800     ...
       
   801     pPtr-&gt;AsyncDelete();
       
   802     ...</codeblock> <p id="GUID-585EE1D8-6080-5B37-A3BD-278B8731B7F9"><b>Replacing
       
   803 User::QueryVersionSupported() with Kern::QueryVersionSupported()</b> </p> <p> <xref href="GUID-C197C9A7-EA05-3F24-9854-542E984C612D.dita#GUID-C197C9A7-EA05-3F24-9854-542E984C612D/GUID-B68B3E85-D58E-31FD-8BD2-A4F346BF416F"><apiname>User::QueryVersionSupported()</apiname></xref> is
       
   804 replaced by <xref href="GUID-C6946ECB-775F-3EC2-A56F-78F25B9FBE3D.dita#GUID-C6946ECB-775F-3EC2-A56F-78F25B9FBE3D/GUID-A28757CC-B89B-3F63-AD39-9955FBE7533B"><apiname>Kern::QueryVersionSupported()</apiname></xref> on the kernel
       
   805 side. </p> <p>The parameters passed to these functions are the same, both
       
   806 in type and meaning. The behaviour of both functions is also the same. This
       
   807 means that all you need to do is replace <codeph>User::</codeph> with <codeph>Kern::</codeph> in
       
   808 your code. </p> </section>
       
   809 </conbody></concept>